/* 
  BD Business Market - Professional B2B Design System v3.0
  Inspired by Alibaba / Amazon B2B professional light mode
  Color Palette:
  - Light Grey Base: #f4f4f4
  - Pure White: #ffffff
  - Emerald Green: #10b981 (trust / Bangladesh)
  - Rich Gold: #d4af37 (quality / escrow)
*/

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

:root {
  /* Core Colors */
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8fafc;
  --accent-emerald: #10b981;
  --accent-emerald-dark: #059669;
  --accent-emerald-light: rgba(16, 185, 129, 0.1);
  --accent-gold: #d4af37;
  --accent-gold-light: rgba(212, 175, 55, 0.1);
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --text-main: #1a1a2e;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-light: #a0aec0;
  --glass: rgba(255, 255, 255, 0.85);
  --glass-border: #e2e8f0;
  --glass-border-strong: #cbd5e0;
  --shadow-s: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-m: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-l: 0 10px 30px rgba(0,0,0,0.1);
  --shadow-xl: 0 25px 60px rgba(0,0,0,0.15);

  /* Typography Scale (1.25x) */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;
  --text-6xl: 4.5rem;

  /* Spacing (8px base) */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */
  --space-32: 8rem;     /* 128px */

  --font-family: 'Outfit', sans-serif;
  --container-max: 1320px;
  --radius-xl: 32px;
  --radius-l: 24px;
  --radius-m: 16px;
  --radius-s: 12px;
  --radius-xs: 8px;
  --radius-full: 9999px;
}

/* ========== BASE RESET ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  line-height: 1.6;
  overflow-x: hidden;
  font-size: var(--text-base);
}

/* ========== CUSTOM SCROLLBAR ========== */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--glass-border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-emerald); }

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-main);
}
h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }

a { text-decoration: none; color: inherit; }
p { line-height: 1.7; }

.gradient-text {
  background: linear-gradient(135deg, var(--accent-emerald) 0%, #06b6d4 50%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* ========== LAYOUT ========== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

.section-padding { padding: var(--space-24) 0; }

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
}

/* ========== GLASS CARD ========== */
.glass-card {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-m);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-s);
}

.glass-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-3px);
  box-shadow: var(--shadow-l);
}

.glass-card i {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.glass-card:hover i {
  transform: scale(1.1);
}

/* ========== BUTTONS ========== */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-emerald), var(--accent-emerald-dark));
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-s);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
  font-family: var(--font-family);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #12d496, var(--accent-emerald));
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--glass-border);
  padding: 11px 26px;
  border-radius: var(--radius-s);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-family: var(--font-family);
}

.btn-secondary:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  background: var(--accent-emerald-light);
}

.btn-gold {
  background: linear-gradient(135deg, var(--accent-gold), #b48514);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-s);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-family);
}

/* ========== FORM ELEMENTS ========== */
.search-bar {
  width: 100%;
  background: var(--bg-secondary);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-s);
  padding: 14px 20px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: all 0.2s ease;
  outline: none;
}

.search-bar:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.search-bar::placeholder { color: var(--text-light); }

.form-group { margin-bottom: var(--space-6); }

label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
}

select.search-bar {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 16px;
  padding-right: var(--space-12);
}

textarea.search-bar {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* ========== BADGE & PILL UTILITIES ========== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-emerald);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  line-height: 1;
}
.badge-gold { background: var(--accent-gold); }
.badge-red { background: var(--accent-red); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--glass-border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
}
.chip:hover, .chip.active {
  background: var(--accent-emerald-light);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}
.chip.active { font-weight: 700; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pill-green {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
}
.pill-gold {
  background: var(--accent-gold-light);
  color: var(--accent-gold);
}
.pill-red {
  background: rgba(239,68,68,0.1);
  color: var(--accent-red);
}
.pill-blue {
  background: rgba(59,130,246,0.1);
  color: var(--accent-blue);
}

/* ========== STEP PROGRESS BAR ========== */
.step-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-8);
}
.step-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}
.step-bar-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--glass-border);
  z-index: 0;
  transition: background 0.3s;
}
.step-bar-item.done:not(:last-child)::after {
  background: var(--accent-emerald);
}
.step-bar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: all 0.3s;
}
.step-bar-item.active .step-bar-circle {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald);
  color: white;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}
