/* =========================================================================
   SellShare — Public Marketplace Stylesheet
   Design language: emerald primary, orange accent, soft shadows, rounded
   ========================================================================= */

:root {
  /* Brand */
  --emerald:        #10B981;
  --emerald-dark:   #047857;
  --emerald-darker: #064E3B;
  --emerald-light:  #34D399;
  --emerald-bg:     #ECFDF5;
  --emerald-border: #A7F3D0;

  --orange:         #F97316;
  --orange-dark:    #C2410C;
  --orange-bg:      #FFF7ED;

  /* Neutrals */
  --bg:             #F9FAFB;
  --surface:        #FFFFFF;
  --surface-alt:    #F3F4F6;
  --border:         #E5E7EB;
  --border-strong:  #D1D5DB;
  --text:           #111827;
  --text-muted:     #6B7280;
  --text-faint:     #9CA3AF;

  /* Semantic */
  --danger:         #EF4444;
  --warning:        #F59E0B;
  --success:        var(--emerald);
  --info:           #3B82F6;

  /* Shadows */
  --shadow-xs:      0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:         0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-md:      0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-lg:      0 20px 25px -5px rgba(0,0,0,.10), 0 8px 10px -6px rgba(0,0,0,.06);
  --shadow-hover:   0 8px 24px rgba(16,185,129,.16);

  /* Radius */
  --r-sm:  6px;
  --r:     10px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-pill: 999px;

  /* Layout */
  --container:   1240px;
  --nav-h:       64px;
  --bottom-nav-h: 60px;
  --sidebar-w:   260px;
}

/* ============== DARK THEME VARIABLES ============== */
[data-theme="dark"] {
  --bg:             #07101E;
  --surface:        #0B1526;
  --surface-alt:    #101C2F;
  --border:         #1E2E42;
  --border-strong:  #2B3E56;
  --text:           #F1F5F9;
  --text-muted:     #94A3B8;
  --text-faint:     #64748B;
  --emerald-bg:     #052E1C;
  --emerald-border: #065F46;
  --orange-bg:      #431407;
  --shadow-xs:      0 1px 2px rgba(0,0,0,.35);
  --shadow-sm:      0 1px 3px rgba(0,0,0,.50), 0 1px 2px rgba(0,0,0,.35);
  --shadow:         0 4px 6px -1px rgba(0,0,0,.50), 0 2px 4px -2px rgba(0,0,0,.35);
  --shadow-md:      0 10px 15px -3px rgba(0,0,0,.55), 0 4px 6px -4px rgba(0,0,0,.40);
  --shadow-lg:      0 20px 25px -5px rgba(0,0,0,.60), 0 8px 10px -6px rgba(0,0,0,.45);
  --shadow-hover:   0 8px 24px rgba(16,185,129,.22);
  --glass-bg:       rgba(11, 21, 38, 0.93);
  --glass-border:   rgba(30, 46, 66, 0.65);
}

/* ============== RESET / BASE ============== */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--emerald-dark); text-decoration: none; }
a:hover { color: var(--emerald-darker); }

img { max-width: 100%; height: auto; display: block; }

h1,h2,h3,h4,h5 { letter-spacing: -0.02em; font-weight: 700; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ============== NAVBAR ============== */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}

.nav-container {
  max-width: var(--container);
  margin: 0 auto;
  width: 100%;
  padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800;
  font-size: 19px;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.nav-brand:hover { color: var(--text); }
.nav-brand .brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
  box-shadow: 0 4px 12px rgba(16,185,129,.3);
}

.nav-search {
  flex: 0 1 440px;
  max-width: 440px;
  position: relative;
}
.nav-search input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 44px;
  background: var(--surface-alt);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 14px;
  transition: all .2s;
}
.nav-search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
.nav-search .bi {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.nav-links {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
}
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  transition: background .15s;
}
.nav-link:hover { background: var(--surface-alt); color: var(--text); }
.nav-link.active { color: var(--emerald-dark); }
[data-theme="dark"] .nav-link { color: var(--text-muted); }
[data-theme="dark"] .nav-link:hover { color: var(--text); }
[data-theme="dark"] .nav-link.active { color: var(--emerald-light); }
.nav-link .bi { font-size: 17px; }

