/* ════════════════════════════════════════
   KISAN360 — pages.css
   Shared styles: search · saved · profile
   Mobile-first → Desktop
   ════════════════════════════════════════ */

/* ════════════════════════════════════════
   SHARED: inner page wrapper
   (sidebar + main, mirrors index.php)
   ════════════════════════════════════════ */
.inner-page-wrapper {
  display: block;
  margin-top: var(--topnav-h);
  padding-bottom: calc(var(--bottomnav-h) + 16px);
  min-height: 100vh;
}

.inner-main {
  padding: 16px;
}

/* Sidebar hidden on mobile (same as index) */
.inner-page-wrapper .sidebar { display: none; }

/* ════════════════════════════════════════
   SHARED: page header
   ════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.page-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.page-sub { font-size: 13px; color: var(--muted); }

/* ════════════════════════════════════════
   SHARED: result/saved card loc + time
   ════════════════════════════════════════ */
.rc-loc {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted);
}
.rc-loc svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.rc-dot { color: var(--hint); font-size: 10px; }

/* ════════════════════════════════════════
   SEARCH PAGE
   ════════════════════════════════════════ */
.search-wrapper {
  display: block;
  margin-top: var(--topnav-h);
  padding-bottom: calc(var(--bottomnav-h) + 16px);
}

/* Mobile search bar */
.mobile-search-bar { padding: 12px 16px 0; }

/* ── Results header ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.results-count { font-size: 14px; color: var(--muted); }
.results-num { font-size: 16px; font-weight: 600; color: var(--text); }
.sort-row { display: flex; align-items: center; gap: 8px; }
.sort-label { font-size: 12px; color: var(--hint); }
.sort-select {
  font-size: 13px; font-weight: 500; color: var(--text);
  border: 1px solid var(--border); background: #fff;
  border-radius: 8px; padding: 6px 10px;
  outline: none; cursor: pointer; font-family: 'DM Sans', sans-serif;
}

/* Active filter chips */
.active-chips {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 0 16px 8px;
}
.active-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gl); color: var(--g2);
  font-size: 12px; font-weight: 500;
  padding: 5px 10px; border-radius: 20px;
  border: 1px solid var(--gm);
}
.chip-remove {
  font-size: 14px; cursor: pointer; line-height: 1;
  color: var(--g3); font-weight: 600;
}

/* ── Result cards ── */
.results-grid {
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: block;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.result-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(26,107,58,0.09); }

.result-img {
  height: 115px; overflow: hidden;
  position: relative; background: var(--gl);
}
.result-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.result-card:hover .result-img img { transform: scale(1.04); }