.step-bar-item.done .step-bar-circle {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald);
  color: white;
}
.step-bar-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}
.step-bar-item.active .step-bar-label {
  color: var(--accent-emerald);
}

/* ========== SIDEBAR NAV ========== */
.sidebar-btn {
  width: 100%;
  text-align: left;
  padding: 11px 16px;
  margin-bottom: var(--space-1);
  border-radius: var(--radius-s);
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: var(--text-sm);
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  font-family: var(--font-family);
}
.sidebar-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent-emerald);
}
.sidebar-btn.active {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald) !important;
  border-left-color: var(--accent-emerald);
  font-weight: 700;
}
.role-seller .sidebar-btn.active {
  background: var(--accent-gold-light);
  color: var(--accent-gold) !important;
  border-left-color: var(--accent-gold);
}
/* Nav badge — unread count pill on sidebar items */
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent-emerald);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

/* ========== SKELETON LOADERS ========== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-xs);
  color: transparent !important;
}
.skeleton * { opacity: 0; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ========== ANIMATIONS ========== */
.reveal {
  animation: revealIn 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes revealIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== TOAST NOTIFICATIONS ========== */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.toast {
  background: #1e293b;
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 280px;
  max-width: 400px;
  font-size: var(--text-sm);
  border-left: 4px solid var(--accent-emerald);
  font-weight: 500;
}
.toast.toast-error { border-left-color: var(--accent-red); }
.toast.toast-warning { border-left-color: var(--accent-gold); }
.toast.toast-info { border-left-color: var(--accent-blue); }
.toast.hiding { animation: fadeOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

@keyframes slideInRight { from { opacity: 0; transform: translateX(80px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(80px); } }

/* ========== SEARCH DROPDOWN ========== */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-m);
  z-index: 1000;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: slideDown 0.2s ease-out;
}
.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
  cursor: pointer;
  transition: background 0.15s;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-result-item:hover { background: var(--bg-tertiary); }
.search-result-item:last-child { border-bottom: none; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ========== DASHBOARD LAYOUT ========== */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  min-height: 80vh;
}

.stat-card {
  padding: var(--space-6);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-gold));
}
.stat-val {
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--accent-emerald);
  line-height: 1;
}

/* ========== UTILITIES ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-emerald); }
.text-gold { color: var(--accent-gold); }
.text-red { color: var(--accent-red); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }

.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }

.sticky { position: sticky; }
.block { display: block; }

.rounded-full { border-radius: var(--radius-full); }
.overflow-hidden { overflow: hidden; }

/* ========== LOADER ========== */
.loader {
  width: 20px;
  height: 20px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent-emerald);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ========== SIDEBAR NAVIGATION ========== */
#mainNavigation {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-l);
  height: fit-content;
  position: sticky;
  top: 90px;
  box-shadow: var(--shadow-s);
}

/* ========== FOOTER ========== */

/* Desktop 4-column grid */
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 52px;
}

/* Section toggle styled as an h4 label on desktop (no click affordance) */
.footer-section-toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 18px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 700;
  font-family: var(--font-family);
  cursor: default;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Chevron hidden on desktop */
.footer-chevron { display: none; }