.nav-cta {
  background: var(--emerald);
  color: #fff !important;
  padding: 9px 18px !important;
  font-weight: 600 !important;
}
.nav-cta:hover { background: var(--emerald-dark); }

.nav-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--emerald-bg);
  color: var(--emerald-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}

.nav-icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: transparent;
  border: none;
  font-size: 18px;
  position: relative;
  transition: background .15s;
}
.nav-icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.nav-icon-btn .badge-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--orange);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.mobile-menu-btn { display: none; }

/* ── Tablet / mid-range: 769 – 1100 px ───────────────────────── */
@media (max-width: 1100px) {
  /* Sign-in and Get-started: icon only to keep the nav single-line */
  .nav-link.nav-signin .nav-signin-text { display: none; }
  .nav-link.nav-cta span               { display: none; }
  .nav-cta    { padding: 9px 12px !important; }
  .nav-signin { padding: 9px 12px !important; }
}

@media (max-width: 768px) {
  .nav-search { display: none; }
  .nav-link span:not(.badge-dot) { display: none; }
  .nav-link.nav-cta span { display: none; }
  .nav-cta { padding: 9px !important; }
  .nav-container { padding: 0 12px; gap: 8px; }
}

/* ── Guest nav: 480 px and below ─────────────────────────────── */
@media (max-width: 480px) {
  /* Sign-in and Get-started: icon only — prevents two-line text wrap */
  .nav-link.nav-signin .nav-signin-text { display: none !important; }
  .nav-link.nav-cta span              { display: none !important; }
  .nav-cta    { padding: 9px !important; }
  .nav-signin { display: inline-flex !important; padding: 9px !important; }
  /* Guest city label and separator */
  .nav-guest-loc #guestLocLabel { display: none !important; }
  .nav-sep { display: none; }
}

/* ── Guest nav: 400 px and below ─────────────────────────────── */
@media (max-width: 400px) {
  .nav-cta { font-size: 13px !important; }
}

/* ============== CONTAINER & LAYOUT ============== */
.container-x {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 480px) {
  .container-x { padding: 0 14px; }
}

.page-section { padding: 32px 0; }
.page-section + .page-section { padding-top: 0; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}
.section-header h2 {
  font-size: 22px;
  margin: 0;
}
.section-header .section-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--emerald-dark);
  display: inline-flex; align-items: center; gap: 4px;
}
.section-header .section-link:hover { gap: 8px; transition: gap .2s; }

/* ============== HERO ============== */
.hero {
  background: linear-gradient(135deg, var(--emerald-darker), var(--emerald) 80%);
  color: #fff;
  padding: 56px 0 64px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 90% 20%, rgba(249,115,22,.18) 0, transparent 35%),
                    radial-gradient(circle at 10% 80%, rgba(52,211,153,.25) 0, transparent 40%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 720px; }
