/* ============================================================
   Forumly - Premium UI Design System
   Glassmorphism + SaaS Dashboard + Mobile-First
   ============================================================ */

/* ── Reset & Root Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --primary:       #7C3AED;
  --primary-light: #A855F7;
  --primary-dark:  #5B21B6;
  --accent:        #F59E0B;
  --accent-light:  #FCD34D;
  --success:       #10B981;
  --danger:        #EF4444;
  --warning:       #F97316;
  --info:          #3B82F6;

  /* Gradient */
  --grad-primary:  linear-gradient(135deg, #7C3AED 0%, #A855F7 50%, #EC4899 100%);
  --grad-accent:   linear-gradient(135deg, #F59E0B, #EF4444);
  --grad-success:  linear-gradient(135deg, #10B981, #059669);
  --grad-dark:     linear-gradient(135deg, #1a1a2e, #16213e);

  /* Light mode */
  --bg:            #F8F7FF;
  --bg-card:       rgba(255,255,255,0.75);
  --bg-glass:      rgba(255,255,255,0.6);
  --bg-input:      rgba(255,255,255,0.9);
  --border:        rgba(124,58,237,0.12);
  --border-glass:  rgba(255,255,255,0.3);
  --text:          #1A1A2E;
  --text-muted:    #6B7280;
  --text-light:    #9CA3AF;
  --shadow:        0 4px 24px rgba(124,58,237,0.08);
  --shadow-lg:     0 8px 48px rgba(124,58,237,0.15);
  --shadow-card:   0 2px 16px rgba(0,0,0,0.06);

  /* Blur */
  --blur:          blur(20px);
  --blur-sm:       blur(10px);

  /* Typography */
  --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --radius:        16px;
  --radius-sm:     10px;
  --radius-lg:     24px;
  --radius-full:   9999px;

  /* Transitions */
  --transition:    all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-lg: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* Nav */
  --nav-height:    64px;
  --sidebar-width: 260px;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg:           #0F0E1A;
  --bg-card:      rgba(255,255,255,0.05);
  --bg-glass:     rgba(255,255,255,0.04);
  --bg-input:     rgba(255,255,255,0.08);
  --border:       rgba(255,255,255,0.1);
  --border-glass: rgba(255,255,255,0.08);
  --text:         #E8E8FF;
  --text-muted:   #9CA3AF;
  --text-light:   #6B7280;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.6);
  --shadow-card:  0 2px 16px rgba(0,0,0,0.3);
}

/* ── Base ── */
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-light); }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: var(--font-sans); }

::selection { background: rgba(124,58,237,0.2); color: var(--primary); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Background Gradient ── */
.bg-gradient-page {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--bg);
}
.bg-gradient-page::before {
  content: '';
  position: absolute;
  width: 60vw; height: 60vw; max-width: 800px; max-height: 800px;
  top: -20%; right: -20%;
  background: radial-gradient(ellipse, rgba(124,58,237,0.12) 0%, transparent 70%);
  border-radius: 50%;
}
.bg-gradient-page::after {
  content: '';
  position: absolute;
  width: 50vw; height: 50vw; max-width: 600px; max-height: 600px;
  bottom: -10%; left: -15%;
  background: radial-gradient(ellipse, rgba(168,85,247,0.08) 0%, transparent 70%);
  border-radius: 50%;
}

/* ── Glass Card ── */
.glass {
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* ── Navigation ── */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  height: var(--nav-height);
  background: var(--bg-glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 800; color: var(--text);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.nav-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--grad-primary);
  border-radius: 10px;
  display: grid; place-items: center;
  color: white; font-size: 18px;
}
.nav-brand span { background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.nav-search {
  flex: 1; max-width: 320px; margin: 0 auto;
  position: relative;
}
.nav-search input {
  width: 100%;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 40px 0 44px;
  font-size: 14px; color: var(--text);
  transition: var(--transition);
}
.nav-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.nav-search input::placeholder { color: var(--text-muted); }
.nav-search .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 16px; pointer-events: none;
}

.nav-actions {
  display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0;
}

.nav-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 18px;
  transition: var(--transition);
  position: relative;
}
.nav-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

.nav-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

