/* =========================================================
   Splashes — Responsive & Mobile Polish  (v3)
   Loaded LAST — highest priority overrides
   ========================================================= */

/* ── 1. Dark Theme Variables (default) ─────────────────── */
:root,
[data-theme="dark"] {
  --bg-surface:    #0e0e12;
  --bg-surface-2:  #141418;
  --bg-elevated:   #1a1a22;
  --bg-glass:      rgba(255,255,255,0.03);
  --text-primary:  #f0f0f5;
  --text-muted:    #555560;
  --text-inverse:  var(--bg-body);
  --border-color:  rgba(255,255,255,0.06);
  --border-subtle: rgba(255,255,255,0.04);
  --border-accent: rgba(0,212,170,0.25);
  --accent-glow:   rgba(0,212,170,0.4);
  --success:       #22c55e;
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow:   0 0 20px rgba(0,212,170,0.08);
  --header-height: 56px;
  --bottom-nav-height: 60px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-pill:999px;
  --font-sans:  'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'IBM Plex Mono', 'JetBrains Mono', monospace;
  --transition-fast: 0.15s ease;
}

/* ── 2. Light Theme Variables ───────────────────────────── */
[data-theme="light"] {
  --bg-body:       #f5f5f7;
  --bg-surface:    #ffffff;
  --bg-surface-2:  #f0f0f5;
  --bg-elevated:   #e8e8f0;
  --bg-glass:      rgba(0,0,0,0.02);
  --text-secondary:#4a4a5a;
  --text-muted:    var(--text-secondary);
  --text-inverse:  #ffffff;
  --border-color:  rgba(0,0,0,0.09);
  --border-subtle: rgba(0,0,0,0.05);
  --border-accent: rgba(0,180,140,0.3);
  --accent-dim:    rgba(0,184,148,0.1);
  --accent-glow:   rgba(0,184,148,0.3);
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.14);
  --shadow-glow:   0 0 20px rgba(0,184,148,0.12);
}

/* Light theme body */
[data-theme="light"] body {
  background: var(--bg-body);
  color: var(--text-primary);
}

/* Light theme header */
[data-theme="light"] #main-header {
  background: rgba(245,245,247,0.92) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

/* Light theme bottom nav */
[data-theme="light"] #bottom-nav {
  background: rgba(255,255,255,0.97) !important;
  border-top: 1px solid var(--border-color) !important;
}

/* Light theme sidebar */
[data-theme="light"] #side-nav {
  border-right-color: var(--border-color) !important;
}

/* Light theme inputs */
[data-theme="light"] .form-input,
[data-theme="light"] .form-textarea,
[data-theme="light"] .form-select {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Light theme cards */
[data-theme="light"] .post-card,
[data-theme="light"] .post-card-modern,
[data-theme="light"] .card,
[data-theme="light"] .chat-row {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
}

/* Light theme brand name gradient */
[data-theme="light"] #brand-name {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Light theme bottom nav items */
[data-theme="light"] .bottom-nav-item {
  color: var(--text-secondary);
}
[data-theme="light"] .bottom-nav-item.active {
  color: var(--accent) !important;
}

/* Light search input */
[data-theme="light"] #global-search-input {
  background: var(--bg-surface-2) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Light header buttons */
[data-theme="light"] .header-btn {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  color: var(--text-secondary) !important;
}
[data-theme="light"] .header-btn:hover {
  border-color: var(--border-accent) !important;
  color: var(--accent) !important;
}

/* Light mode nav items */
[data-theme="light"] .nav-item {
  color: var(--text-secondary);
}
[data-theme="light"] .nav-item:hover,
[data-theme="light"] .nav-item.active {
  background: var(--bg-surface-2) !important;
}
[data-theme="light"] .nav-item.active {
  color: var(--accent) !important;
}

/* Light pill */
[data-theme="light"] .pill {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  color: var(--text-secondary) !important;
}
[data-theme="light"] .pill.active {
  background: var(--accent-dim) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* Light modal */
[data-theme="light"] .modal-card {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
}

/* Light mobile-nav */
[data-theme="light"] #mobile-nav {
  background: rgba(245,245,247,0.98) !important;
}
[data-theme="light"] .mobile-nav-item {
  color: var(--text-primary) !important;
}

/* Light search-dropdown */
[data-theme="light"] .search-dropdown {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
}
[data-theme="light"] .search-item:hover {
  background: var(--bg-surface-2) !important;
}

/* Light toast */
[data-theme="light"] .toast {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── 3. Base resets ─────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.25s ease, color 0.25s ease;
}

/* Prevent iOS zoom on input focus */
input, textarea, select { font-size: 16px; }

/* ── 4. App Shell ───────────────────────────────────────── */
#app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── 5. Header ──────────────────────────────────────────── */
#main-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  background: var(--bg-body);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: env(safe-area-inset-top, 0px) 12px 0;
  gap: 8px;
}