.hero h1 {
  font-size: 44px;
  line-height: 1.1;
  margin: 0 0 14px;
  letter-spacing: -0.03em;
}
.hero h1 .accent { color: #FED7AA; }
.hero p {
  font-size: 17px;
  opacity: 0.9;
  margin: 0 0 28px;
  max-width: 540px;
}
.hero-search {
  display: flex;
  background: #fff;
  border-radius: var(--r-pill);
  padding: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
  max-width: 540px;
}
.hero-search input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 12px 20px;
  font-size: 15px;
  color: var(--text);
}
.hero-search input:focus { outline: none; }
.hero-search button {
  background: var(--emerald-dark);
  color: #fff;
  border: 0;
  border-radius: var(--r-pill);
  padding: 0 26px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.hero-search button:hover { background: var(--emerald-darker); }

.hero-stats {
  display: flex; gap: 32px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.hero-stat { color: rgba(255,255,255,.95); }
.hero-stat strong {
  display: block;
  font-size: 24px;
  font-weight: 800;
}
.hero-stat span { font-size: 13px; opacity: 0.85; }

@media (max-width: 640px) {
  .hero { padding: 36px 0 44px; }
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 15px; }
  .hero-search button span { display: none; }
}

/* ============== CATEGORY CHIPS ============== */
.category-strip {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  scrollbar-width: thin;
}
.category-chip {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: center;
  min-width: 100px;
  transition: all .2s;
  color: var(--text);
}
.category-chip:hover {
  border-color: var(--emerald);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  color: var(--text);
}
.category-chip .chip-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--emerald-bg);
  color: var(--emerald-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.category-chip .chip-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* Colored variants */
.category-chip:nth-child(2n) .chip-icon { background: var(--orange-bg); color: var(--orange-dark); }
.category-chip:nth-child(3n) .chip-icon { background: #DBEAFE; color: #1E40AF; }
.category-chip:nth-child(5n) .chip-icon { background: #FCE7F3; color: #9D174D; }
.category-chip:nth-child(7n) .chip-icon { background: #EDE9FE; color: #5B21B6; }

/* ============== LISTING CARDS / GRID ============== */
.listing-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
@media (min-width: 1024px) {
  .listing-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

.listing-card {
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all .2s;
  position: relative;
  display: block;
  color: var(--text);
}
.listing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--emerald-border);
  color: var(--text);
}

.listing-thumb {
  position: relative;
  aspect-ratio: 1/1;
  background: var(--surface-alt);
  overflow: hidden;
}
.listing-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.listing-card:hover .listing-thumb img { transform: scale(1.05); }

.listing-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  font-size: 40px;
}

.listing-badges {
  position: absolute; top: 10px; left: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.badge-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  backdrop-filter: blur(4px);
}
.badge-tag.donate   { background: rgba(220,38,38,.9); }
.badge-tag.service  { background: rgba(249,115,22,.9); }
.badge-tag.sell     { background: rgba(16,185,129,.9); }
.badge-tag.featured { background: rgba(245,158,11,.95); }

.listing-fav {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border: 0; border-radius: 50%;
  color: var(--text-muted);
  font-size: 17px;
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.listing-fav:hover { transform: scale(1.1); color: var(--danger); }
.listing-fav.active { color: var(--danger); }
.listing-fav.active .bi-heart::before { content: "\f415"; } /* heart-fill */

.listing-body { padding: 12px 14px 14px; }
.listing-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.listing-price {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.listing-price small { font-weight: 500; font-size: 12px; color: var(--text-muted); }
.price-free { color: var(--emerald-dark); }

.listing-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.listing-meta .bi { font-size: 12px; }
.listing-meta .dot { color: var(--text-faint); }

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--emerald);
  color: #fff;
  border-color: var(--emerald);
}
.btn-primary:hover { background: var(--emerald-dark); border-color: var(--emerald-dark); color: #fff; }

.btn-orange {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.btn-orange:hover { background: var(--orange-dark); border-color: var(--orange-dark); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover { border-color: var(--text); background: var(--surface-alt); color: var(--text); }

.btn-ghost {
  background: var(--surface-alt);
  color: var(--text);
}
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; color: #fff; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 16px; }
.btn-block { width: 100%; }

/* ============== FORMS ============== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-control, .form-select, textarea.form-control {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus, textarea.form-control:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16,185,129,.15);
}
textarea.form-control { resize: vertical; min-height: 100px; }

.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 44px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-faint);
  font-size: 17px;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.pw-toggle:hover { color: var(--text-muted); }
[data-theme="dark"] .pw-toggle { color: var(--text-faint); }
[data-theme="dark"] .pw-toggle:hover { color: var(--text-muted); }

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ============== AUTH PAGES ============== */
.auth-shell {
  min-height: calc(100vh - var(--nav-h));
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, var(--emerald-bg), var(--bg));
}
.auth-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%; max-width: 460px;
}
.auth-card h1 { font-size: 26px; margin: 0 0 4px; text-align: center; }
.auth-card .auth-sub {
  text-align: center;
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 14px;
}
.auth-footer {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 20px;
}
.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-or::before, .auth-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.social-btns { display: flex; flex-direction: column; gap: 10px; }
.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-social:hover { background: var(--surface-alt); border-color: var(--text-muted); color: var(--text); text-decoration: none; }
.btn-social svg { flex-shrink: 0; }

/* ============== PANELS / CARDS ============== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.panel-header h2, .panel-header h3 { margin: 0; font-size: 17px; }
.panel-body { padding: 22px; }

/* ============== BADGES (PILLS) ============== */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pill-sell     { background: var(--emerald-bg); color: var(--emerald-dark); }
.pill-donate   { background: #FEE2E2; color: #991B1B; }
.pill-service  { background: var(--orange-bg); color: var(--orange-dark); }
.pill-pending  { background: #FEF3C7; color: #92400E; }
.pill-active   { background: var(--emerald-bg); color: var(--emerald-dark); }
.pill-rejected { background: #FEE2E2; color: #991B1B; }
.pill-archived { background: var(--surface-alt); color: var(--text-muted); }
.pill-expired  { background: #FEF3C7; color: #92400E; }
.pill-sold     { background: #DBEAFE; color: #1E40AF; }
.pill-featured { background: #FEF3C7; color: #92400E; }

/* ============== EMPTY / SKELETON ============== */
.empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty .bi {
  font-size: 56px;
  display: block;
  margin: 0 auto 14px;
  opacity: 0.5;
}
.empty h3 { font-size: 17px; color: var(--text); margin: 0 0 6px; }
.empty p { margin: 0 0 16px; max-width: 360px; margin-inline: auto; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 0%, var(--border) 50%, var(--surface-alt) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--r);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============== TOAST ============== */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto;
  animation: toast-in .25s ease;
  max-width: 340px;
}
.toast.success { background: var(--emerald-dark); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============== LOCATION EMPTY NOTE ============== */
.loc-empty-note {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}
.loc-empty-note strong { color: var(--text); }

/* ============== MODAL ============== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: var(--vh, 100vh);
  height: 100dvh;
  background: rgba(0,0,0,.5);
  z-index: 9999;
  display: none;
  align-items: center; justify-content: center;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
  animation: fade-in .2s;
}
.modal-backdrop.show { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%; max-width: 440px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  animation: modal-in .25s ease;
  position: relative;
  overflow-y: auto;
  flex-shrink: 0;
  margin: auto;
  max-height: calc(100vh - 40px);
  max-height: calc(var(--vh, 100vh) - 40px);
  max-height: calc(100dvh - 40px);
}
.modal-close {
  position: absolute; top: 10px; right: 10px;
  background: none; border: 0; cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.modal-close:hover { color: var(--text); background: var(--surface-alt); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 480px) {
  .modal-backdrop {
    padding: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .modal-box {
    padding: 16px 14px 14px;
    border-radius: 14px;
    max-height: calc(100vh - 20px);
    max-height: calc(var(--vh, 100vh) - 20px);
    max-height: calc(100dvh - 20px);
  }
  .modal-box h3 { font-size: 15px !important; margin-bottom: 4px !important; }
  .modal-box > p { font-size: 12px !important; margin-bottom: 10px !important; }
  .modal-box .form-group { margin-bottom: 10px !important; }
  .modal-box textarea.form-control { height: 54px; min-height: 54px; }
  .modal-actions {
    flex-direction: column;
    gap: 8px;
    margin-top: 12px !important;
  }
  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============== LISTING DETAIL PAGE ============== */
.detail-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  grid-template-areas:
    "gallery sidebar"
    "content sidebar";
  gap: 24px 32px;
  margin-top: 24px;
  align-items: start;
}
.detail-gallery { grid-area: gallery; min-width: 0; }
.detail-content { grid-area: content; min-width: 0; }
.detail-side    { grid-area: sidebar; min-width: 0; position: sticky; top: 80px; }

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "gallery"
      "sidebar"
      "content";
    gap: 16px;
    margin-top: 12px;
  }
  .detail-side { position: static; }
}

.gallery {
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  width: 100%;
}
.gallery-main {
  aspect-ratio: 4/3;
  background: var(--surface-alt);
  position: relative;
}
.gallery-main img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.gallery-thumbs {
  display: flex; gap: 8px;
  padding: 10px;
  overflow-x: auto;
}
.gallery-thumb {
  flex: 0 0 70px;
  height: 70px;
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-alt);
}
.gallery-thumb.active { border-color: var(--emerald); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

.detail-side .panel + .panel { margin-top: 16px; }

.seller-card { display: flex; align-items: center; gap: 12px; }
.seller-avatar {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--emerald-bg);
  color: var(--emerald-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 20px;
}
.seller-name { font-weight: 700; font-size: 16px; margin: 0; }
.seller-rating {
  display: flex; align-items: center; gap: 4px;
  color: var(--text-muted);
  font-size: 13px;
}
.seller-rating .bi-star-fill { color: #F59E0B; }

/* ============== DASHBOARD LAYOUT ============== */
.dash-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  margin-top: 24px;
}
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar { order: 2; }
}
.dash-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  height: max-content;
  position: sticky; top: calc(var(--nav-h) + 20px);
}
.dash-sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  transition: background .15s;
}
.dash-sidebar a:hover { background: var(--surface-alt); }
.dash-sidebar a.active {
  background: var(--emerald-bg);
  color: var(--emerald-dark);
  font-weight: 600;
}
.dash-sidebar a .bi { font-size: 17px; width: 22px; text-align: center; }

/* ============== CHAT ============== */
.chat-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - var(--nav-h) - 40px);
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-top: 20px;
}
@media (max-width: 768px) {
  /* Full-bleed — break out of container-x 24px padding so chat fills the screen */
  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(var(--vh, 100vh) - var(--nav-h) - var(--bottom-nav-h));
    margin: 0 -24px;
    width: calc(100% + 48px);
    border-radius: 0;
    box-shadow: none;
    border: 0;
    border-top: 1px solid var(--border);
  }
  .chat-sidebar.hidden-mobile { display: none; }
  .chat-main.hidden-mobile    { display: none; }

  /* Tighter chrome */
  .chat-header   { padding: 10px 14px; gap: 8px; }
  .chat-messages { padding: 14px 12px; }
  .chat-form     { padding: 10px 12px; gap: 6px; }

  /* Header listing link: truncate instead of wrapping */
  .chat-header .small-muted {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }

  /* Wider bubbles on mobile */
  .chat-msg { max-width: 82%; font-size: 13.5px; }

  /* Back button: larger touch target */
  .chat-back { padding: 4px 10px 4px 0; }

  /* Sidebar: remove right-border rounding */
  .chat-sidebar { border-radius: 0; }

  /* Conversation name: don't overflow on narrow screens */
  .chat-item-name {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    max-width: 160px;
  }
}