/* Avatar size system */
.avatar     { width: 40px;  height: 40px;  border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-xs  { width: 28px;  height: 28px;  border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-sm  { width: 36px;  height: 36px;  border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-md  { width: 48px;  height: 48px;  border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-lg  { width: 64px;  height: 64px;  border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-xl  { width: 80px;  height: 80px;  border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.nav-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  cursor: pointer;
  transition: var(--transition);
}
.nav-avatar:hover { transform: scale(1.05); border-color: var(--primary-light); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 200px;
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 100;
  opacity: 0; pointer-events: none;
  transform: translateY(-8px);
  transition: var(--transition);
}
.dropdown.active .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1; pointer-events: all; transform: translateY(0);
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text);
  transition: var(--transition);
  cursor: pointer;
}
.dropdown-item:hover { background: rgba(124,58,237,0.08); color: var(--primary); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr 280px;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - var(--nav-height));
  align-items: start;
}
.layout.no-sidebar { grid-template-columns: var(--sidebar-width) 1fr; }
.layout.full-width  { grid-template-columns: 1fr; max-width: 1200px; }

/* ── Sidebar ── */
.sidebar {
  position: sticky; top: calc(var(--nav-height) + 16px);
  display: flex; flex-direction: column; gap: 8px;
}

.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sidebar-title {
  padding: 14px 16px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  font-size: 14px; color: var(--text);
  transition: var(--transition);
  border-radius: 0;
}
.sidebar-link:hover { background: rgba(124,58,237,0.06); color: var(--primary); }
.sidebar-link.active { background: rgba(124,58,237,0.1); color: var(--primary); font-weight: 600; }
.sidebar-link .icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-link .count {
  margin-left: auto; font-size: 11px;
  background: rgba(124,58,237,0.12); color: var(--primary);
  padding: 2px 7px; border-radius: var(--radius-full); font-weight: 600;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600; line-height: 1;
  border: none; cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(124,58,237,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(124,58,237,0.4); color: white; }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-ghost {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-ghost:hover { background: var(--primary); color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; margin-bottom: 8px;
  font-size: 14px; font-weight: 600; color: var(--text);
}
.form-label span { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text);
  font-family: var(--font-sans);
  transition: var(--transition);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.1);
  background: var(--bg-card);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M6 8L0 0h12z' fill='%236b7280'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }

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

/* Checkbox / Radio */
.form-check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--primary); cursor: pointer;
}

/* ── Thread / Post Cards ── */
.thread-card {
  display: flex; gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.thread-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--grad-primary);
  opacity: 0; transition: var(--transition);
  border-radius: 0 2px 2px 0;
}
.thread-card:hover { border-color: rgba(124,58,237,0.25); box-shadow: var(--shadow); }
.thread-card:hover::before { opacity: 1; }

.thread-vote {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.vote-btn {
  width: 32px; height: 32px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 14px; color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.vote-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.vote-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.vote-count { font-size: 13px; font-weight: 700; color: var(--text); }

.thread-body { flex: 1; min-width: 0; }
.thread-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 8px; font-size: 12px; color: var(--text-muted);
}
.thread-category-tag {
  background: rgba(124,58,237,0.1); color: var(--primary);
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.thread-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  line-height: 1.4; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thread-title:hover { color: var(--primary); }
.thread-excerpt {
  font-size: 14px; color: var(--text-muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thread-footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  margin-top: 14px; font-size: 13px; color: var(--text-muted);
}
.thread-stat { display: flex; align-items: center; gap: 5px; }
.thread-author {
  display: flex; align-items: center; gap: 8px;
}
.thread-author img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.thread-author-name { font-weight: 600; color: var(--text); font-size: 13px; }

/* ── Profile Mini Card ── */
.user-mini {
  display: flex; align-items: center; gap: 10px;
}
.user-mini img {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border);
}
.user-mini-info { min-width: 0; }
.user-mini-name { font-size: 14px; font-weight: 700; color: var(--text); }
.user-mini-meta { font-size: 12px; color: var(--text-muted); }

/* ── Category Cards ── */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.category-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.category-card::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--category-color, var(--primary));
  opacity: 0.04;
  transition: var(--transition);
}
.category-card:hover::after { opacity: 0.08; }
.category-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.category-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--category-color, var(--primary));
  display: grid; place-items: center;
  font-size: 22px; margin-bottom: 14px;
  color: white;
}
.category-name { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.category-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.category-stats { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); }
.category-stat strong { color: var(--text); font-weight: 700; }

