/* ============================================================
   assets/css/style.css
   ============================================================
   Marketplace Platform — Design System
   Palette: deep indigo (trust) + warm amber (action/featured)
   Type: Sora (display) + Inter (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root { 
  /* Colors */
  --color-primary: #1E2A5E;       /* deep indigo - trust, headers, nav */
  --color-primary-light: #2D3D7C;
  --color-primary-dark: #131D45;
  --color-accent: #F5A623;        /* warm amber - CTAs, featured badges */
  --color-accent-light: #FFEAA7;
  --color-accent-dark: #D6890A;
  --color-bg: #F7F9FC;            /* premium light blue background */
  --color-surface: #FFFFFF;
  --color-text: #1F2433;          /* charcoal */
  --color-text-muted: #6B7280;
  --color-border: #E2E8F0;
  --color-border-light: #F0F3F7;
  --color-success: #10B981;
  --color-success-bg: #D1FAE5;
  --color-warning: #F59E0B;
  --color-warning-bg: #FEF3C7;
  --color-danger: #EF4444;
  --color-danger-bg: #FEE2E2;
  --color-info: #3B82F6;
  --color-info-bg: #DBEAFE;

  /* Type */
  --font-display: 'Space+Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing scale */
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 64px rgba(0, 0, 0, 0.15);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.35s ease;
}

/* ------------------------------------------------------------
   Reset & base
   ------------------------------------------------------------ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 15px;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.25;
}

h1 { font-size: 28px; margin-bottom: var(--space-md); }
h2 { font-size: 22px; margin-bottom: var(--space-sm); }
h3 { font-size: 18px; }
h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { color: var(--color-accent-dark); }

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

button { font-family: var(--font-body); cursor: pointer; }

/* Visible keyboard focus everywhere -- accessibility */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.text-muted { color: var(--color-text-muted); }
.text-small { font-size: 12.5px; }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  border: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-primary-dark);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--color-accent-dark); color: #fff; }

.btn-secondary {
  background: var(--color-primary);
  color: #fff;
}
.btn-secondary:hover { background: var(--color-primary-light); }

.btn-text {
  background: transparent;
  color: var(--color-primary);
  padding: 11px 14px;
}

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

.btn-block { width: 100%; }
.btn-small { padding: 8px 16px; font-size: 13px; }


/* ============================================================
   includes-header-footer.css  (FIXED)
   ============================================================
   Drop-in replacement for the Header / Footer sections of
   style.css. Same class names, same color/spacing tokens --
   only the layout rules changed. Paste this OVER the existing
   ".site-header" through ".footer-bottom" block in style.css.

   WHAT WAS WRONG BEFORE:
   1. No flex-wrap / min-width:0 on .header-container, so on
      narrow screens the logo + search bar + nav buttons were
      forced into one unbreakable row -> horizontal scrollbar
      (the "X axis" issue).
   2. .header-search had no min-width:0, so a flex child with
      text content refused to shrink below its content size,
      pushing everything else off-screen.
   3. No @media rules at all for header or footer -- nothing
      adapted for mobile.
   4. .header-nav had no wrapping/mobile-collapse behavior.

   THE FIX:
   - min-width:0 on every flex child that can hold long content
   - a real mobile hamburger toggle (.header-mobile-toggle) that
     shows under 720px and collapses .header-nav into a dropdown
   - the search bar hides under 560px (still reachable via the
     dedicated /pages/search.php page) to keep the bar usable
   - footer grid collapses to 1 column on small screens
   ============================================================ */

/* ------------------------------------------------------------
   Header / Navigation
   ------------------------------------------------------------ */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: visible;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--space-sm);
  padding: 14px var(--space-md);
  width: 100%;
  box-sizing: border-box;
}

.logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  line-height: 0;
}

/* Logo */
.logo-img {
  height: 60px;
  width: auto;
  max-width: 60px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}



/* Header gradient border bottom */
.site-header {
  background: var(--color-surface);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: visible;
}
.site-header::after {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 60%, var(--color-accent-dark) 100%);
}

/* Header gradient border bottom */
.site-header {
  background: var(--color-surface);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: visible;
}
.site-header::after {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 60%, var(--color-accent-dark) 100%);
}