@media (max-width: 480px) {
  /* Extra small phones — cancel the smaller container-x 14px padding */
  .chat-layout { margin: 0 -14px; width: calc(100% + 28px); }

  /* Bubbles even wider */
  .chat-msg { max-width: 88%; }

  /* Hide "View listing" button — link in the subtitle is enough */
  .chat-header > a.btn { display: none; }

  /* Prevent iOS from zooming on input focus (font-size must be ≥16px) */
  .chat-form input { font-size: 16px; }

  /* Shrink header font */
  .chat-header h4 { font-size: 14px; }
}
.chat-sidebar {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-header { padding: 18px; border-bottom: 1px solid var(--border); }
.chat-sidebar-header h3 { margin: 0; font-size: 17px; }
.chat-list { flex: 1; overflow-y: auto; }
.chat-item {
  display: flex; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  color: var(--text);
}
.chat-item:hover { background: var(--surface-alt); }
.chat-item.active { background: var(--emerald-bg); }
.chat-item-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--emerald-bg); color: var(--emerald-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; }
.chat-item-name { font-weight: 600; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 160px; }
.chat-item-time { font-size: 11px; color: var(--text-muted); }
.chat-item-preview {
  color: var(--text-muted); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.chat-item .unread-dot {
  width: 10px; height: 10px;
  background: var(--emerald);
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}

.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.chat-back { background: none; border: 0; font-size: 22px; padding: 0; cursor: pointer; color: var(--text); display: none; }
@media (max-width: 768px) { .chat-back { display: block; } }
.chat-header h4 { margin: 0; font-size: 15px; }
.chat-header .small-muted { font-size: 12px; color: var(--text-muted); }
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px;
  background: linear-gradient(to bottom, var(--bg), var(--surface));
}
.chat-msg {
  margin-bottom: 8px;
  max-width: 70%;
  padding: 9px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}