/* ── Hero / Banner ── */
.hero {
  background: var(--grad-primary);
  border-radius: var(--radius-lg);
  padding: 48px;
  position: relative; overflow: hidden;
  color: white;
  margin-bottom: 32px;
}
.hero::before {
  content: '';
  position: absolute; top: -50%; right: -10%;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute; bottom: -30%; left: 30%;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.hero-content { position: relative; z-index: 1; }
.hero h1 { font-size: 36px; font-weight: 800; letter-spacing: -1px; margin-bottom: 12px; line-height: 1.2; }
.hero p { font-size: 17px; opacity: 0.9; max-width: 520px; line-height: 1.6; }
.hero-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn-white { background: white; color: var(--primary); font-weight: 700; }
.btn-white:hover { background: rgba(255,255,255,0.9); transform: translateY(-1px); color: var(--primary); }
.btn-outline-white { border: 2px solid rgba(255,255,255,0.6); color: white; background: transparent; }
.btn-outline-white:hover { background: rgba(255,255,255,0.15); color: white; border-color: white; }

/* ── Stats Bar ── */
.stats-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.stat-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Member Profile ── */
.profile-cover {
  height: 240px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--grad-primary);
  position: relative; overflow: hidden;
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-wrap {
  position: absolute; bottom: -48px; left: 32px;
  width: 100px; height: 100px;
  border-radius: 50%; border: 4px solid var(--bg);
  overflow: hidden; background: var(--bg);
}
.profile-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.profile-header {
  padding: 64px 32px 24px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.profile-name { font-size: 24px; font-weight: 800; color: var(--text); }
.profile-business { font-size: 15px; color: var(--text-muted); margin-top: 4px; }
.profile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.profile-stats { display: flex; gap: 24px; margin-top: 16px; }
.profile-stat { text-align: center; }
.profile-stat-value { font-size: 20px; font-weight: 800; color: var(--text); }
.profile-stat-label { font-size: 12px; color: var(--text-muted); }
.profile-bio { font-size: 15px; color: var(--text-muted); line-height: 1.6; margin-top: 16px; max-width: 600px; }
.profile-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.profile-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
  transition: var(--transition);
}
.profile-link-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.profile-link-btn.whatsapp { background: #25D366; color: white; border-color: #25D366; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
}
.badge-sm { padding: 2px 8px; font-size: 10px; }
.badge-free     { background: rgba(107,114,128,0.1); color: #6B7280; }
.badge-premium  { background: rgba(245,158,11,0.15); color: #D97706; border: 1px solid rgba(245,158,11,0.3); }
.badge-vip      { background: rgba(124,58,237,0.12); color: var(--primary); border: 1px solid rgba(124,58,237,0.25); }
.badge-seller   { background: rgba(16,185,129,0.12); color: #059669; border: 1px solid rgba(16,185,129,0.25); }
.badge-admin    { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.badge-mod      { background: rgba(59,130,246,0.12); color: var(--info); border: 1px solid rgba(59,130,246,0.25); }
.badge-verified { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-new      { background: rgba(16,185,129,0.1); color: var(--success); }

/* ── Alerts ── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.5;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: #059669; }
.alert-danger   { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: var(--danger); }
.alert-warning  { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: #D97706; }
.alert-info     { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: var(--info); }

/* ── Tags ── */
.tag {
  display: inline-block;
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
  background: rgba(124,58,237,0.08);
  color: var(--primary);
  border: 1px solid rgba(124,58,237,0.15);
  cursor: pointer; transition: var(--transition);
}
.tag:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Rich Text Editor ── */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 10px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-btn {
  width: 32px; height: 32px; border: none;
  background: transparent; color: var(--text-muted);
  border-radius: 6px; display: grid; place-items: center;
  font-size: 14px; cursor: pointer; transition: var(--transition);
}
.editor-btn:hover { background: rgba(124,58,237,0.1); color: var(--primary); }
.editor-content {
  min-height: 160px; padding: 14px 16px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 14px; color: var(--text); line-height: 1.6;
  outline: none;
}
.editor-content:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(124,58,237,0.08); }

/* ── Notifications Dropdown ── */
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 12px; padding: 14px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition); cursor: pointer;
}
.notif-item:hover { background: rgba(124,58,237,0.04); }
.notif-item.unread { background: rgba(124,58,237,0.04); }
.notif-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.notif-msg   { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.notif-time  { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.notif-dot { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; flex-shrink: 0; margin-top: 6px; }

/* ── Marketplace ── */
.marketplace-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.listing-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: var(--transition);
}
.listing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.listing-image { height: 180px; overflow: hidden; background: var(--grad-primary); }
.listing-image img { width: 100%; height: 100%; object-fit: cover; transition: var(--transition-lg); }
.listing-card:hover .listing-image img { transform: scale(1.05); }
.listing-body { padding: 18px; }
.listing-category { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); margin-bottom: 8px; }
.listing-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.4; }
.listing-price { font-size: 20px; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.listing-price small { font-size: 13px; color: var(--text-muted); -webkit-text-fill-color: var(--text-muted); }
.listing-seller { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.listing-seller img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.listing-seller-name { font-size: 13px; font-weight: 600; color: var(--text); }
.listing-rating { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); margin-left: auto; }

/* ── Referral page grids ── */
@media (max-width: 768px) {
  .referral-stats-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .referral-two-col    { grid-template-columns: 1fr !important; }
}
@media (max-width: 480px) { .referral-stats-grid { grid-template-columns: repeat(2, 1fr) !important; } }

/* ── Notifications dropdown responsive ── */
@media (max-width: 768px) {
  .notif-dropdown-menu { width: calc(100vw - 16px) !important; right: -8px !important; left: auto; }
}

/* ── Message List Items ── */
.message-list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: background 0.15s; cursor: pointer;
}
.message-list-item:hover { background: rgba(124,58,237,0.04); }
.message-list-item.unread { background: rgba(124,58,237,0.04); }
.message-list-item:last-child { border-bottom: none; }

/* ── Messages ── */
.messages-layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - var(--nav-height) - 48px); gap: 0; }
.conversations-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.convo-list { flex: 1; overflow-y: auto; }
.convo-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition);
}
.convo-item:hover { background: rgba(124,58,237,0.04); }
.convo-item.active { background: rgba(124,58,237,0.08); }
.convo-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.convo-info { flex: 1; min-width: 0; }
.convo-name { font-size: 14px; font-weight: 700; color: var(--text); }
.convo-preview { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.convo-time { font-size: 11px; color: var(--text-light); }
.unread-badge {
  background: var(--primary); color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}

.chat-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: none; border-radius: 0 var(--radius) var(--radius) 0;
  display: flex; flex-direction: column;
}
.chat-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
}
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.message-bubble {
  max-width: 70%; display: flex; flex-direction: column; gap: 4px;
}
.message-bubble.sent { align-self: flex-end; align-items: flex-end; }
.message-bubble.received { align-self: flex-start; }
.bubble-body {
  padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.5;
}
.sent .bubble-body { background: var(--grad-primary); color: white; border-radius: 18px 18px 4px 18px; }
.received .bubble-body { background: var(--bg-input); color: var(--text); border-radius: 18px 18px 18px 4px; border: 1px solid var(--border); }
.bubble-time { font-size: 11px; color: var(--text-light); padding: 0 4px; }
.chat-input-bar {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-end;
}
.chat-input {
  flex: 1; padding: 12px 16px; min-height: 44px; max-height: 120px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: 22px; font-size: 14px; color: var(--text);
  resize: none; font-family: var(--font-sans); outline: none;
  transition: var(--transition);
}
.chat-input:focus { border-color: var(--primary); }