/* On mobile we reorder: hamburger | search | notification */
/* brand-lockup hidden on mobile via media query */
#brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}
#logo-mark {
  width: 32px !important;
  height: 32px !important;
  background: transparent !important;
  object-fit: contain;
  flex-shrink: 0;
}
#brand-text { display: flex; flex-direction: column; gap: 1px; }
#brand-name {
  font-weight: 800;
  font-size: 1.05rem !important;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
#brand-tagline {
  font-size: 0.55rem !important;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

/* Search — grows to fill */
#global-search-container,
.header-search-container {
  flex: 1;
  max-width: 520px;
  margin: 0 8px;
  position: relative;
}
#global-search-input {
  width: 100%;
  padding: 9px 16px 9px 40px !important;
  border-radius: var(--radius-pill) !important;
  background: var(--bg-surface-2) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  font-size: 0.9rem !important;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}
#global-search-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(0,212,170,0.1) !important;
  outline: none !important;
  background: var(--bg-elevated) !important;
}
#global-search-input::placeholder { color: var(--text-muted); }

#header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.header-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: var(--radius-pill) !important;
  background: var(--bg-surface-2) !important;
  border: 1px solid var(--border-color) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}
.header-btn:hover {
  background: var(--bg-elevated) !important;
  border-color: var(--border-accent) !important;
  color: var(--accent);
}

#create-btn {
  padding: 7px 14px !important;
  font-size: 0.8rem !important;
  gap: 5px;
  border-radius: var(--radius-pill) !important;
}
#points-display {
  font-family: var(--font-mono);
  font-size: 0.7rem !important;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg-surface-2) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-pill) !important;
  padding: 5px 10px;
  white-space: nowrap;
}

/* ── 6. App Body ────────────────────────────────────────── */
#app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── 7. Sidebar ─────────────────────────────────────────── */
#side-nav {
  width: 220px;
  flex-shrink: 0;
  background: transparent;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 50;
}
#side-nav::-webkit-scrollbar { display: none; }
#side-nav.collapsed { width: 60px; }
#side-nav.collapsed .nav-text,
#side-nav.collapsed .nav-label { opacity:0; pointer-events:none; width:0; overflow:hidden; }
#side-nav.collapsed .nav-item  { justify-content:center; padding:10px 0; gap:0; }
#side-nav.collapsed .nav-section { padding: 0 8px; }

.nav-section { padding: 0 12px; margin-bottom: 16px; }
.nav-label {
  font-size: 0.6rem !important;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  font-size: 0.875rem !important;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  margin-bottom: 2px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
  font-weight: 600;
}
.nav-icon { width:20px; height:20px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }

/* ── 8. Main Content ─────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-body);
  padding: 20px 16px;
  padding-bottom: calc(var(--bottom-nav-height) + 20px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
#main-content::-webkit-scrollbar { width: 5px; }
#main-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* ── 9. Bottom Navigation ───────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-surface-2);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--border-color);
  z-index: 150;
  display: none;
  justify-content: space-around;
  align-items: center;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  min-width: 52px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bottom-nav-item svg { stroke-width: 1.8; transition: all 0.15s ease; }
.bottom-nav-item span { font-size: 0.62rem !important; font-weight: 500; letter-spacing: 0.3px; }
.bottom-nav-item.active { color: var(--accent) !important; }
.bottom-nav-item.active svg { stroke: var(--accent); filter: drop-shadow(0 0 5px rgba(0,212,170,0.5)); }
.bottom-nav-item.active span { color: var(--accent); font-weight: 600; }
.bottom-nav-item:active { transform: scale(0.88); }

/* Create button special style */
#bottom-create-btn { gap: 2px; }
#bottom-create-btn.active div {
  box-shadow: 0 4px 20px rgba(0,212,170,0.6) !important;
  transform: scale(1.05);
}

/* ── 10. Mobile Nav Drawer ──────────────────────────────── */
#mobile-nav {
  position: fixed;
  top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  left: 0; right: 0; bottom: 0;
  background: var(--bg-body);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 190;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  overflow-y: auto;
  animation: slideDown 0.2s ease-out;
}
#mobile-nav.open { display: flex; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  font-size: 1rem !important;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s ease;
  border: 1px solid transparent;
}
.mobile-nav-item:hover,
.mobile-nav-item:active { background: var(--bg-surface-2); border-color: var(--border-color); }

/* ── 11. Cards ──────────────────────────────────────────── */
.post-card, .post-card-modern {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}
.post-card:hover, .post-card-modern:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.post-card:active, .post-card-modern:active { transform: scale(0.99); }

.post-title { font-weight: 700; font-size: 1rem !important; line-height: 1.4; letter-spacing: -0.2px; color: var(--text-primary); margin-bottom: 8px; }
.post-body  { font-size: 0.875rem !important; line-height: 1.6; color: var(--text-secondary); }

.post-actions {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.post-action {
  font-size: 0.8rem !important;
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}
.post-action:hover { color: var(--accent); background: var(--accent-dim); }
.post-action.active { color: var(--accent); }

#feed-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 16px;
}

/* ── 12. Pills ──────────────────────────────────────────── */
.pill-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  margin-bottom: 20px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 90%, transparent 100%);
}
.pill-nav::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem !important;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.pill:hover { background: var(--bg-elevated); border-color: var(--border-accent); color: var(--text-primary); }
.pill.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); font-weight: 600; box-shadow: 0 0 12px var(--accent-glow); }
.pill:active { transform: scale(0.95); }

/* ── 13. Buttons ────────────────────────────────────────── */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem !important;
  letter-spacing: 0.2px;
  border-radius: var(--radius-pill);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent)); color: var(--bg-body) !important; box-shadow: 0 2px 12px rgba(0,212,170,0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,212,170,0.4); }
.btn-ghost { background: var(--bg-surface-2); color: var(--text-primary) !important; border: 1px solid var(--border-color) !important; }
.btn-ghost:hover { background: var(--bg-elevated); border-color: var(--border-accent) !important; color: var(--accent) !important; }
.btn-danger { background: var(--error); color: var(--text-primary) !important; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.w-full { width: 100%; }

/* ── 14. Forms ──────────────────────────────────────────── */
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  color: var(--text-primary) !important;
  font-family: var(--font-sans);
  font-size: 0.95rem !important;
  transition: all 0.15s ease;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,170,0.1);
  background: var(--bg-elevated);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-label { display:block; font-size:0.8rem !important; font-weight:600; color:var(--text-secondary); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:6px; }
.form-hint  { font-size:0.75rem !important; color:var(--text-muted); margin-top:4px; }
.form-error { font-size:0.75rem !important; color:var(--error); margin-top:4px; }
.form-group { margin-bottom: 20px; }

/* ── 15. Generic Card ───────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── 16. FAB ────────────────────────────────────────────── */
#new-splash-btn {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
  color: var(--bg-body) !important;
  font-size: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(0,212,170,0.45), 0 0 0 1px var(--accent-glow);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 140;
  text-decoration: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