.chat-msg.sent {
  background: var(--emerald);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.chat-msg.received {
  background: var(--surface);
  border: 1px solid var(--border);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}
.chat-msg-time { font-size: 10px; opacity: 0.7; margin-top: 2px; display: block; }
.chat-form {
  display: flex; gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-form input {
  flex: 1;
  padding: 11px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.chat-form input:focus { outline: none; border-color: var(--emerald); }
.chat-form button {
  background: var(--emerald);
  color: #fff;
  border: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 17px;
}

/* ── Short viewport (landscape mobile, small windows) ───────────────────────
   At < 700 px height the layout shrinks enough that the headers get clipped.
   Compact everything so both headers are always fully visible.              */
@media (max-height: 700px) {
  /* Sidebar header */
  .chat-sidebar-header           { padding: 8px 16px; }
  .chat-sidebar-header h3        { font-size: 14px; }

  /* Conversation header */
  .chat-header                   { padding: 6px 14px; min-height: 0; }
  .chat-header h4                { font-size: 14px; }
  .chat-header .small-muted      { display: none; }          /* drop listing subtitle */
  .chat-header > a.btn           { display: none; }          /* drop View listing button */
  .chat-header .seller-avatar    { width: 32px !important; height: 32px !important; font-size: 12px !important; }

  /* Messages & form */
  .chat-messages { padding: 10px 12px; }
  .chat-msg      { margin-bottom: 5px; padding: 7px 12px; font-size: 13px; }
  .chat-form     { padding: 7px 12px; }
}

/* ============== MOBILE BOTTOM NAV ============== */
.bottom-nav { display: none; }

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 90;
    box-shadow: 0 -2px 12px rgba(0,0,0,.04);
  }
  .bottom-nav a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
  }
  .bottom-nav a.active { color: var(--emerald-dark); }
  .bottom-nav a .bi { font-size: 20px; }
  .bottom-nav a.cta .bi {
    background: var(--emerald);
    color: #fff;
    width: 44px; height: 44px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    margin-top: -14px;
    box-shadow: 0 4px 12px rgba(16,185,129,.4);
  }
  body { padding-bottom: var(--bottom-nav-h); }
}