.rc-badge {
  position: absolute; top: 7px; left: 7px;
  background: var(--g1); color: #fff;
  font-size: 8px; font-weight: 700; padding: 2px 6px; border-radius: 4px; letter-spacing: 0.4px;
}
.rc-verified {
  position: absolute; top: 7px; right: 34px;
  width: 22px; height: 22px; background: var(--g3);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.rc-verified svg { width: 11px; height: 11px; stroke: #fff; fill: none; stroke-width: 2.5; }

.rc-fav {
  position: absolute; top: 7px; right: 7px;
  width: 26px; height: 26px;
  background: rgba(255,255,255,0.92); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; transition: transform 0.15s;
}
.rc-fav svg { width: 12px; height: 12px; stroke: var(--hint); fill: none; stroke-width: 2; transition: stroke 0.2s, fill 0.2s; }
.rc-fav.saved svg { stroke: #e24b4a; fill: #e24b4a; }

.result-body { padding: 10px 12px; }
.rc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.rc-time { font-size: 10px; color: var(--hint); }

.result-body h3 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.rc-price { font-size: 14px; font-weight: 600; color: var(--g1); margin-bottom: 4px; }
.rc-specs { font-size: 10px; color: var(--muted); margin-bottom: 5px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Load more */
.load-more-wrap { padding: 8px 16px 24px; text-align: center; }
.load-more-btn {
  width: 100%; max-width: 320px;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 12px; padding: 13px;
  font-size: 14px; font-weight: 500; color: var(--text);
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, border-color 0.15s;
}
.load-more-btn:hover { background: var(--gl); border-color: var(--g3); color: var(--g2); }

/* ── Filter sidebar (mobile: drawer) ── */
.filter-sidebar {
  position: fixed; top: 0; left: -100%; bottom: 0;
  width: 280px; background: #fff;
  box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  z-index: 300; transition: left 0.3s; overflow-y: auto;
  padding: 20px 0 40px;
}
.filter-sidebar.open { left: 0; }
.filter-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  z-index: 299; display: none; opacity: 0; transition: opacity 0.3s;
}
.filter-backdrop.show { display: block; opacity: 1; }

.filter-sidebar-header {
  display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px 16px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.filter-sidebar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.filter-clear-btn { font-size: 13px; color: var(--g3); font-weight: 500; background: none; border: none; cursor: pointer; }

.filter-group { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.filter-group-label { font-size: 11px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.filter-check {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; cursor: pointer; font-size: 13px; color: var(--text);
}
.filter-check input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--g3); cursor: pointer; flex-shrink: 0;
}
.price-range-row { display: flex; align-items: center; gap: 10px; }
.price-input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: 'DM Sans', sans-serif;
  color: var(--text); outline: none; min-width: 0;
  transition: border-color 0.2s;
}
.price-input:focus { border-color: var(--g3); }
.price-dash { color: var(--hint); font-size: 14px; flex-shrink: 0; }

.filter-apply-btn {
  margin: 20px 20px 0; display: block; width: calc(100% - 40px);
  background: var(--g3); color: #fff; border: none;
  border-radius: 12px; padding: 13px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: background 0.15s;
}
.filter-apply-btn:hover { background: var(--g2); }

/* ════════════════════════════════════════
   SAVED PAGE
   ════════════════════════════════════════ */
.clear-all-btn {
  font-size: 13px; color: var(--red); font-weight: 500;
  background: none; border: 1px solid var(--red);
  border-radius: 8px; padding: 7px 13px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: background 0.15s;
  flex-shrink: 0;
}
.clear-all-btn:hover { background: var(--rl); }

/* Empty state */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-icon {
  width: 72px; height: 72px;
  background: var(--gl); border-radius: 24px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
}
.empty-icon svg { width: 36px; height: 36px; stroke: var(--gm); fill: none; stroke-width: 1.5; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.empty-cta {
  display: inline-block; background: var(--g3); color: #fff;
  padding: 12px 28px; border-radius: 12px;
  font-size: 14px; font-weight: 600; transition: background 0.15s;
}
.empty-cta:hover { background: var(--g2); }

/* Saved grid */
.saved-grid {
  display: flex; flex-direction: column; gap: 12px;
}

.saved-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
  display: flex; align-items: stretch;
  position: relative; transition: box-shadow 0.15s;
}
.saved-card:hover { box-shadow: 0 4px 16px rgba(26,107,58,0.08); }

.saved-card-link { display: flex; flex: 1; text-decoration: none; min-width: 0; }

.saved-img {
  width: 110px; flex-shrink: 0; position: relative; background: var(--gl); overflow: hidden;
}
.saved-img img { width: 100%; height: 100%; object-fit: cover; }
.sc-verified {
  position: absolute; bottom: 7px; left: 7px;
  width: 20px; height: 20px; background: var(--g3);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.sc-verified svg { width: 10px; height: 10px; stroke: #fff; fill: none; stroke-width: 2.5; }

.saved-body { flex: 1; padding: 12px 14px 12px 12px; min-width: 0; }
.sc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.sc-neg {
  font-size: 10px; background: var(--gl); color: var(--g2);
  padding: 2px 7px; border-radius: 10px; font-weight: 500;
}
.saved-body h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 4px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sc-price { font-size: 15px; font-weight: 600; color: var(--g1); margin-bottom: 5px; }
.sc-specs { font-size: 11px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.sc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-time { font-size: 10px; color: var(--hint); }

.sc-remove-btn {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.95); border-radius: 50%;
  border: none; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.sc-remove-btn:hover { background: var(--rl); transform: scale(1.1); }
.sc-remove-btn svg { width: 13px; height: 13px; }

/* ════════════════════════════════════════
   PROFILE PAGE
   ════════════════════════════════════════ */

/* Profile hero */
.profile-hero {
  background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 20px;
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 16px; flex-wrap: wrap;
}

.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar {
  width: 72px; height: 72px; border-radius: 20px;
  background: var(--g3); color: #fff;
  font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 1px;
}
.avatar-edit-btn {
  position: absolute; bottom: -6px; right: -6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s;
}
.avatar-edit-btn svg { width: 12px; height: 12px; stroke: var(--muted); fill: none; stroke-width: 2; }
.avatar-edit-btn:hover { background: var(--gl); }

.profile-info { flex: 1; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.profile-name { font-family: 'Playfair Display', Georgia, serif; font-size: 20px; font-weight: 700; color: var(--text); }
.profile-verified {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--gl); color: var(--g2);
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px;
}
.profile-verified svg { width: 11px; height: 11px; stroke: var(--g3); fill: none; stroke-width: 2.5; }

.profile-meta-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.profile-meta-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.profile-meta-item svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.profile-contact-row { display: flex; flex-direction: column; gap: 5px; }
.profile-contact { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); }
.profile-contact svg { width: 13px; height: 13px; stroke: var(--g3); fill: none; stroke-width: 2; flex-shrink: 0; }

.edit-profile-btn {
  background: var(--gl); color: var(--g2);
  border: 1px solid var(--gm); border-radius: 10px;
  padding: 9px 16px; font-size: 13px; font-weight: 500;
  text-decoration: none; display: inline-block;
  transition: background 0.15s; white-space: nowrap; flex-shrink: 0;
  align-self: flex-start;
}
.edit-profile-btn:hover { background: var(--gm); }

/* Stats row */
.stats-row {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.stat-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 10px; text-align: center;
}
.stat-val { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 3px; font-family: 'Playfair Display', Georgia, serif; }
.stat-val.green { color: var(--g3); }
.stat-val.amber { color: var(--amber); }
.stat-val.red   { color: var(--red); }
.stat-label { font-size: 10px; color: var(--hint); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }

/* Profile sections */
.profile-section {
  background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 20px;
  margin-bottom: 16px;
}
.profile-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.profile-section-title { font-size: 16px; font-weight: 600; color: var(--text); }
.section-head-btn {
  font-size: 13px; font-weight: 500; color: var(--g3);
  background: var(--gl); border: 1px solid var(--gm);
  border-radius: 8px; padding: 7px 13px;
  text-decoration: none; transition: background 0.15s;
}
.section-head-btn:hover { background: var(--gm); }

/* Ads tab bar */
.ads-tab-bar {
  display: flex; gap: 4px; background: var(--surface);
  border-radius: 12px; padding: 4px;
  margin-bottom: 16px;
}
.ads-tab {
  flex: 1; font-size: 12px; font-weight: 500; color: var(--muted);
  background: none; border: none; cursor: pointer;
  padding: 8px 6px; border-radius: 9px; transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.ads-tab.active { background: #fff; color: var(--g2); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* My ad cards */
.my-ads-list { display: flex; flex-direction: column; gap: 10px; }

.my-ad-card {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; background: var(--surface);
  transition: box-shadow 0.15s;
}
.my-ad-card:hover { box-shadow: 0 3px 12px rgba(26,107,58,0.07); }
.my-ad-card.hidden { display: none; }

.my-ad-img {
  width: 88px; flex-shrink: 0; overflow: hidden; background: var(--gl); display: block;
}
.my-ad-img img { width: 100%; height: 100%; object-fit: cover; }

.my-ad-body { flex: 1; padding: 11px 12px; min-width: 0; }
.my-ad-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.my-ad-status {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
  text-transform: capitalize;
}
.my-ad-status.active { background: var(--gl); color: var(--g2); }
.my-ad-status.sold   { background: var(--al); color: var(--amber); }
.my-ad-status.expired { background: var(--rl); color: var(--red); }

.my-ad-title { font-size: 13px; font-weight: 600; color: var(--text); display: block; margin-bottom: 3px; text-decoration: none; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-ad-price { font-size: 14px; font-weight: 600; color: var(--g1); margin-bottom: 6px; }
.my-ad-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.my-ad-loc, .my-ad-views, .my-ad-time {
  display: flex; align-items: center; gap: 3px;
  font-size: 10px; color: var(--muted);
}
.my-ad-loc svg, .my-ad-views svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.my-ad-time { color: var(--hint); }

.my-ad-actions {
  display: flex; flex-direction: column; gap: 0;
  border-left: 1px solid var(--border);
}
.my-ad-btn {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 0 14px; cursor: pointer; background: none; border: none;
  transition: background 0.15s; text-decoration: none;
}
.my-ad-btn:not(:last-child) { border-bottom: 1px solid var(--border); }
.my-ad-btn svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; }
.my-ad-btn.edit:hover { background: var(--gl); }
.my-ad-btn.edit:hover svg { stroke: var(--g2); }
.my-ad-btn.delete:hover { background: var(--rl); }
.my-ad-btn.delete:hover svg { stroke: var(--red); }

/* Settings list */
.settings-list { display: flex; flex-direction: column; gap: 2px; }
.settings-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 12px; border-radius: 12px;
  text-decoration: none; transition: background 0.15s; cursor: pointer;
}
.settings-item:hover { background: var(--surface); }
.settings-item.danger:hover { background: var(--rl); }

.settings-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--surface); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.settings-icon svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.8; }
.settings-icon.green-icon { background: var(--gl); }
.settings-icon.green-icon svg { stroke: var(--g3); }
.settings-icon.red-icon { background: var(--rl); }
.settings-icon.red-icon svg { stroke: var(--red); }

.settings-text { flex: 1; min-width: 0; }
.settings-label { font-size: 14px; font-weight: 500; color: var(--text); }
.settings-sub { font-size: 11px; color: var(--hint); margin-top: 1px; }
.settings-item.danger .settings-label { color: var(--red); }
.settings-arrow { width: 16px; height: 16px; stroke: var(--hint); fill: none; stroke-width: 2; flex-shrink: 0; }

/* ════════════════════════════════════════
   TABLET — 640px
   ════════════════════════════════════════ */
@media (min-width: 640px) {
  .results-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-row    { grid-template-columns: repeat(5, 1fr); }
  .saved-grid   { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════
   DESKTOP — 1024px
   ════════════════════════════════════════ */
@media (min-width: 1024px) {

  body { background: #eef2eb; }

  /* ── INNER PAGE WRAPPER ── */
  .inner-page-wrapper {
    display: flex;
    align-items: flex-start;
    max-width: var(--max-w);
    margin: var(--topnav-h) auto 0;
    padding: 24px 40px 48px;
    gap: 28px;
    padding-bottom: 48px;
  }

  .inner-page-wrapper .sidebar {
    display: flex; flex-direction: column;
    width: var(--side-w); flex-shrink: 0;
    position: sticky; top: calc(var(--topnav-h) + 20px);
    gap: 12px;
  }

  .inner-main {
    flex: 1; min-width: 0;
    padding: 0;
  }

  /* ── SEARCH PAGE ── */
  .search-wrapper {
    display: flex;
    align-items: flex-start;
    max-width: var(--max-w);
    margin: var(--topnav-h) auto 0;
    padding: 24px 40px 48px;
    gap: 28px;
    padding-bottom: 48px;
  }

  /* Filter sidebar — static on desktop */
  .filter-sidebar {
    position: sticky;
    top: calc(var(--topnav-h) + 20px);
    left: auto;
    width: var(--side-w);
    flex-shrink: 0;
    height: fit-content;
    max-height: calc(100vh - var(--topnav-h) - 40px);
    overflow-y: auto;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: none;
    padding: 20px 0;
    transition: none;
  }
  .filter-backdrop { display: none !important; }
  .mobile-search-bar { display: none; }

  /* Hide mobile bottom nav */
  .bottomnav { display: none; }

  .search-main { flex: 1; min-width: 0; padding-bottom: 0; }

  .results-header { padding: 0 0 12px; }
  .active-chips   { padding: 0 0 8px; }
  .results-grid   { padding: 0; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .load-more-wrap { padding: 16px 0 0; }
  .result-img     { height: 150px; }
  .result-body h3 { font-size: 14px; }
  .rc-price       { font-size: 15px; }

  /* ── SAVED PAGE ── */
  .saved-grid { grid-template-columns: 1fr; gap: 14px; }
  .saved-img  { width: 140px; }
  .saved-body h3 { font-size: 15px; }
  .sc-price   { font-size: 16px; }

  /* ── PROFILE PAGE ── */
  .profile-hero   { border-radius: 20px; padding: 28px; }
  .profile-avatar { width: 84px; height: 84px; font-size: 28px; }
  .profile-meta-row { flex-direction: row; gap: 16px; }
  .profile-contact-row { flex-direction: row; gap: 20px; }

  .stats-row { grid-template-columns: repeat(5, 1fr); gap: 14px; }
  .stat-val  { font-size: 24px; }

  .profile-section { border-radius: 20px; padding: 24px; }

  .my-ad-img  { width: 110px; }
  .my-ad-title { font-size: 14px; }
  .my-ad-price { font-size: 15px; }
}

/* ════════════════════════════════════════
   LARGE DESKTOP — 1280px
   ════════════════════════════════════════ */
@media (min-width: 1280px) {
  .inner-page-wrapper,
  .search-wrapper { padding: 28px 48px 56px; gap: 32px; }
  .results-grid { grid-template-columns: repeat(4, 1fr); }
}