#new-splash-btn:hover { transform: translateY(-2px) scale(1.06); box-shadow: 0 12px 36px rgba(0,212,170,0.6); }
#new-splash-btn:active { transform: scale(0.94); }

/* ── 17. Modals ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none !important; }
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,212,170,0.06);
  position: relative;
  overflow: hidden;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card::before { content:''; position:absolute; top:0;left:0;right:0;height:2px; background:linear-gradient(90deg,var(--accent),var(--info),var(--accent)); }

/* ── 18. Toasts ─────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 11px 20px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem !important;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--error); }
.toast-info    { border-left: 3px solid var(--info); }

/* ── 19. Auth ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(-45deg, var(--bg-body), var(--bg-body), var(--bg-surface), var(--bg-body));
  background-size: 500% 500%;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.auth-card::before { content:''; position:absolute; top:0;left:0;right:0;height:2px; background:linear-gradient(90deg,var(--accent),var(--info),var(--accent)); }

/* ── 20. Search Dropdown ─────────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  z-index: 500;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
}
.search-dropdown.hidden { display: none !important; }
.search-section { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.search-section:last-child { border-bottom: none; }
.search-section h4 { font-size:0.7rem !important; text-transform:uppercase; letter-spacing:0.5px; color:var(--text-muted); margin:0 14px 6px; font-weight:600; }
.search-item { display:flex; align-items:center; gap:10px; padding:9px 14px; text-decoration:none; color:var(--text-primary); transition:background 0.15s; font-size:0.875rem !important; }
.search-item:hover { background: var(--bg-surface-2); }
.search-item svg { width:16px; height:16px; color:var(--text-muted); flex-shrink:0; }

/* ── 21. Loading / Empty ─────────────────────────────────── */
.loading-spinner {
  display: inline-block;
  width: 24px; height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align:center; padding:48px 20px; color:var(--text-muted); }
.empty-state p { font-size:0.9rem !important; }

/* ── 22. Tabs ────────────────────────────────────────────── */
.tabs { display:flex; border-bottom:1px solid var(--border-subtle); overflow-x:auto; scrollbar-width:none; margin-bottom:16px; }
.tabs::-webkit-scrollbar { display:none; }
.tab { padding:10px 16px; font-size:0.875rem !important; font-weight:500; color:var(--text-muted); border-bottom:2px solid transparent; white-space:nowrap; cursor:pointer; transition:all 0.15s; background:none; border-top:none; border-left:none; border-right:none; }
.tab:hover { color: var(--text-secondary); }
.tab.active { color:var(--accent); font-weight:600; border-bottom-color:var(--accent); }

/* ── 23. Avatars ─────────────────────────────────────────── */
.avatar-lg { width:80px; height:80px; border-radius:50%; border:3px solid var(--bg-body); box-shadow:0 0 0 2px var(--accent),0 4px 20px var(--accent-glow); object-fit:cover; }
.avatar-sm { width:38px; height:38px; border-radius:50%; border:2px solid var(--bg-surface-2); object-fit:cover; }

/* ── 24. Notifications ───────────────────────────────────── */
#desktop-notification-dropdown {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ── 25. Utilities ───────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem !important; }
.text-xs { font-size: 0.75rem !important; }
.font-mono { font-family: var(--font-mono); }

/* ── 26. Share Modal ─────────────────────────────────────── */
#share-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 400;
  display: flex; align-items: flex-end; justify-content: center;
}
#share-modal-overlay.hidden { display: none !important; }
#share-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 600px;
  padding: 8px 0 0;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
#share-modal::before { content:''; position:absolute; top:0;left:0;right:0;height:2px; background:linear-gradient(90deg,var(--accent),var(--info),var(--accent)); }
.share-handle {
  width: 36px; height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}