/* Links column */
.footer-section-body { /* always visible on desktop */ }
.footer-links-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-link {
  color: var(--text-muted);
  font-size: 0.87rem;
  text-decoration: none;
  transition: color 0.2s;
  display: block;
}
.footer-link:hover { color: var(--accent-emerald); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--glass-border);
  flex-wrap: wrap;
  gap: 12px;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
  :root {
    --text-5xl: 2.5rem;
    --text-4xl: 2rem;
    --text-3xl: 1.6rem;
  }

  .container { padding: 0 16px; }

  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.8rem; }

  .dashboard-layout {
    display: block;
    padding-bottom: 90px;
  }

  aside#mainNavigation {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    border-radius: 0 !important;
    height: 68px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border-top: 1px solid var(--glass-border) !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: center !important;
    padding: 0 8px !important;
    z-index: 9999 !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08) !important;
    gap: 0 !important;
    backdrop-filter: blur(16px) !important;
  }

  aside#mainNavigation .sidebar-btn {
    flex: 1 !important;
    flex-direction: column !important;
    gap: 3px !important;
    padding: 8px 4px !important;
    font-size: 0.55rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-muted) !important;
    margin: 0 !important;
    min-width: 0 !important;
    height: 100% !important;
    justify-content: center !important;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  aside#mainNavigation .sidebar-btn i {
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
  }

  aside#mainNavigation .sidebar-btn.active {
    color: var(--accent-emerald) !important;
    background: transparent !important;
    border: none !important;
  }

  .mobile-hide { display: none !important; }

  .btn-primary, .search-bar { height: 52px !important; font-size: 1rem !important; }

  .glass-card { padding: 20px !important; }

  .bento-grid { grid-template-columns: 1fr !important; }

  .milestone-track {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding-left: 50px !important;
    gap: 40px !important;
  }
  .milestone-track::before {
    left: 31px !important; width: 4px !important; height: 100% !important; top: 0 !important;
  }
  .milestone-step {
    flex-direction: row !important; gap: 20px !important; width: 100% !important;
  }
  .step-label { position: static !important; text-align: left !important; white-space: normal !important; }

  .step-bar-label { display: none; }

  .checkout-grid { grid-template-columns: 1fr !important; }
  .inbox-layout { grid-template-columns: 1fr !important; }
}

/* ========== PROFILE STYLES ========== */
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04), #ffffff);
  padding: var(--space-6);
  border-radius: var(--radius-l);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-s);
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--accent-emerald);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.view-content { animation: fadeIn 0.35s ease-out; }

/* ========== SECTION DIVIDER ========== */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
  margin: var(--space-12) 0;
}

/* ========== TRUST BADGES ========== */
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1.5px solid;
}
.trust-badge.emerald {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}
.trust-badge.gold {
  background: var(--accent-gold-light);
  color: var(--accent-gold);
  border-color: rgba(212, 175, 55, 0.3);
}
.trust-badge.blue {
  background: rgba(59,130,246,0.08);
  color: var(--accent-blue);
  border-color: rgba(59,130,246,0.3);
}

/* ========== EMPTY STATE ========== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-20) var(--space-8);
  text-align: center;
  color: var(--text-muted);
  gap: var(--space-4);
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--glass-border);
}

/* ========== PROFESSIONAL FORM ELEMENTS ========== */
.input-group {
  position: relative;
}
.input-group .input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 18px;
}
.input-group .search-bar {
  padding-left: 46px;
}

/* ========== NAV ACTIVE STATE ========== */
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: color 0.2s;
  position: relative;
  padding-bottom: 2px;
}
.nav-link:hover { color: var(--accent-emerald); }
.nav-link.active {
  color: var(--accent-emerald);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent-emerald);
  border-radius: 2px;
}

/* Mobile dropdown nav is hidden by default on desktop; only shown inside the
   mobile media query below (and when toggled via the .open class). */
#mobileNavPanel { display: none; }

/* User profile dropdown menu items (rendered by updateUserUI in app.js). */
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.15s;
}
.user-menu-item:hover {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
}
/* Log Out item keeps its red accent on hover too. */
.user-menu-item[style*="--accent-red"]:hover {
  background: #fef2f2;
  color: var(--accent-red);
}