.header-search {
  flex: 1 1 auto;
  min-width: 0;        /* THE FIX: allow this flex child to shrink below its content size */
  display: flex;
  max-width: 480px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.header-search input {
  flex: 1 1 auto;
  min-width: 0;         /* THE FIX: same -- text inputs ignore flex-shrink without this */
  width: 100%;
  border: none;
  padding: 10px 14px;
  font-size: 14px;
  background: var(--color-bg);
}
.header-search input:focus { outline: none; }
.header-search button {
  border: none;
  background: var(--color-bg);
  padding: 0 14px;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
  flex-shrink: 0;
}

.header-icon-link {
  position: relative;
  font-size: 18px;
  padding: 6px;
}

.badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-dropdown { position: relative; }
.header-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 6px 12px 6px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.user-avatar-small {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.header-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  overflow: hidden;
  z-index: 50;
}
.header-dropdown:hover .header-dropdown-menu,
.header-dropdown:focus-within .header-dropdown-menu { display: block; }

.header-dropdown-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--color-text);
}
.header-dropdown-menu a:hover { background: var(--color-bg); }

/* ------------------------------------------------------------
   Mobile hamburger toggle -- hidden on desktop by default
   ------------------------------------------------------------ */
.header-mobile-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  padding: 0;
  margin-left: auto;   /* THE FIX: pushes the hamburger to the far right of .header-container */
}
.header-mobile-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 0 auto;
  background: var(--color-text);
  border-radius: 2px;
}

/* ------------------------------------------------------------
   Responsive breakpoints
   ------------------------------------------------------------ */

/* Tablet: tighten spacing, keep everything in one row still */
@media (max-width: 860px) {
  .header-container { gap: var(--space-xs); padding: 12px var(--space-sm); }
  .header-search { max-width: 280px; }
}

/* Mobile: collapse nav into a hamburger-triggered dropdown panel,
   hide the inline search bar (still reachable via search page) */
@media (max-width: 720px) {
  .header-search { display: none; }

  .header-mobile-toggle { display: flex; }

  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    margin-left: 0;
    padding: var(--space-sm);
  }

  .header-nav.header-nav-open {
    display: flex;
  }

  .header-nav .btn,
  .header-nav .header-icon-link,
  .header-nav .header-dropdown {
    width: 100%;
  }

  .header-dropdown-trigger { width: 100%; justify-content: flex-start; }

  .header-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    width: 100%;
    margin-top: 4px;
  }
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.site-footer {
  background: var(--color-primary-dark);
  color: #C9CEE0;
  margin-top: var(--space-xl);
  overflow: hidden;       /* THE FIX: clip any accidental child overflow instead of scrolling the page */
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) var(--space-lg);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.4fr;
  gap: var(--space-lg);
  box-sizing: border-box;
}

.footer-col { min-width: 0; }   /* THE FIX: grid children need this to wrap long text instead of overflowing */

.footer-col h4 {
  color: #fff;
  font-size: 13px;
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-col a {
  display: block;
  color: #C9CEE0;
  font-size: 13.5px;
  margin-bottom: 8px;
  word-break: break-word;
}
.footer-col a:hover { color: var(--color-accent); }

.footer-bottom {
  text-align: center;
  padding: var(--space-md);
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12.5px;
  color: #8B92B0;
}

@media (max-width: 800px) {
  .footer-container { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .footer-container { grid-template-columns: 1fr; padding: var(--space-lg) var(--space-md); }
}




/* ------------------------------------------------------------
   Auth pages (login/register/forgot/reset)
   ------------------------------------------------------------ */
.auth-container {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.auth-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 420px;
}

.auth-subtitle {
  color: var(--color-text-muted);
  font-size: 13.5px;
  margin-bottom: var(--space-lg);
  margin-top: -8px;
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-md);
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.form-row-between {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-md);
  font-size: 13px;
}

/* ------------------------------------------------------------
   Forms (shared across auth, post-ad, checkout, etc)
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--color-surface);
  transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-group small {
  display: block;
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 4px;
}

/* ------------------------------------------------------------
   Alerts / flash messages
   ------------------------------------------------------------ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: var(--space-md);
}
.alert ul { padding-left: 18px; }

.alert-success { background: var(--color-success-bg); color: #15803D; }
.alert-error   { background: var(--color-danger-bg); color: #B91C1C; }
.alert-warning { background: var(--color-warning-bg); color: #92400E; }
.alert-info    { background: var(--color-info-bg); color: #1D4ED8; }

/* ------------------------------------------------------------
   Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-success { background: var(--color-success-bg); color: #15803D; }
.badge-warning { background: var(--color-warning-bg); color: #92400E; }
.badge-info    { background: var(--color-info-bg); color: #1D4ED8; }
.badge-danger  { background: var(--color-danger-bg); color: #B91C1C; }
.badge-default { background: #F3F4F6; color: var(--color-text-muted); }
.badge-pro     { background: var(--color-primary); color: #fff; }

/* ------------------------------------------------------------
   Dashboard layout
   ------------------------------------------------------------ */
.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-md);
}