.share-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.share-header h3 { font-size: 1.1rem; font-weight: 700; margin: 0; letter-spacing: -0.3px; }
.share-section { padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); }
.share-section:last-child { border-bottom: none; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.share-section-title { font-size: 0.7rem !important; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 600; margin-bottom: 12px; }
/* App share grid */
.share-apps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.share-app-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.share-app-btn:hover, .share-app-btn:active { background: var(--bg-elevated); border-color: var(--border-accent); transform: scale(0.96); }
.share-app-btn svg { flex-shrink: 0; }
.share-app-btn span { font-size: 0.7rem !important; font-weight: 500; color: var(--text-secondary); text-align: center; line-height: 1.2; }
/* User search in share */
.share-user-search {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.share-user-search input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.15s;
}
.share-user-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,170,0.1); }
#share-users-list { max-height: 200px; overflow-y: auto; }
.share-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.share-user-row:hover, .share-user-row:active { background: var(--bg-surface-2); }
.share-user-row img { width:36px;height:36px;border-radius:50%;object-fit:cover;flex-shrink:0; }
.share-user-row .share-user-info { flex:1; min-width:0; }
.share-user-row .share-user-name { font-size:0.875rem; font-weight:600; color:var(--text-primary); }
.share-user-row .share-user-handle { font-size:0.75rem; color:var(--text-muted); }
.share-user-row .share-send-btn {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.share-user-row .share-send-btn:hover { background: var(--accent); color: var(--bg-body); }
/* Copy link row */
.share-copy-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
}
.share-copy-row span { flex: 1; font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-copy-btn {
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--accent-dim); border: 1px solid var(--accent);
  color: var(--accent); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.share-copy-btn:hover { background: var(--accent); color: var(--bg-body); }

/* ==========================================================
   MOBILE (≤ 640px)
   ========================================================== */
@media (max-width: 640px) {
  /* ── Header redesign for phone ─────────────────────────
     Layout: [☰ hamburger] [🔍 search bar] [🔔 notif]
     Logo + brand text hidden on mobile              */

  #main-header {
    padding: 0 10px;
    padding-top: env(safe-area-inset-top, 0px);
    gap: 8px;
  }

  /* Show logo + brand name on mobile, hide tagline */
  #brand-lockup {
    display: flex !important;
    align-items: center;
    gap: 8px;
    order: 0;
  }
  #brand-tagline {
    display: none !important;
  }

  /* Show hamburger on LEFT (reorder via flex order) */
  #mobile-menu-btn {
    order: -1;
    display: flex !important;
    flex-shrink: 0;
  }

  /* Show mobile search button in header actions on mobile */
  #btn-mobile-search {
    display: flex !important;
  }

  /* Hide top search bar on mobile by default (e.g. on Home page) */
  #global-search-container,
  .header-search-container {
    display: none !important;
  }

  /* Page-specific Mobile Header Overrides */
  
  /* 1. Explore Page: show ONLY search bar, hide logo and menus */
  .page-explorer #main-header #mobile-menu-btn,
  .page-explorer #main-header #brand-lockup,
  .page-explorer #main-header #header-actions {
    display: none !important;
  }
  .page-explorer #main-header #global-search-container,
  .page-explorer #main-header .header-search-container {
    display: flex !important;
    flex: 1 !important;
    margin: 0 4px !important;
    max-width: none !important;
    order: 0 !important;
  }

  /* 2. Messages, Profile, Append Pages: hide header completely */
  .page-inbox #main-header,
  .page-profile #main-header,
  .page-append #main-header {
    display: none !important;
  }
  .page-inbox #main-content,
  .page-profile #main-content,
  .page-append #main-content {
    padding-top: 8px !important;
  }

  /* Notifications stays on right — hide desktop items */
  #btn-notifications { order: 1; }
  #create-btn      { display: none !important; }
  #auth-section    { display: none !important; }
  #btn-user-menu   { display: none !important; }
  #theme-toggle    { display: none !important; }
  #points-display  { display: none !important; }

  /* Show bottom nav */
  #bottom-nav { display: flex; }

  /* Hide sidebar */
  #side-nav:not(.open) { display: none !important; }

  /* Content padding */
  #main-content {
    padding: 14px 12px;
    padding-bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom, 0px));
  }

  /* Feed — single column */
  #feed-container { grid-template-columns: 1fr; gap: 12px; }

  /* Cards — override v2-design negative margins */
  .post-card-modern,
  .post-card {
    border-radius: 12px !important;
    border-left: 1px solid var(--border-color) !important;
    border-right: 1px solid var(--border-color) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 14px !important;
    min-height: auto;
  }

  /* Modal — bottom sheet */
  .modal-card {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    position: fixed; bottom: 0; left: 0; right: 0;
    max-width: 100%; max-height: 85vh;
    padding: 20px 20px env(safe-area-inset-bottom, 20px);
  }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* Auth */
  .auth-card { border-radius: var(--radius-xl); padding: 28px 20px; }

  /* Pills */
  .pill-nav { margin-bottom: 16px; padding-bottom: 8px; }
  .pill { padding: 6px 14px; }

  /* FAB */
  #new-splash-btn {
    width: 48px; height: 48px; font-size: 24px;
    bottom: calc(var(--bottom-nav-height) + 14px + env(safe-area-inset-bottom, 0px));
    right: 16px;
  }

  /* Toast */
  .toast {
    bottom: calc(var(--bottom-nav-height) + 10px + env(safe-area-inset-bottom, 0px));
  }

  /* Notification dropdown */
  #desktop-notification-dropdown {
    width: calc(100vw - 24px) !important;
    right: 12px !important;
    left: 12px !important;
  }

  /* Search dropdown */
  .search-dropdown { left: 0; right: 0; border-radius: var(--radius-md); top: calc(100% + 4px); }

  /* Touch targets */
  .btn { min-height: 44px; }
  .header-btn { width: 40px !important; height: 40px !important; }
  .bottom-nav-item { min-width: 48px; }
  .pill { min-height: 34px; }
  .post-action { min-height: 40px; }

  /* Profile header */
  .profile-header {
    margin-left: 0 !important; margin-right: 0 !important;
    border-radius: var(--radius-xl) !important;
    border: 1px solid var(--border-color) !important;
  }

  /* Forms — no iOS zoom */
  .form-input, .form-textarea, .form-select { font-size: 16px !important; padding: 12px 14px; }

  /* Share modal — full on mobile */
  #share-modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .share-apps { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================
   TABLET (641–1024px)
   ========================================================== */