/* ==========================================================================
   MOBILE BOTTOM TAB BAR
   --------------------------------------------------------------------------
   A 5-tab persistent bottom navigation (Home, Market, Cart, Messages,
   Account) that turns the site into an app-like experience on phones.
   Hidden on desktop; slides away on scroll-down, reappears on scroll-up.
   ========================================================================== */

/* Hidden on desktop by default */
#mobileTabBar { display: none; }

@media (max-width: 768px) {
  #mobileTabBar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    height: 64px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.06);
    justify-content: space-around;
    align-items: stretch;
    padding: 0;
    /* Safe-area for notched phones (iPhone X+) */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }

  /* Slide out of view when user scrolls down */
  #mobileTabBar.tab-hidden {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
  }

  /* ── Individual tab item ──────────────────────────────────────────── */
  #mobileTabBar .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 6px 0 4px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
  }

  #mobileTabBar .tab-item:active {
    background: rgba(16, 185, 129, 0.06);
  }

  /* Icon sizing */
  #mobileTabBar .tab-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
  }

  #mobileTabBar .tab-icon-wrap i,
  #mobileTabBar .tab-icon-wrap svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
  }

  #mobileTabBar .tab-label {
    line-height: 1;
    white-space: nowrap;
  }

  /* ── Active tab ───────────────────────────────────────────────────── */
  #mobileTabBar .tab-item.active {
    color: var(--accent-emerald);
  }

  #mobileTabBar .tab-item.active .tab-icon-wrap i,
  #mobileTabBar .tab-item.active .tab-icon-wrap svg {
    stroke-width: 2.2;
  }

  /* Pill highlight behind the active icon */
  #mobileTabBar .tab-item.active .tab-icon-wrap::before {
    content: '';
    position: absolute;
    inset: -2px -10px;
    background: var(--accent-emerald-light);
    border-radius: 99px;
    z-index: -1;
  }

  /* ── Badge (unread / cart count) ──────────────────────────────────── */
  #mobileTabBar .tab-badge {
    position: absolute;
    top: -2px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 800;
    border-radius: 99px;
    border: 2px solid #fff;
    line-height: 1;
    z-index: 1;
  }

  /* ── Body clearance so content isn't hidden behind the bar ────────── */
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ==========================================================================
   MOBILE RESPONSIVE OVERRIDES (applies to phones ≤ 768px)
   --------------------------------------------------------------------------
   Most pages use INLINE grid-template-columns / flex styles, so we target
   those patterns with attribute selectors + !important to stack them on
   narrow screens without touching every HTML file.
   ========================================================================== */