/* ── Loading Skeleton ── */
@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, rgba(124,58,237,0.05) 50%, var(--bg-input) 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 8px;
}
.skel-title { height: 20px; width: 70%; margin-bottom: 12px; }
.skel-text  { height: 14px; width: 100%; margin-bottom: 8px; }
.skel-text-sm { height: 14px; width: 50%; }
.skel-avatar { width: 48px; height: 48px; border-radius: 50%; }

/* ── Admin Dashboard ── */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - var(--nav-height));
  gap: 0;
}
.admin-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky; top: var(--nav-height); height: calc(100vh - var(--nav-height));
  overflow-y: auto;
}
.admin-content { padding: 32px; }
.admin-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; font-size: 14px; color: var(--text-muted);
  transition: var(--transition); cursor: pointer;
}
.admin-nav-item:hover { color: var(--primary); background: rgba(124,58,237,0.06); }
.admin-nav-item.active { color: var(--primary); background: rgba(124,58,237,0.1); font-weight: 600; border-right: 3px solid var(--primary); }
.admin-nav-section { padding: 8px 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-light); margin-top: 16px; }

.stat-widget {
  padding: 24px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  position: relative; overflow: hidden;
}
.stat-widget-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center; font-size: 22px; margin-bottom: 16px;
}
.stat-widget-value { font-size: 32px; font-weight: 800; color: var(--text); }
.stat-widget-label { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.stat-widget-trend { font-size: 12px; margin-top: 8px; }
.trend-up   { color: var(--success); }
.trend-down { color: var(--danger); }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); gap: 0; margin-bottom: 24px; overflow-x: auto; }
.tab-btn {
  padding: 12px 20px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); border: none; background: none;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none; transition: var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  transform: scale(0.95); transition: var(--transition);
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header {
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 32px; height: 32px; border: none; background: var(--bg-input);
  border-radius: 8px; cursor: pointer; color: var(--text-muted); font-size: 16px;
  display: grid; place-items: center; transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: white; }