@media (min-width: 641px) and (max-width: 1024px) {
  #mobile-menu-btn { display: none !important; }
  #side-nav { width: 64px; }
  #side-nav .nav-text, #side-nav .nav-label { display: none; }
  #side-nav .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
  #side-nav .nav-section { padding: 0 8px; }
  #global-search-container, .header-search-container { max-width: 320px; }
  #feed-container { grid-template-columns: 1fr; gap: 14px; }
  #main-content { padding: 16px; }
  #bottom-nav { display: none !important; }
  #main-content { padding-bottom: 24px; }
  #new-splash-btn { bottom: 24px; right: 24px; }
  .toast { bottom: 24px; }
}

/* ==========================================================
   DESKTOP (> 1024px)
   ========================================================== */
@media (min-width: 1025px) {
  #mobile-menu-btn   { display: none !important; }
  #bottom-nav { display: none !important; }
  #main-content { padding: 24px; padding-bottom: 40px; }
  #new-splash-btn { bottom: 28px; right: 28px; }
  .toast { bottom: 24px; }
  #feed-container { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 20px; }
}

/* ==========================================================
   PWA Standalone
   ========================================================== */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
  #main-header { height: calc(var(--header-height) + env(safe-area-inset-top, 0px)); }
  #bottom-nav  { height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px)); }
}

/* ==========================================================
   Reduced Motion
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================
   Touch — remove hover transforms
   ========================================================== */
@media (hover: none) {
  .post-card:hover, .post-card-modern:hover { transform: none; }
  .btn-primary:hover { transform: none; box-shadow: 0 2px 12px rgba(0,212,170,0.25); }
  .pill:hover { transform: none; }
}

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