@media (max-width: 768px) {

  /* ── Container padding shrinks ─────────────────────────────────────── */
  .container { padding: 0 14px !important; }

  /* ── Typography scaled down ────────────────────────────────────────── */
  h1 { font-size: 1.9rem !important; line-height: 1.2 !important; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.15rem !important; }

  /* ── Any h1/h2/h3 with an inline giant font-size collapses ─────────── */
  h1[style*="3.8rem"],
  h1[style*="3.5rem"],
  h1[style*="3rem"],
  h1[style*="2.8rem"],
  h1[style*="2.5rem"],
  h1[style*="2.2rem"] { font-size: 1.9rem !important; line-height: 1.2 !important; max-width: 100% !important; }

  h2[style*="2.8rem"],
  h2[style*="2.5rem"],
  h2[style*="2.2rem"],
  h2[style*="2rem"]   { font-size: 1.5rem !important; }

  /* ── Collapse any 2-col / 3-col / 4-col inline grid to 1 col ───────── */
  [style*="grid-template-columns: 1fr 1fr"]:not(.keep-cols),
  [style*="grid-template-columns:1fr 1fr"]:not(.keep-cols),
  [style*="grid-template-columns: 2fr 1fr 1fr 1fr"],
  [style*="grid-template-columns:2fr 1fr 1fr 1fr"],
  [style*="grid-template-columns: 280px 1fr"],
  [style*="grid-template-columns:280px 1fr"],
  [style*="grid-template-columns: 320px 1fr"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* Live-stats strip (4 equal cells) — collapse to 2x2 */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(4, 1fr)"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* ── Any inline flex row with big gap should stack on mobile ───────── */
  [style*="display: flex"][style*="gap: 60px"],
  [style*="display:flex"][style*="gap:60px"],
  [style*="display: flex"][style*="gap: 48px"],
  [style*="display: flex"][style*="gap: 40px"] {
    flex-direction: column !important;
    gap: 24px !important;
    align-items: stretch !important;
  }

  /* Hero search bar + button row — stack */
  [style*="display:flex"][style*="max-width:620px"],
  [style*="display: flex"][style*="max-width: 620px"] {
    flex-direction: column !important;
  }

  /* ── Oversized padding gets trimmed ────────────────────────────────── */
  [style*="padding: 60px"] { padding: 28px !important; }
  [style*="padding: 80px 0"] { padding: 40px 0 !important; }
  [style*="padding: 100px 0"] { padding: 50px 0 !important; }
  [style*="padding: 40px"]:not(.keep-pad) { padding: 20px !important; }

  /* ── Cards and glass-cards shrink padding on mobile ────────────────── */
  .glass-card[style*="padding: 60px"] { padding: 28px !important; }
  .glass-card[style*="padding: 40px"] { padding: 24px !important; }

  /* ── Images / embedded media never overflow ────────────────────────── */
  img, video, iframe { max-width: 100% !important; height: auto !important; }

  /* ── Forms and inputs get comfortable touch height ─────────────────── */
  input, select, textarea, .search-bar {
    font-size: 16px !important; /* prevents iOS zoom on focus */
  }

  /* ── Onboarding / auth cards — full width, lose huge padding ───────── */
  .onboarding-card,
  .verify-card,
  .auth-card {
    margin: 20px auto !important;
    padding: 24px !important;
    max-width: 100% !important;
    border-radius: 18px !important;
  }

  /* ── Upload zones on KYC page shrink ───────────────────────────────── */
  .upload-zone { padding: 24px 14px !important; }

  /* ── Site header: hide the inline desktop nav links block ──────────── */
  /* The renderHeader() inline nav is a flex row with 5 text links that
     overflow on phones. Hide those; the hamburger menu (rendered only on
     mobile) exposes them via a drop-down. */
  #site-header #navLinks { display: none !important; }

  /* On mobile the hamburger dropdown is the source of truth for all
     per-user actions. Hide the desktop icon trio (Messages/Cart/My Orders)
     and the right-side auth widgets so the top bar stays uncluttered. */
  #site-header a[title="Messages"],
  #site-header a[title="My Cart"],
  #site-header a[title="My Orders"] { display: none !important; }
  #site-header #userSection { display: none !important; }

  /* Show the hamburger (added by renderHeader when present) */
  #site-header #mobileMenuBtn { display: inline-flex !important; }

  /* Logo shrinks */
  #site-header [onclick*="index.html"] { font-size: 0.95rem !important; }
  #site-header [onclick*="index.html"] i { width: 20px !important; height: 20px !important; }

  /* ── Mobile nav drawer (slide-in from left) ─────────────────────── */
  #mobileNavPanel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 84%;
    max-width: 320px;
    background: #fff;
    z-index: 10002;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.12);
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important; /* always in DOM, positioned offscreen */
    visibility: hidden;
  }
  #mobileNavPanel.open {
    transform: translateX(0);
    visibility: visible;
  }

  /* Drawer header (logo + close button) */
  #mobileNavPanel .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
  }
  #mobileNavPanel .drawer-close {
    background: none;
    border: 1.5px solid var(--glass-border);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
    flex-shrink: 0;
  }
  #mobileNavPanel .drawer-close:active {
    border-color: var(--accent-red);
    color: var(--accent-red);
  }

  /* Drawer nav links */
  #mobileNavPanel .drawer-links {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    gap: 2px;
    flex: 1;
  }
  #mobileNavPanel .drawer-links a {
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
    text-decoration: none;
  }
  #mobileNavPanel .drawer-links a:active,
  #mobileNavPanel .drawer-links a.active {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
  }

  /* Drawer footer (auth section) */
  #mobileNavPanel .drawer-footer {
    border-top: 1px solid var(--glass-border);
    padding: 14px 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  #mobileNavPanel .drawer-footer a,
  #mobileNavPanel .drawer-footer button {
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
    text-decoration: none;
    font-family: var(--font-family);
  }
  #mobileNavPanel .drawer-footer a:active {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
  }
  /* Start Free CTA button in drawer */
  #mobileNavPanel .drawer-cta {
    background: var(--accent-emerald) !important;
    color: #fff !important;
    justify-content: center;
    font-weight: 700;
    border-radius: 12px;
    margin-top: 4px;
    border: none;
    cursor: pointer;
  }

  /* ── Drawer backdrop ──────────────────────────────────────────────── */
  #navBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  #navBackdrop.show {
    display: block;
    opacity: 1;
  }

  /* ── Trust badges wrap nicely ──────────────────────────────────────── */
  [style*="display:flex"][style*="justify-content:center"][style*="gap:10px"] {
    gap: 6px !important;
  }

  /* ── Filter sidebar on marketplace: lose sticky, full-width ────────── */
  aside.glass-card[style*="sticky"] {
    position: static !important;
    margin-bottom: 16px;
  }

  /* ── Admin panel nav buttons scroll horizontally ───────────────────── */
  .admin-nav, .admin-sidebar { overflow-x: auto !important; }

  /* ── Tables get a horizontal scroll wrapper ────────────────────────── */
  table { display: block; overflow-x: auto; white-space: nowrap; }

  /* ── Footer accordion (mobile) ──────────────────────────────────────── */
  #site-footer { padding: 40px 0 28px !important; }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    margin-bottom: 8px !important;
  }

  .footer-brand {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0;
  }

  .footer-section {
    border-bottom: 1px solid var(--glass-border);
  }

  /* Toggle becomes a real interactive button on mobile */
  .footer-section-toggle {
    pointer-events: auto;
    cursor: pointer;
    padding: 16px 2px;
    margin: 0;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.8px;
  }
  .footer-section-toggle:active { opacity: 0.7; }

  /* Show chevron on mobile */
  .footer-chevron {
    display: block;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
  }
  .footer-section.open .footer-chevron {
    transform: rotate(180deg);
  }

  /* Smooth height animation via grid-template-rows trick */
  .footer-section-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
    overflow: hidden;
  }
  .footer-links-inner {
    min-height: 0;
    overflow: hidden;
    padding: 0 2px;
  }
  .footer-section.open .footer-section-body {
    grid-template-rows: 1fr;
  }
  .footer-section.open .footer-links-inner {
    padding-bottom: 16px;
  }

  .footer-bottom {
    padding-top: 20px;
    margin-top: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* ── Modals fill screen ────────────────────────────────────────────── */
  .modal, .glass-card[style*="max-width: 500px"], .glass-card[style*="max-width: 540px"] {
    max-width: 94vw !important;
    width: 94vw !important;
  }

  /* ── Reduce button padding so CTAs fit comfortably ─────────────────── */
  .btn-primary, .btn-secondary, .btn-gold {
    padding: 11px 18px !important;
    font-size: 0.78rem !important;
  }

  /* ── Section padding trim for home hero ────────────────────────────── */
  main > section.container:first-child { padding: 30px 0 40px !important; }
}

/* ==========================================================================
   EXTRA-SMALL PHONES (≤ 420px) — iPhone SE, older Android budgets
   ========================================================================== */
@media (max-width: 420px) {
  h1 { font-size: 1.6rem !important; }
  h1[style*="rem"] { font-size: 1.6rem !important; }
  .container { padding: 0 12px !important; }
  .glass-card { padding: 16px !important; }

  /* Stats strip: 1 col on tiny phones */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: 1fr 1fr !important;
  }
}