.dashboard-sidebar {
  align-self: start;
}

.user-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  margin-bottom: var(--space-md);
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-sm);
}

.dashboard-nav {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dashboard-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px var(--space-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
.dashboard-nav a:last-child { border-bottom: none; }
.dashboard-nav a:hover { background: var(--color-bg); }
.dashboard-nav a.active {
  background: var(--color-bg);
  color: var(--color-primary);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--color-accent);
}

/* ------------------------------------------------------------
   Stats grid
   ------------------------------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md);
  text-align: center;
}

.stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary);
}

.stat-label {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

@media (max-width: 800px) {
  .dashboard-container { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------------------
   Dashboard sections (listings, conversations, orders)
   ------------------------------------------------------------ */
.dashboard-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  margin-bottom: var(--space-md);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.link-small { font-size: 13px; font-weight: 600; }

.empty-state {
  color: var(--color-text-muted);
  font-size: 13.5px;
  text-align: center;
  padding: var(--space-lg) 0;
}

.listing-row, .order-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}
.listing-row:last-child, .order-row:last-child { border-bottom: none; }

.listing-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-bg);
  flex-shrink: 0;
}

.listing-row-info, .order-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.conversation-list { display: flex; flex-direction: column; }

.conversation-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
.conversation-row:last-child { border-bottom: none; }
.conversation-row:hover { background: var(--color-bg); }

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-primary-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conversation-info { flex: 1; min-width: 0; }
.conversation-preview {
  color: var(--color-text-muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------
   Generic card grid (for listing browse pages, used later)
   ------------------------------------------------------------ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
}

.listing-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.listing-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.listing-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--color-bg);
}

.listing-card-body { padding: var(--space-sm) var(--space-md); }

.listing-card-price {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-primary);
  font-size: 16px;
}

/* ------------------------------------------------------------
   My Listings page -- status tabs, manage rows, pagination
   ------------------------------------------------------------ */
.listing-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.listing-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.listing-tab:hover { color: var(--color-primary); }
.listing-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-accent);
}

.tab-count {
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}
.listing-tab.active .tab-count {
  background: var(--color-accent);
  color: var(--color-primary-dark);
}

.listing-manage-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.listing-manage-row:last-child { border-bottom: none; }

.listing-row-badges {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.listing-row-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.text-danger { color: var(--color-danger) !important; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: var(--space-md);
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}
.page-link.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ------------------------------------------------------------
   Post Ad / generic form pages
   ------------------------------------------------------------ */
.form-page-container {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

.form-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.form-section h3 {
  margin-bottom: var(--space-md);
  font-size: 16px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.existing-images-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}
.existing-images-preview img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ------------------------------------------------------------
   Listing Detail Page
   ------------------------------------------------------------ */
.listing-detail-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

.listing-detail-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

@media (max-width: 800px) {
  .listing-detail-grid { grid-template-columns: 1fr; }
}

.listing-gallery { display: flex; flex-direction: column; gap: var(--space-sm); }

.gallery-main {
  width: 100%;
  height: 420px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}
.gallery-thumbs img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
}
.gallery-thumbs img:hover { border-color: var(--color-accent); }

.listing-info-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
}

.listing-info-panel h1 {
  font-size: 24px;
  margin: 10px 0 6px;
}

.listing-price {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.channel-stats-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-md) 0;
}

.channel-stat { display: flex; flex-direction: column; }
.channel-stat strong { font-family: var(--font-display); font-size: 17px; color: var(--color-primary); }
.channel-stat span { font-size: 11.5px; color: var(--color-text-muted); }

.listing-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: var(--space-md) 0;
}

.unlocked-contact {
  background: var(--color-success-bg);
  color: #15803D;
  text-align: center;
  padding: 11px;
  border-radius: var(--radius-md);
  font-weight: 700;
}

.seller-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-md);
  margin-top: var(--space-md);
}

.listing-description-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
}

.listing-description-section p {
  color: var(--color-text);
  line-height: 1.7;
}

/* ------------------------------------------------------------
   Verified / trust shield -- the signature element used
   wherever escrow, verification, or safety is communicated
   ------------------------------------------------------------ */
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--color-success-bg);
  color: #15803D;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
}
.trust-badge::before {
  content: "🛡";
  font-size: 12px;
}

/* ============================================================
   SUPPLEMENTAL STYLES — Admin, Chat, Payment, Channel pages
   ============================================================ */