.modal-body { padding: 24px; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Toast Notifications ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--bg-card); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 300px; max-width: 400px;
  animation: slideInRight 0.3s ease;
}
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-msg { font-size: 14px; color: var(--text); font-weight: 500; flex: 1; }
.toast-success { border-left: 3px solid var(--success); }
.toast-danger   { border-left: 3px solid var(--danger); }
.toast-info     { border-left: 3px solid var(--info); }
.toast-warning  { border-left: 3px solid var(--warning); }

/* ── Membership Plan Cards ── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.plan-card {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; text-align: center;
  transition: var(--transition); position: relative; overflow: hidden;
}
.plan-card.featured { border-color: var(--primary); }
.plan-card.featured::before {
  content: 'Most Popular';
  position: absolute; top: 14px; right: -28px;
  background: var(--grad-primary); color: white;
  font-size: 11px; font-weight: 700; padding: 4px 36px;
  transform: rotate(45deg);
}
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.plan-icon { font-size: 36px; margin-bottom: 14px; }
.plan-name { font-size: 18px; font-weight: 800; color: var(--text); }
.plan-price { font-size: 36px; font-weight: 900; margin: 14px 0; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.plan-period { font-size: 14px; color: var(--text-muted); -webkit-text-fill-color: var(--text-muted); }
.plan-features { list-style: none; margin: 20px 0; text-align: left; }
.plan-features li { padding: 8px 0; font-size: 14px; color: var(--text-muted); display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--border); }
.plan-features li:last-child { border: none; }
.plan-features li .check { color: var(--success); font-size: 16px; flex-shrink: 0; }
.plan-features li .cross { color: var(--text-light); font-size: 16px; flex-shrink: 0; }

/* ── Utilities ── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }
.fw-bold     { font-weight: 700; }
.fw-black    { font-weight: 900; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }
.mb-16   { margin-bottom: 16px; }
.mb-24   { margin-bottom: 24px; }
.p-16    { padding: 16px; }
.p-24    { padding: 24px; }
.w-100   { width: 100%; }
.rounded { border-radius: var(--radius); }
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-gradient { background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* Page title */
.page-title { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; margin-bottom: 6px; }
.page-subtitle { font-size: 15px; color: var(--text-muted); }

/* Section heading */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 18px; font-weight: 700; color: var(--text); }

/* Online indicator */
.online-dot { width: 10px; height: 10px; background: var(--success); border-radius: 50%; border: 2px solid var(--bg); position: absolute; bottom: 1px; right: 1px; }

/* Verified check */
.verified-icon { color: var(--info); font-size: 14px; }

/* Stars */
.stars { color: var(--accent); letter-spacing: 2px; }

/* ── Responsive (Desktop breakpoints) ── */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 220px 1fr 240px; gap: 16px; padding: 16px; }
}
@media (max-width: 1024px) {
  .layout { grid-template-columns: 220px 1fr; }
  .layout > .right-sidebar { display: none; }
}

/* ── Animations ── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp   { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse     { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes bounceIn  { 0% { transform: scale(0.8); opacity: 0; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }

.animate-fade-in  { animation: fadeIn 0.4s ease; }
.animate-slide-up { animation: slideUp 0.4s ease; }
.animate-bounce   { animation: bounceIn 0.5s ease; }
.loading-spin     { animation: spin 0.8s linear infinite; }

/* ── Lazy load ── */
img.lazy { opacity: 0; transition: opacity 0.4s ease; }
img.lazy.loaded { opacity: 1; }

/* ── Feather Icons ── */
.icon { display: inline-block; vertical-align: middle; }

/* ── Category Mega Dropdown ── */
.cat-mega-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  color: #fff !important;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  box-shadow: 0 4px 18px rgba(124,58,237,0.45);
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.cat-mega-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(124,58,237,0.55); }
.cat-mega-btn.open  { transform: none; box-shadow: 0 0 0 4px rgba(124,58,237,0.25); }
.cat-mega-arrow { font-size: 12px; display: inline-block; transition: transform 0.2s; }
.cat-mega-btn.open .cat-mega-arrow { transform: rotate(180deg); }
.cat-mega-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav-height);
  z-index: 198;
  background: rgba(0,0,0,0.3);
}
.cat-mega-overlay.open { display: block; }
.cat-mega-panel {
  display: none;
  position: fixed;
  left: 0; right: 0;
  top: var(--nav-height);
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  z-index: 199;
  max-height: calc(100vh - var(--nav-height) - 40px);
  overflow-y: auto;
}
.cat-mega-panel.open { display: block; animation: catPanelIn 0.18s ease; }
@keyframes catPanelIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cat-mega-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 28px 20px;
}
.cat-mega-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.cat-mega-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.cat-mega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 8px;
}
.cat-mega-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  text-decoration: none;
  border: 1.5px solid var(--border);
  background: var(--bg);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.cat-mega-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border-color: var(--cat-color, var(--primary));
}
.cat-mega-item.active {
  border-color: var(--cat-color, var(--primary));
  background: var(--bg-input);
}
.cat-mega-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.cat-mega-info { min-width: 0; flex: 1; }
.cat-mega-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-mega-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
@media (max-width: 900px) {
  .cat-mega-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .cat-mega-label { display: none; }
  .cat-mega-btn { padding: 7px 10px; gap: 4px; }
  .cat-mega-inner { padding: 14px 16px; }
  .cat-mega-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .cat-mega-icon { width: 34px; height: 34px; font-size: 16px; border-radius: 8px; }
  .cat-mega-name { font-size: 12px; }
}