/* ============== FOOTER ============== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 40px 0 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
.footer-col h5 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 14px; color: var(--text); }
.footer-col a { display: block; color: var(--text-muted); font-size: 14px; padding: 4px 0; }
.footer-col a:hover { color: var(--emerald-dark); }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 10px; }
.footer-brand .brand-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}

/* ============== FILTER SIDEBAR ============== */
.browse-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  margin-top: 24px;
}
@media (max-width: 900px) {
  .browse-layout { grid-template-columns: 1fr; }
  .filters-sidebar { order: 2; }
}
.filters-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  height: max-content;
  position: sticky; top: calc(var(--nav-h) + 20px);
}
.filters-sidebar h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); margin: 18px 0 8px; }
.filters-sidebar h4:first-child { margin-top: 0; }
.filters-sidebar label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px;
  padding: 5px 0;
  cursor: pointer;
}
.filters-sidebar label input { accent-color: var(--emerald); }

/* ============== UTILITIES ============== */
.text-muted { color: var(--text-muted); }
.text-strong { color: var(--text); font-weight: 600; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.text-center { text-align: center; }

.divider { height: 1px; background: var(--border); border: 0; margin: 16px 0; }

.flashes { padding: 14px 0; }
.flash {
  padding: 12px 18px;
  border-radius: var(--r);
  background: var(--surface);
  border-left: 4px solid var(--info);
  box-shadow: var(--shadow-xs);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.flash.success { border-color: var(--success); }
.flash.error,
.flash.danger  { border-color: var(--danger); }
.flash.warning { border-color: var(--warning); }

/* ============== PAGINATION ============== */
.pagination {
  display: flex; justify-content: center;
  gap: 4px;
  margin-top: 32px;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
}
.pagination a:hover { background: var(--surface-alt); }
.pagination .current { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.pagination .disabled { color: var(--text-faint); pointer-events: none; }

/* ── Custom file input ───────────────────────────────────────────── */
.file-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.file-input-wrap .file-choose-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface-alt);
  color: var(--text);
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.file-input-wrap .file-choose-btn:hover {
  border-color: var(--text);
  background: var(--surface-hover, var(--border));
}
.file-input-wrap .file-name-display {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.file-input-wrap input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