/* ---- Admin Table ---- */
.admin-table { width:100%; border-collapse:collapse; font-size:14px; }
.admin-table th { background:#f9fafb; padding:10px 12px; text-align:left; font-weight:600; color:#374151; border-bottom:2px solid #e5e7eb; }
.admin-table td { padding:10px 12px; border-bottom:1px solid #f3f4f6; vertical-align:middle; }
.admin-table tbody tr:hover { background:#f9fafb; }
.row-disabled td { opacity:.5; }

/* ---- Admin search bar ---- */
.admin-search-bar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:20px; }
.admin-search-bar input, .admin-search-bar select { padding:8px 12px; border:1px solid #d1d5db; border-radius:6px; font-size:14px; }
.admin-search-bar input { flex:1; min-width:200px; }

/* ---- Stat card variants ---- */
.stat-card-success { border-top:3px solid #10b981; }
.stat-card-warning { border-top:3px solid #f59e0b; }
.stat-card-danger  { border-top:3px solid #ef4444; }

/* ---- Chat layout ---- */
.chat-container { display:flex; height:calc(100vh - 70px); border-top:1px solid #e5e7eb; }
.chat-sidebar { width:320px; min-width:260px; border-right:1px solid #e5e7eb; overflow-y:auto; background:#fff; flex-shrink:0; }
.chat-sidebar-item { display:flex; align-items:center; gap:10px; padding:12px 16px; border-bottom:1px solid #f3f4f6; text-decoration:none; color:inherit; transition:background .15s; }
.chat-sidebar-item:hover, .chat-sidebar-item.active { background:#eff6ff; }
.chat-sidebar-thumb { width:44px; height:44px; border-radius:6px; object-fit:cover; flex-shrink:0; }
.chat-sidebar-info { flex:1; min-width:0; }
.chat-sidebar-info strong { display:block; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-main { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.chat-header { padding:14px 20px; border-bottom:1px solid #e5e7eb; display:flex; justify-content:space-between; align-items:center; background:#fff; }
.chat-safety-notice { background:#fef9c3; color:#78350f; font-size:12px; padding:8px 20px; border-bottom:1px solid #fde68a; }
.chat-messages { flex:1; overflow-y:auto; padding:20px; display:flex; flex-direction:column; gap:8px; background:#f9fafb; }
.chat-bubble-row { display:flex; }
.chat-bubble-row.mine { justify-content:flex-end; }
.chat-bubble-row.theirs { justify-content:flex-start; }
.chat-bubble { max-width:70%; padding:10px 14px; border-radius:16px; font-size:14px; line-height:1.5; position:relative; word-break:break-word; }
.chat-bubble-row.mine .chat-bubble { background:#2563eb; color:#fff; border-bottom-right-radius:4px; }
.chat-bubble-row.theirs .chat-bubble { background:#fff; color:#111827; border:1px solid #e5e7eb; border-bottom-left-radius:4px; }
.chat-bubble-time { display:block; font-size:10px; opacity:.7; margin-top:4px; text-align:right; }
.chat-input-form { display:flex; gap:8px; padding:14px 20px; border-top:1px solid #e5e7eb; background:#fff; }
.chat-input-form input { flex:1; padding:10px 14px; border:1px solid #d1d5db; border-radius:24px; font-size:14px; outline:none; }
.chat-input-form input:focus { border-color:#2563eb; }
.chat-input-form button { padding:10px 20px; background:#2563eb; color:#fff; border:none; border-radius:24px; cursor:pointer; font-weight:600; }
.chat-empty-placeholder { flex:1; display:flex; align-items:center; justify-content:center; color:#9ca3af; }
.credential-bubble { background:#fef3c7 !important; color:#92400e !important; border:1px solid #fde68a !important; }
.credential-warning { display:block; font-size:11px; font-weight:600; margin-bottom:6px; }

/* ---- Checkout ---- */
.checkout-container { min-height:80vh; display:flex; align-items:center; justify-content:center; padding:40px 16px; }
.checkout-box { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:36px 40px; max-width:520px; width:100%; box-shadow:0 4px 24px rgba(0,0,0,.06); }
.checkout-listing-info { display:flex; gap:16px; align-items:center; padding:16px; background:#f9fafb; border-radius:8px; margin-bottom:20px; }
.checkout-thumb { width:72px; height:72px; object-fit:cover; border-radius:8px; }
.price-breakdown { width:100%; border-collapse:collapse; margin:20px 0; font-size:14px; }
.price-breakdown td { padding:8px 0; border-bottom:1px solid #f3f4f6; }
.price-breakdown td:last-child { text-align:right; }
.price-breakdown .total-row td { border-top:2px solid #e5e7eb; border-bottom:none; padding-top:12px; font-size:16px; }
.trust-note { font-size:12px; color:#6b7280; text-align:center; margin:16px 0; }
.escrow-badge-large { background:#eff6ff; color:#1d4ed8; border:1px solid #bfdbfe; border-radius:8px; padding:10px 16px; text-align:center; font-weight:600; margin-bottom:20px; }
.escrow-steps { display:flex; align-items:center; justify-content:center; gap:6px; flex-wrap:wrap; margin:16px 0; font-size:12px; }
.escrow-step { text-align:center; }
.escrow-step span { display:inline-flex; width:28px; height:28px; background:#2563eb; color:#fff; border-radius:50%; align-items:center; justify-content:center; font-weight:700; font-size:13px; margin-bottom:4px; }
.escrow-step p { color:#6b7280; margin:0; font-size:11px; }
.escrow-arrow { color:#9ca3af; font-size:18px; }

/* ---- Success page ---- */
.success-container { min-height:80vh; display:flex; align-items:center; justify-content:center; padding:40px 16px; }
.success-box { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:48px 40px; max-width:480px; width:100%; text-align:center; box-shadow:0 4px 24px rgba(0,0,0,.06); }
.success-icon { font-size:64px; margin-bottom:16px; }

/* ---- Channel cards (browse page) ---- */
.channel-listings-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:20px; }
.channel-card { display:block; background:#fff; border:1px solid #e5e7eb; border-radius:10px; text-decoration:none; color:inherit; transition:box-shadow .2s,transform .2s; overflow:hidden; }
.channel-card:hover { box-shadow:0 8px 24px rgba(0,0,0,.1); transform:translateY(-2px); }
.channel-card-header { display:flex; align-items:center; gap:8px; padding:12px 16px; background:#f9fafb; border-bottom:1px solid #f3f4f6; font-weight:600; font-size:14px; }
.platform-icon { font-size:20px; }
.channel-card-body { padding:16px; }
.channel-card-body h3 { margin:0 0 8px; font-size:15px; }
.channel-stats-row { display:flex; gap:12px; flex-wrap:wrap; font-size:12px; color:#6b7280; margin-bottom:8px; }

/* ---- Filters (sidebar) ---- */
.filter-section { margin-bottom:20px; }
.filter-section h4 { font-size:13px; font-weight:700; color:#374151; margin:0 0 8px; text-transform:uppercase; letter-spacing:.5px; }
.filter-radio { display:flex; align-items:center; gap:8px; font-size:14px; color:#374151; margin-bottom:6px; cursor:pointer; }
.filter-input { width:100%; padding:8px 10px; border:1px solid #d1d5db; border-radius:6px; font-size:14px; }
.filter-count { margin-left:auto; color:#9ca3af; font-size:12px; }
.price-range-inputs { display:flex; gap:8px; align-items:center; }
.price-range-inputs input { flex:1; padding:7px 10px; border:1px solid #d1d5db; border-radius:6px; font-size:13px; }

/* ---- Profile page ---- */
.profile-avatar-section { display:flex; align-items:center; gap:16px; margin-bottom:20px; }
.profile-avatar-preview { width:80px; height:80px; border-radius:50%; object-fit:cover; border:2px solid #e5e7eb; }
.info-table { width:100%; border-collapse:collapse; font-size:14px; }
.info-table td { padding:10px 0; border-bottom:1px solid #f3f4f6; }
.info-table td:first-child { color:#6b7280; width:150px; }

/* ---- Channel stats box ---- */
.channel-stats-box { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; background:#f9fafb; border-radius:8px; padding:16px; margin:16px 0; }
.channel-stat { text-align:center; }
.channel-stat strong { display:block; font-size:18px; font-weight:700; color:#111827; }
.channel-stat span { font-size:11px; color:#6b7280; }

/* ---- Seller card ---- */
.seller-card { display:flex; gap:12px; align-items:flex-start; padding:16px; background:#f9fafb; border-radius:8px; margin-top:20px; border:1px solid #e5e7eb; }

/* ---- Unlocked contact ---- */
.unlocked-contact { padding:12px 16px; background:#d1fae5; border:1px solid #6ee7b7; border-radius:8px; font-weight:600; color:#065f46; margin:8px 0; }

/* ---- BTN sizes ---- */
.btn-large { padding:14px 28px; font-size:16px; }

/* ---- Responsive ---- */
@media (max-width:768px) {
    .chat-sidebar { width:100%; max-height:40vh; }
    .chat-container { flex-direction:column; }
    .checkout-box { padding:24px 20px; }
    .admin-table { font-size:12px; }
    .admin-table th, .admin-table td { padding:8px 6px; }
    .channel-listings-grid { grid-template-columns:1fr; }
}