/* ============================================================
   MOBILE RESPONSIVE — App-like experience (iOS + Android)
   ============================================================ */

/* Prevent horizontal scroll */
html, body { overflow-x: hidden; }
img, video, iframe, embed { max-width: 100%; height: auto; }

/* Mobile text wrap helper */
@media (max-width: 768px) {
  .mob-wrap-text { white-space: normal !important; }
}

/* Safe area / PWA variables */
:root {
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --mob-nav-h:   60px;
}

/* ── Bottom Navigation Bar ── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--mob-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
  z-index: 901;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.1);
  align-items: stretch;
  justify-content: space-around;
}
@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex; }
  body { padding-bottom: calc(var(--mob-nav-h) + var(--safe-bottom)); }
  .toast-container { bottom: calc(var(--mob-nav-h) + var(--safe-bottom) + 12px) !important; right: 12px !important; left: 12px; max-width: calc(100vw - 24px); }
  .toast { min-width: auto; width: 100%; }
}

.mob-nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; flex: 1;
  padding: 6px 2px; min-height: 44px;
  background: none; border: none;
  cursor: pointer; color: var(--text-muted);
  text-decoration: none; font-family: var(--font-sans);
  transition: color 0.2s; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.mob-nav-item:active { opacity: 0.7; }
.mob-nav-item.active { color: var(--primary); }
.mob-nav-icon { font-size: 22px; line-height: 1.1; }
.mob-nav-label { font-size: 9px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; }

.mob-nav-post-wrap { display: flex; align-items: center; justify-content: center; flex: 1; }
.mob-nav-post {
  width: 50px; height: 50px;
  background: var(--grad-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 18px rgba(124,58,237,0.45);
  color: white; text-decoration: none;
  margin-top: -14px; flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.mob-nav-post:active { transform: scale(0.93); box-shadow: 0 2px 10px rgba(124,58,237,0.3); }

.mob-nav-badge {
  position: absolute; top: 4px; right: calc(50% - 18px);
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* ── Mobile Drawer ── */
.mob-drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 1100;
}
.mob-drawer-overlay.open { display: block; animation: fadeIn 0.2s ease; }

.mob-drawer {
  position: fixed; top: 0; right: -100%;
  width: min(84vw, 300px); height: 100%;
  background: var(--bg-card);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  z-index: 1200; overflow-y: auto;
  transition: right 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -4px 0 32px rgba(0,0,0,0.2);
  overscroll-behavior: contain;
}
.mob-drawer.open { right: 0; }

.mob-drawer-head {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-card); backdrop-filter: var(--blur);
  padding-top: calc(16px + var(--safe-top));
}
.mob-drawer-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mob-drawer-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); flex-shrink: 0; }
.mob-drawer-name { font-size: 14px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mob-drawer-handle { font-size: 12px; color: var(--text-muted); }
.mob-drawer-close {
  width: 32px; height: 32px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 50%;
  font-size: 16px; display: grid; place-items: center;
  cursor: pointer; color: var(--text-muted); flex-shrink: 0; margin-left: 8px;
}

.mob-drawer-nav { padding: 8px 0; }
.mob-drawer-section { padding: 8px 16px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-light); }
.mob-drawer-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; font-size: 14px; font-weight: 500;
  color: var(--text); text-decoration: none;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer; border: none; background: none;
  width: 100%; font-family: var(--font-sans); text-align: left;
  min-height: 48px;
}
.mob-drawer-item:active { background: rgba(124,58,237,0.07); color: var(--primary); }
.mob-drawer-item .di-icon { font-size: 18px; width: 26px; text-align: center; flex-shrink: 0; }
.mob-drawer-item .di-label { flex: 1; }
.mob-drawer-item .di-count { background: var(--danger); color: white; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 99px; min-width: 18px; text-align: center; }
.mob-drawer-item .di-badge { background: rgba(124,58,237,0.12); color: var(--primary); font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.mob-drawer-divider { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ── Mobile Search Overlay ── */
.mob-search-overlay {
  display: none; position: fixed; inset: 0;
  z-index: 2000; background: var(--bg);
  flex-direction: column;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
}
.mob-search-overlay.open { display: flex; }
.mob-search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input); border: 1.5px solid var(--primary);
  border-radius: var(--radius-full); padding: 0 16px; height: 48px; flex-shrink: 0;
}
.mob-search-bar input { flex: 1; background: none; border: none; outline: none; font-size: 16px; color: var(--text); font-family: var(--font-sans); }
.mob-search-bar input::placeholder { color: var(--text-muted); }
.mob-search-icon { font-size: 18px; color: var(--primary); flex-shrink: 0; }
.mob-search-cancel { font-size: 14px; font-weight: 600; color: var(--primary); cursor: pointer; white-space: nowrap; padding: 6px; flex-shrink: 0; -webkit-tap-highlight-color: transparent; }
.mob-search-results { flex: 1; overflow-y: auto; margin-top: 12px; }
.mob-search-hint { text-align: center; color: var(--text-muted); font-size: 14px; margin-top: 40px; }

/* ── Mobile Navbar Tweaks ── */
@media (max-width: 768px) {
  :root { --nav-height: 56px; }
  .navbar { padding: 0 12px; gap: 8px; }
  .nav-brand { gap: 7px; }
  .nav-brand span { font-size: 16px; }
  .nav-brand .brand-icon { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }
  .nav-search { display: none !important; }
  .cat-mega-label { display: none !important; }
  .cat-mega-btn { padding: 8px 10px !important; border-radius: 10px !important; }
  .nav-actions { gap: 4px; }
  .nav-actions .btn-primary { display: none !important; }
  .nav-actions > a[href*="messages"].nav-btn { display: none !important; }
  #mobile-menu-btn { display: grid !important; }
  #mob-nav-search-btn { display: grid !important; }
}
@media (min-width: 769px) {
  #mobile-menu-btn { display: none !important; }
  #mob-nav-search-btn { display: none !important; }
}

/* ── Mobile Layout ── */
@media (max-width: 768px) {
  /* CRITICAL: collapse grid to 1 column — fixed column tracks eat all space otherwise */
  .layout,
  .layout.no-sidebar,
  .layout.full-width { grid-template-columns: 1fr !important; width: 100%; max-width: 100vw; padding: 12px; gap: 12px; }
  .layout > .sidebar,
  .layout > .right-sidebar { display: none !important; }
  #main-content { width: 100%; overflow-x: hidden; }

  .hero { padding: 24px 18px; border-radius: var(--radius); margin-bottom: 20px; }
  .hero h1 { font-size: 22px; }
  .hero p  { font-size: 14px; }
  .hero-actions { gap: 8px; }
  .hero-actions .btn { font-size: 13px; padding: 9px 16px; }

  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
  .stat-card { padding: 16px 12px; }
  .stat-value { font-size: 22px; }

  .thread-card { padding: 14px; gap: 10px; }
  .thread-title { font-size: 15px; }
  .thread-footer { gap: 10px; margin-top: 10px; font-size: 12px; }

  .category-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .category-card { padding: 14px; }

  .plans-grid { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; }

  .profile-cover { height: 150px; border-radius: var(--radius) var(--radius) 0 0; }
  .profile-avatar-wrap { width: 76px; height: 76px; border-width: 3px; bottom: -38px; left: 18px; }
  .profile-header { padding: 50px 18px 20px; }
  .profile-name { font-size: 20px; }
  .profile-stats { gap: 14px; flex-wrap: wrap; }

  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 0; }
  .admin-main { padding: 16px; }

  .messages-layout { grid-template-columns: 1fr; height: auto; }
  .conversations-panel { height: 260px; border-radius: var(--radius); }
  .chat-panel { border-left: 1px solid var(--border); border-radius: var(--radius); border-top: 1px solid var(--border); min-height: 55vh; }

  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-btn { padding: 10px 14px; font-size: 13px; }

  .modal { border-radius: var(--radius); }
  .page-title { font-size: 22px; }

  .site-footer { margin-top: 28px; }
  .footer-top { padding: 28px 16px; gap: 24px; }
  .footer-top { grid-template-columns: 1fr !important; }
  .footer-links { grid-template-columns: repeat(2, 1fr) !important; gap: 16px; }

  .marketplace-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .listing-image { height: 140px; }
  .listing-body { padding: 12px; }
}

@media (max-width: 480px) {
  .layout { padding: 10px; }
  .hero h1 { font-size: 20px; }
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .thread-card { flex-direction: column; gap: 8px; }
  .thread-vote { flex-direction: row; }
  .profile-stats { gap: 12px; }
  .profile-link-btn { font-size: 12px; padding: 6px 10px; }
  .footer-links { grid-template-columns: 1fr 1fr !important; }
  .marketplace-grid { grid-template-columns: 1fr; }
}

/* ── Touch Device — disable hover transforms ── */
@media (hover: none) and (pointer: coarse) {
  .card:hover { transform: none; box-shadow: var(--shadow-card); }
  .thread-card:hover { transform: none; box-shadow: none; }
  .thread-card:hover::before { opacity: 0; }
  .listing-card:hover { transform: none; box-shadow: var(--shadow-card); }
  .btn-primary:hover { transform: none; }
  .category-card:hover { transform: none; }
  .plan-card:hover { transform: none; }
}

/* ── Minimum touch tap size (mobile only) ── */
@media (max-width: 768px) {
  .btn, .nav-btn, .tab-btn { min-height: 44px; }
  .mob-drawer-item { min-height: 48px; }
}

/* ── Admin sidebar mobile toggle ── */
.admin-sidebar-toggle {
  display: none;
  width: 100%; padding: 12px 20px;
  background: none; border: none; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer; text-align: left; font-family: var(--font-sans);
  align-items: center; gap: 10px;
}
@media (max-width: 768px) {
  .admin-sidebar-toggle { display: flex; }
  .admin-nav-items { display: none; }
  .admin-nav-items.open { display: block; }
}

/* ── Announcement bar mobile ── */
@media (max-width: 768px) {
  .ann-bar { padding: 8px 12px !important; font-size: 12px !important; }
  .ann-bar button { flex-shrink: 0; }
}

/* ── Admin main padding ── */
.admin-main { padding: 32px; }
@media (max-width: 768px) {
  .admin-main { padding: 16px; }
}

/* ============================================================
   INLINE STYLE OVERRIDES — Force mobile layout for inline grids
   Uses attribute selectors since media queries can't touch
   inline style="" attributes without !important
   ============================================================ */

@media (max-width: 768px) {

  /* ── Collapse ALL multi-column inline grids to 1 column ── */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 2fr"],
  [style*="grid-template-columns: 1fr 2fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns:3fr 2fr"],
  [style*="grid-template-columns: 3fr 2fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:2fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr 1fr"],
  [style*="grid-template-columns:repeat(3,"],
  [style*="grid-template-columns:repeat(4,"],
  [style*="grid-template-columns:repeat(5,"],
  [style*="grid-template-columns: repeat(3,"],
  [style*="grid-template-columns: repeat(4,"],
  [style*="grid-template-columns: repeat(5,"],
  [style*="grid-template-columns:1fr 360px"],
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns:240px 1fr"],
  [style*="grid-template-columns:300px 1fr"],
  [style*="grid-template-columns:220px 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── 2-col stat grids stay 2-col on phone (not collapse fully) ── */
  [style*="grid-template-columns:repeat(auto-fit,minmax(100px"],
  [style*="grid-template-columns:repeat(auto-fit,minmax(110px"],
  [style*="grid-template-columns:repeat(auto-fit,minmax(120px"],
  [style*="grid-template-columns:repeat(auto-fit,minmax(130px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Shrink minmax floors so auto-fill grids go to 1 col ── */
  [style*="grid-template-columns:repeat(auto-fill,minmax(220px"],
  [style*="grid-template-columns:repeat(auto-fill,minmax(240px"],
  [style*="grid-template-columns:repeat(auto-fill,minmax(260px"],
  [style*="grid-template-columns:repeat(auto-fill,minmax(280px"] {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
  }

  /* ── Fixed-pixel columns in admin table headers ── */
  [style*="grid-template-columns:1fr 60px"],
  [style*="grid-template-columns:1fr 80px"],
  [style*="grid-template-columns:1fr 100px"] {
    grid-template-columns: 1fr auto !important;
  }

  /* ── Flex layouts — allow wrapping on mobile ── */
  .thread-footer, .thread-meta, .profile-links,
  .hero-actions, .profile-badges { flex-wrap: wrap; }

  /* ── Tables — horizontal scroll ── */
  .admin-main .table-wrap,
  .card .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }

  /* ── Messages layout ── */
  .messages-layout { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  /* All inline grids → single column on small phones */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* ── Source Protection ── */
.navbar, .site-footer, .nav-brand, .brand-icon { user-select: none; -webkit-user-select: none; }
img { pointer-events: none; -webkit-user-drag: none; }
