/* ============================================================
   HUSLI APP — Complete Premium Glassmorphism Stylesheet
   Apple × Arc × X — Dark default, mobile‑first, responsive
   Includes: All 15 features + Splash + Reply Modal + Animations
   FIXES: dropdown z-index, light mode drawer, mobile search,
          emoji picker positioning, pull-to-refresh, etc.
   ============================================================ */

/* ----- Premium Color Palette ----- */
:root {
  --bg: #09090B;
  --bg-glass: rgba(18, 18, 30, 0.45);
  --bg-glass-hover: rgba(25, 25, 40, 0.55);
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.08);
  --bg-secondary: rgba(255, 255, 255, 0.03);
  --text: #F5F5F7;
  --text-secondary: #A1A1AA;
  --text-tertiary: #717182;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.08);
  --primary: #7C4DFF;
  --primary-hover: #9D7CFF;
  --primary-light: #B794FF;
  --primary-bg: rgba(124, 77, 255, 0.1);
  --primary-bg-hover: rgba(124, 77, 255, 0.18);
  --accent: #4DA3FF;
  --purple-gradient: linear-gradient(135deg, #7C4DFF, #9D7CFF);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 24px 80px rgba(0, 0, 0, 0.6);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --sidebar-width: 280px;
  --insights-width: 280px;
  --header-height: 64px;
  --mobile-nav-height: 72px;
}

/* ----- Light Theme ----- */
[data-theme="light"] {
  --bg: #F5F5F7;
  --bg-glass: rgba(255, 255, 255, 0.55);
  --bg-glass-hover: rgba(255, 255, 255, 0.65);
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.8);
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-input-focus: rgba(0, 0, 0, 0.06);
  --bg-secondary: rgba(0, 0, 0, 0.02);
  --text: #1A1A2E;
  --text-secondary: #555770;
  --text-tertiary: #8E8E93;
  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.05);
  --border-color: rgba(0, 0, 0, 0.08);
  --primary: #6C5CE7;
  --primary-hover: #5A4BD1;
  --primary-light: #8B7CF0;
  --primary-bg: rgba(108, 92, 231, 0.1);
  --primary-bg-hover: rgba(108, 92, 231, 0.18);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 24px 80px rgba(0, 0, 0, 0.15);
}

/* ----- Reset & Base ----- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; -webkit-font-smoothing:antialiased; font-size:16px; }
body {
  font-family:var(--font); background:var(--bg); color:var(--text);
  line-height:1.6; overflow:hidden; height:100vh;
  transition:background var(--transition), color var(--transition);
}
a { color:inherit; text-decoration:none; }
button { cursor:pointer; font-family:inherit; border:none; background:none; color:inherit; }
input, textarea, select { font-family:inherit; color:inherit; }

/* ----- App Shell ----- */
.app-shell { display:flex; height:100vh; overflow:hidden; }

/* ============================================================
   GLASS MORPHISM UTILITIES
   ============================================================ */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.glass-bar {
  background: rgba(18, 18, 30, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.glass-capsule {
  background: rgba(18, 18, 30, 0.6);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border);
  border-radius: 40px;
  box-shadow: var(--shadow-lg);
}
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.glass-input {
  background: var(--bg-input);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  transition: all var(--transition-fast);
}
.glass-input:focus-within, .glass-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.glass-btn {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  transition: all var(--transition-fast);
}
.glass-btn:hover {
  background: rgba(124, 77, 255, 0.15);
  border-color: var(--primary);
  color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124, 77, 255, 0.25);
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #09090B;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  opacity: 1;
  visibility: visible;
}
.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-content { text-align: center; animation: splashPulse 2s ease-in-out infinite; }
.splash-logo {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(124, 77, 255, 0.35);
  margin-bottom: 16px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.splash-brand {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #7C4DFF, #B794FF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}
.splash-spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: #7C4DFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
[data-theme="light"] .splash-screen { background: #F5F5F7; }

@keyframes splashPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ============================================================
   SIDEBAR (Floating Glass)
   ============================================================ */
.sidebar {
  display: none;
  width: var(--sidebar-width);
  flex-shrink: 0;
  margin: 12px 0 12px 12px;
  background: transparent;
  border: none;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
}
.sidebar .glass-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}
.sidebar-top { flex:1; display:flex; flex-direction:column; }
.sidebar-logo { display:flex; align-items:center; gap:10px; padding:8px 12px; margin-bottom:16px; font-weight:800; font-size:1.2rem; }
.logo-icon { width:36px; height:36px; border-radius:var(--radius-sm); background:var(--purple-gradient); display:flex; align-items:center; justify-content:center; color:#fff; font-weight:900; font-size:1rem; box-shadow:0 4px 16px rgba(124,77,255,0.3); }
.logo-text { background:linear-gradient(135deg, #7C4DFF, #B794FF); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.sidebar-nav { display:flex; flex-direction:column; gap:2px; }
.sidebar-item {
  display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:var(--radius);
  font-size:0.9rem; font-weight:500; color:var(--text-secondary); transition:all var(--transition-fast);
}
.sidebar-item:hover { background:var(--bg-card-hover); color:var(--text); }
.sidebar-item.active { background:var(--primary-bg); color:var(--primary); font-weight:600; }
.sidebar-item svg { width:22px; height:22px; opacity:0.75; }
.sidebar-item.active svg { opacity:1; color:var(--primary); }
.sidebar-badge { margin-left:auto; background:var(--primary); color:#fff; font-size:0.65rem; font-weight:700; padding:2px 8px; border-radius:var(--radius-full); min-width:20px; text-align:center; }
.sidebar-compose-btn {
  display:flex; align-items:center; justify-content:center; gap:8px; width:100%;
  padding:12px; margin-top:16px; background:var(--purple-gradient); color:#fff;
  border-radius:var(--radius-full); font-weight:700; font-size:0.9rem;
  box-shadow:0 4px 20px rgba(124,77,255,0.4); transition:all var(--transition);
}
.sidebar-compose-btn:hover { transform:translateY(-2px); box-shadow:0 8px 28px rgba(124,77,255,0.5); }
.sidebar-bottom { border-top:1px solid var(--border-light); padding-top:12px; margin-top:auto; }
.sidebar-user { display:flex; align-items:center; gap:10px; padding:8px; border-radius:var(--radius); cursor:pointer; transition:background var(--transition-fast); }
.sidebar-user:hover { background:var(--bg-card-hover); }
.sidebar-user-avatar { width:36px; height:36px; border-radius:50%; background:var(--primary-bg); display:flex; align-items:center; justify-content:center; font-size:1.1rem; }
.sidebar-user-info { flex:1; min-width:0; }
.sidebar-username { display:block; font-weight:600; font-size:0.85rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-plan { font-size:0.7rem; color:var(--text-tertiary); }
.sidebar-theme-btn { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--bg-input); border:1px solid var(--border); transition:all var(--transition); }
.sidebar-theme-btn:hover { background:var(--primary-bg); border-color:var(--primary-light); }
.theme-icon-moon, .theme-icon-sun { width:20px; height:20px; }
[data-theme="dark"] .theme-icon-sun { display:none; }
[data-theme="light"] .theme-icon-moon { display:none; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content { flex:1; display:flex; flex-direction:column; min-width:0; overflow:hidden; }

/* ----- Floating Top Bar ----- */
.app-header {
  display:flex; align-items:center; justify-content:space-between;
  margin:12px 12px 0 12px; padding:0 16px; height:var(--header-height);
  background:transparent; border:none;
  position:sticky; top:12px; z-index:100;
}
.app-header .glass-bar { width:100%; display:flex; align-items:center; justify-content:space-between; padding:0 16px; }
.header-left { display:flex; align-items:center; gap:12px; }
.header-drawer-btn {
  display:flex; flex-direction:column; gap:4px; width:32px; padding:4px;
  background:none; border:none; cursor:pointer;
}
.header-drawer-btn span { display:block; height:2px; background:var(--text); border-radius:2px; transition:all var(--transition); }
.header-title { font-size:1.1rem; font-weight:700; letter-spacing:-0.3px; white-space:nowrap; }
.header-search { flex:1; max-width:480px; display:none; }
.search-wrapper { display:flex; align-items:center; gap:8px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-full); padding:8px 16px; transition:all var(--transition); }
.search-wrapper:focus-within { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-bg); }
.search-icon { color:var(--text-tertiary); flex-shrink:0; }
.search-input { flex:1; background:none; border:none; outline:none; font-size:0.9rem; color:var(--text); }
.search-input::placeholder { color:var(--text-tertiary); }
.header-right { display:flex; align-items:center; gap:8px; }
.header-notif-btn { position:relative; padding:6px; border-radius:50%; transition:background var(--transition-fast); }
.header-notif-btn:hover { background:var(--bg-card-hover); }
.header-notif-btn svg { width:22px; height:22px; }
.header-notif-badge { position:absolute; top:0; right:0; width:16px; height:16px; background:#e74c3c; color:#fff; font-size:0.6rem; font-weight:700; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.header-avatar-btn { display: none; padding:4px; border-radius:50%; transition:background var(--transition-fast); }
.header-avatar-btn:hover { background:var(--bg-card-hover); }
.header-avatar-btn span { display:flex; align-items:center; justify-content:center; width:32px; height:32px; border-radius:50%; background:var(--primary-bg); font-size:1.1rem; }
.header-search-mobile {
  display: flex;
  padding: 6px;
  border-radius: 50%;
  transition: background var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text);
}
.header-search-mobile:hover { background:var(--bg-card-hover); }

@media (min-width: 768px) {
  .header-avatar-btn { display: flex; }
  .header-search-mobile { display: none; }
}

/* Mobile search overlay (to be toggled by JS) */
.header-search.active {
  display: flex !important;
  position: absolute;
  top: 60px;
  left: 12px;
  right: 12px;
  max-width: none;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  z-index: 200;
}

/* ----- Page Content ----- */
.page-content {
  flex:1; overflow-y:auto; padding:20px 16px;
  -webkit-overflow-scrolling:touch;
  padding-bottom: calc(var(--mobile-nav-height) + 40px);
}

/* ----- Loading & Empty States ----- */
.page-loading { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%; gap:16px; color:var(--text-secondary); }
.spinner { width:40px; height:40px; border:3px solid var(--border); border-top-color:var(--primary); border-radius:50%; animation:spin 0.8s linear infinite; }
.empty-state { text-align:center; padding:60px 20px; color:var(--text-secondary); }
.empty-state span { font-size:3rem; display:block; margin-bottom:12px; }
.empty-state h3 { font-size:1.2rem; margin-bottom:8px; color:var(--text); }
.empty-state p { font-size:0.9rem; margin-bottom:16px; }

/* ============================================================
   FEED CARDS (Hush Cards – all 15 features)
   ============================================================ */
.feed-list { display:flex; flex-direction:column; gap:16px; }

.hush-card {
  background:var(--bg-card); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
  border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px;
  transition:all var(--transition-fast); position:relative;
  overflow: visible !important; /* important for dropdown */
}
.hush-card:hover { border-color:var(--primary-light); box-shadow:var(--shadow); }

.hush-card-header { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.hush-avatar { width:36px; height:36px; border-radius:50%; background:var(--primary-bg); display:flex; align-items:center; justify-content:center; font-size:1rem; flex-shrink:0; }
.hush-user-info { flex:1; min-width:0; }
.hush-username { font-weight:600; font-size:0.9rem; }
.hush-handle { font-size:0.8rem; color:var(--text-tertiary); }
.hush-category {
  display:inline-block; background:var(--primary-bg); color:var(--primary);
  padding:2px 10px; border-radius:12px; font-size:0.7rem; font-weight:600;
  margin-top:4px;
}
.hush-time { font-size:0.75rem; color:var(--text-tertiary); margin-left:auto; white-space:nowrap; }

.hush-body {
  font-size:0.95rem; line-height:1.6; margin-bottom:14px; word-wrap:break-word;
}
/* Hashtag & Mention links */
.hush-hashtag { color:var(--primary); font-weight:600; cursor:pointer; text-decoration:none; }
.hush-hashtag:hover { text-decoration:underline; }
.hush-mention { color:var(--accent); font-weight:500; cursor:pointer; text-decoration:none; }
.hush-mention:hover { text-decoration:underline; }
.hush-link { color:var(--accent); text-decoration:underline; word-break:break-all; }

.read-more-btn { color:var(--primary); font-size:0.85rem; font-weight:500; cursor:pointer; background:none; border:none; padding:0; margin-top:8px; }
.read-more-btn:hover { text-decoration:underline; }

/* Feature 3: Embeds (YouTube/Vimeo) */
.hush-embed { margin:12px 0; border-radius:var(--radius); overflow:hidden; background:#000; }
.hush-embed iframe { width:100%; aspect-ratio:16/9; border:none; display:block; }

/* Feature 6: Reaction Summary Pills */
.hush-reactions { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 12px 0; }
.reaction-pill {
  display:inline-flex; align-items:center; gap:4px;
  padding:4px 12px; background:var(--bg-input); border:1px solid var(--border);
  border-radius:var(--radius-full); font-size:0.75rem; font-weight:500;
  color:var(--text-secondary); transition:all var(--transition-fast);
}
.reaction-pill:hover { background:var(--primary-bg); border-color:var(--primary-light); color:var(--text); }

/* Feature 15: Threading Indicator */
.hush-thread-indicator {
  font-size:0.75rem; color:var(--text-tertiary); margin-bottom:8px;
  padding:4px 12px; background:var(--bg-input); border-radius:var(--radius-full);
  display:inline-block;
}
.hush-thread-indicator a { color:var(--primary); font-weight:500; }
.hush-thread-indicator a:hover { text-decoration:underline; }

/* Action bar */
.hush-actions { display:flex; gap:16px; align-items:center; margin-top:4px; }
.hush-action {
  display:flex; align-items:center; gap:4px; font-size:0.8rem; color:var(--text-tertiary);
  transition:color var(--transition-fast); background:none; border:none; cursor:pointer;
  padding:4px 8px; border-radius:var(--radius-sm);
}
.hush-action:hover { color:var(--primary); background:var(--primary-bg); }
.hush-action svg { width:18px; height:18px; }

/* Code blocks */
.code-block {
    background: var(--bg-secondary, #1e1e1e);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #d4d4d4;
    margin: 8px 0;
    border: 1px solid var(--border);
}
.code-block code {
    font-family: inherit;
    color: inherit;
}
.hush-body p {
    margin: 0 0 8px 0;
}
.hush-body p:last-child {
    margin-bottom: 0;
}
/* Three‑dot menu - FIXED z-index and visibility */
.hush-menu-btn {
  position:absolute; top:16px; right:16px;
  width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  color:var(--text-tertiary); transition:all var(--transition-fast);
}
.hush-menu-btn:hover { background:var(--bg-card-hover); color:var(--text); }

.hush-dropdown {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 9999 !important; /* ensure on top */
  
  /* FIX: Dark glass with warm undertone + slight purple tint */
  background: rgba(20, 18, 28, 0.65);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  
  /* FIX: Warmer border with subtle glow */
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  
  /* FIX: Inner highlight for depth + shadow */
  box-shadow: 
    var(--shadow-xl),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  
  min-width: 200px;
  padding: 6px 0;
}

/* Light theme override - keep it clean */
[data-theme="light"] hush-dropdown {
  background: var(--bg-glass); /* uses light theme's rgba(255,255,255,0.55) */
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
}
.hush-dropdown.active { display:block; animation:fadeInDown 0.2s ease-out; }
.hush-dropdown button {
  display:flex; align-items:center; gap:8px; width:100%; padding:10px 16px;
  font-size:0.85rem; color:var(--text-secondary); transition:all var(--transition-fast);
  background:none; border:none; cursor:pointer; text-align:left;
}
.hush-dropdown button:hover { background:var(--bg-card-hover); color:var(--text); }
.hush-dropdown button.danger { color:#e74c3c; }
.hush-dropdown button.danger:hover { background:rgba(231,76,60,0.1); }

/* Light mode dropdown */
[data-theme="light"] .hush-dropdown {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .hush-dropdown button {
  color: #1A1A2E;
}
[data-theme="light"] .hush-dropdown button:hover {
  background: rgba(0, 0, 0, 0.05);
}

@keyframes fadeInDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

/* Pull-to-refresh indicator (Feature 12) */
.pull-indicator {
  text-align:center; padding:12px; font-size:0.85rem; color:var(--text-secondary);
  animation:fadeInDown 0.3s ease-out;
}

/* ----- Ad in feed ----- */
.ad-in-feed { padding:16px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius); text-align:center; color:var(--text-tertiary); font-size:0.8rem; }
.ad-placeholder { padding:20px; background:var(--bg-card); border-radius:var(--radius-sm); }

/* ============================================================
   COMPOSER MODAL (with Emoji Picker & Drafts)
   ============================================================ */
.composer-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.7); backdrop-filter:blur(12px); z-index:300; display:flex; align-items:center; justify-content:center; padding:20px; opacity:0; pointer-events:none; transition:opacity var(--transition); }
.composer-overlay.active { opacity:1; pointer-events:auto; }
.composer-modal { background:var(--bg-glass); backdrop-filter:blur(40px); border:1px solid var(--border); border-radius:var(--radius-xl); width:100%; max-width:560px; box-shadow:var(--shadow-xl); overflow:hidden; }
.composer-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); }
.composer-header h3 { font-size:1.1rem; font-weight:700; }
.composer-close { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--bg-input); border:1px solid var(--border); transition:all var(--transition-fast); }
.composer-close:hover { background:var(--bg-card-hover); }
.composer-body { padding:20px; position:relative; }
.composer-textarea { width:100%; min-height:120px; padding:14px 16px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius); font-size:0.95rem; resize:vertical; outline:none; transition:all var(--transition); }
.composer-textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-bg); }

/* Feature 5: Emoji Picker Button & Picker - FIXED position */
.emoji-picker-btn {
  position: relative !important;
  bottom: auto !important;
  right: auto !important;
  margin-left: auto;
  margin-top: 8px;
  width:40px; height:40px; border-radius:50%; background:var(--primary-bg);
  border:1px solid var(--border); font-size:1.2rem; transition:all var(--transition-fast);
  display:flex; align-items:center; justify-content:center;
}
.emoji-picker-btn:hover { background:var(--primary-bg-hover); transform:scale(1.05); }

@media (max-width: 767px) {
  .emoji-picker-btn {
    position: absolute !important;
    bottom: 10px !important;
    right: 10px !important;
    width: 36px;
    height: 36px;
  }
}

.emoji-picker {
  background:var(--bg-glass); backdrop-filter:blur(30px); -webkit-backdrop-filter:blur(30px);
  border:1px solid var(--border); border-radius:var(--radius);
  padding:12px; display:grid; grid-template-columns:repeat(6,1fr); gap:6px;
  box-shadow:var(--shadow-lg); z-index:9999;
}
.emoji-picker span {
  font-size:1.6rem; cursor:pointer; padding:6px; border-radius:var(--radius-sm);
  text-align:center; transition:all var(--transition-fast);
}
.emoji-picker span:hover { background:var(--primary-bg); transform:scale(1.2); }

.composer-options { display:flex; gap:16px; margin-top:16px; flex-wrap:wrap; }
.composer-category-select, .composer-visibility-select { flex:1; min-width:150px; }
.composer-category-select label, .composer-visibility-select label { display:block; font-size:0.75rem; font-weight:600; margin-bottom:6px; color:var(--text-secondary); }
.composer-category-select select, .composer-category-select input { width:100%; padding:10px 14px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius); font-size:0.85rem; outline:none; }
.visibility-toggle { display:flex; gap:4px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius); padding:4px; }
.vis-option { flex:1; display:flex; align-items:center; justify-content:center; gap:6px; padding:8px 12px; border-radius:var(--radius-sm); font-size:0.8rem; font-weight:600; transition:all var(--transition-fast); cursor:pointer; }
.vis-option svg { width:18px; height:18px; }
.vis-option.active { background:var(--primary); color:#fff; }
.vis-option:not(.active):hover { background:var(--bg-card-hover); }

.composer-footer { display:flex; align-items:center; justify-content:space-between; margin-top:20px; padding-top:16px; border-top:1px solid var(--border); }
.composer-char-count { font-size:0.8rem; color:var(--text-tertiary); transition:color var(--transition-fast); }

/* ============================================================
   REPLY MODAL
   ============================================================ */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.7); backdrop-filter:blur(12px);
  z-index:300; display:flex; align-items:center; justify-content:center; padding:20px;
  opacity:0; pointer-events:none; transition:opacity var(--transition);
}
.modal-overlay.active { opacity:1; pointer-events:auto; }

.reply-modal {
  background:var(--bg-glass); backdrop-filter:blur(40px); -webkit-backdrop-filter:blur(40px);
  border:1px solid var(--border); border-radius:var(--radius-xl);
  width:100%; max-width:520px; max-height:85vh; overflow-y:auto;
  box-shadow:var(--shadow-xl); padding:24px;
}
.modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.modal-header h3 { font-size:1.1rem; font-weight:700; }
.modal-close {
  width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:var(--bg-input); border:1px solid var(--border); font-size:1.2rem;
  transition:all var(--transition-fast);
}
.modal-close:hover { background:var(--bg-card-hover); }
#replyQuotePreview {
  background:var(--bg-secondary); padding:12px; border-radius:var(--radius);
  border-left:3px solid var(--primary); font-size:0.85rem; color:var(--text-secondary);
  margin-bottom:12px;
}
#replyInput {
  width:100%; padding:12px 16px; background:var(--bg-input); border:1px solid var(--border);
  border-radius:var(--radius); color:var(--text); font-size:0.95rem; resize:vertical;
  outline:none; transition:all var(--transition-fast);
}
#replyInput:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-bg); }

/* ============================================================
   HUSH DETAIL MODAL
   ============================================================ */
.hush-modal {
  background:var(--bg-glass); backdrop-filter:blur(40px); border:1px solid var(--border);
  border-radius:var(--radius-xl); width:100%; max-width:520px; max-height:85vh;
  overflow-y:auto; box-shadow:var(--shadow-xl); padding:24px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 20px; border-radius:var(--radius-full); font-weight:600; font-size:0.9rem; transition:all var(--transition); border:none; cursor:pointer; }
.btn-primary { background:var(--purple-gradient); color:#fff; box-shadow:0 4px 20px rgba(124,77,255,0.4); }
.btn-primary:hover { transform:translateY(-2px); box-shadow:0 8px 28px rgba(124,77,255,0.5); }
.btn-primary:disabled { opacity:0.6; cursor:not-allowed; transform:none; }
.btn-outline { background:transparent; border:1px solid var(--border); color:var(--text); }
.btn-outline:hover { border-color:var(--primary); background:var(--primary-bg); }
.btn-danger { background:#e74c3c; color:#fff; }
.btn-sm { padding:6px 14px; font-size:0.8rem; }

/* ============================================================
   TOAST
   ============================================================ */
#toast-container { position:fixed; bottom:90px; left:50%; transform:translateX(-50%); z-index:9999; display:flex; flex-direction:column; align-items:center; gap:8px; pointer-events:none; }
.toast { padding:12px 24px; border-radius:var(--radius-full); font-weight:600; font-size:0.85rem; background:var(--bg-glass); backdrop-filter:blur(20px); color:var(--text); border:1px solid var(--border); box-shadow:var(--shadow-lg); transform:translateY(20px); opacity:0; transition:all 0.3s cubic-bezier(0.34,1.56,0.64,1); }
.toast.show { transform:translateY(0); opacity:1; }
.toast-success { border-color:#2ecc71; }
.toast-error { border-color:#e74c3c; }
.toast-warning { border-color:#f59e0b; }

/* ============================================================
   RIGHT INSIGHTS PANEL
   ============================================================ */
.insights {
  display:none; width:var(--insights-width); flex-shrink:0;
  margin:12px 12px 12px 0; background:transparent; border:none; padding:0;
  overflow-y:auto;
}
.insights .glass-panel { padding:20px 16px; height:100%; }
.insights-card { background:var(--bg-card); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); border:1px solid var(--border); border-radius:var(--radius); padding:16px; margin-bottom:16px; }
.insights-card-title { font-size:0.8rem; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; color:var(--text-tertiary); margin-bottom:12px; display:flex; align-items:center; gap:6px; }
.insights-stats-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.insight-stat { text-align:center; padding:10px 8px; background:rgba(255,255,255,0.03); border-radius:var(--radius-sm); }
.insight-value { display:block; font-size:1.4rem; font-weight:800; color:var(--primary); }
.insight-label { font-size:0.7rem; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:0.3px; }
.trend-list { display:flex; flex-wrap:wrap; gap:6px; }
.trend-tag { padding:4px 12px; background:var(--primary-bg); color:var(--primary); border-radius:var(--radius-full); font-size:0.7rem; font-weight:600; cursor:pointer; transition:all var(--transition-fast); }
.trend-tag:hover { background:var(--primary); color:#fff; transform:translateY(-1px); }
.insights-footer { text-align:center; font-size:0.7rem; color:var(--text-tertiary); margin-top:12px; padding-top:12px; border-top:1px solid var(--border-light); }
.insights-footer a { color:var(--text-secondary); margin:0 4px; transition:color var(--transition-fast); }
.insights-footer a:hover { color:var(--primary); }
.insights-copy { margin-top:4px; }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.mobile-nav {
  position:fixed; bottom:16px; left:50%; transform:translateX(-50%);
  z-index:100; display:flex; align-items:center; justify-content:center;
  gap:4px; padding:6px 12px;
  background:rgba(18,18,30,0.7); backdrop-filter:blur(40px); -webkit-backdrop-filter:blur(40px);
  border:1px solid var(--border); border-radius:40px;
  box-shadow:var(--shadow-xl);
}
.mobile-nav-item { position:relative; display:flex; flex-direction:column; align-items:center; gap:2px; padding:8px 14px; border-radius:var(--radius); color:var(--text-tertiary); font-size:0.65rem; font-weight:500; transition:all var(--transition-fast); }
.mobile-nav-item.active { color:var(--primary); }
.mobile-nav-item svg { width:24px; height:24px; }
.mobile-nav-label { font-size:0.6rem; }
.mobile-nav-badge { position:absolute; top:2px; right:2px; width:16px; height:16px; background:#e74c3c; color:#fff; font-size:0.55rem; font-weight:700; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.mobile-nav-compose {
  width:48px; height:48px; border-radius:50%; background:var(--purple-gradient); color:#fff;
  display:flex; align-items:center; justify-content:center; margin-top:-20px;
  box-shadow:0 4px 20px rgba(124,77,255,0.5); transition:all var(--transition);
}
.mobile-nav-compose:hover { transform:scale(1.08); }

/* ============================================================
   MOBILE DRAWER - FIXED light mode
   ============================================================ */
.mobile-drawer-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:200; opacity:0; pointer-events:none; transition:opacity var(--transition); }
.mobile-drawer-overlay.open { opacity:1; pointer-events:auto; }
.mobile-drawer {
  position:fixed; top:0; left:-320px; width:320px; max-width:85vw; height:100vh;
  background:var(--bg-glass); backdrop-filter:blur(40px); -webkit-backdrop-filter:blur(40px);
  z-index:201; display:flex; flex-direction:column; box-shadow:var(--shadow-xl);
  transition:left var(--transition); overflow-y:auto;
}
.mobile-drawer.open { left:0; }
.mobile-drawer-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); }
.mobile-drawer-logo { display:flex; align-items:center; gap:10px; font-weight:800; font-size:1.2rem; }
.mobile-drawer-close { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--bg-input); border:1px solid var(--border); }
.mobile-drawer-user-section { display:flex; align-items:center; gap:12px; padding:16px 20px; border-bottom:1px solid var(--border); }
.drawer-avatar { width:40px; height:40px; border-radius:50%; background:var(--primary-bg); display:flex; align-items:center; justify-content:center; font-size:1.2rem; }
.drawer-username { font-weight:600; font-size:0.9rem; }
.drawer-plan { font-size:0.7rem; color:var(--text-tertiary); }
.mobile-drawer-nav { display:flex; flex-direction:column; padding:12px 16px; gap:4px; flex:1; }
.mobile-drawer-nav a { display:flex; align-items:center; gap:10px; padding:12px 16px; border-radius:var(--radius); font-size:0.95rem; font-weight:500; transition:background var(--transition-fast); }
.mobile-drawer-nav a:hover { background:var(--bg-card-hover); }
.mobile-drawer-nav a.active { background:var(--primary-bg); color:var(--primary); }
.mobile-drawer-nav svg { width:22px; height:22px; }
.mobile-drawer-footer { padding:16px 20px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:12px; }
.drawer-theme-row { display:flex; align-items:center; justify-content:space-between; }
.drawer-theme-btn { display:flex; gap:4px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-full); padding:4px; }
.theme-option { display:flex; align-items:center; gap:6px; padding:6px 14px; border-radius:var(--radius-full); font-size:0.8rem; cursor:pointer; transition:all var(--transition); color:var(--text-secondary); }
.theme-option svg { width:18px; height:18px; }
.theme-option-dark { font-weight:700; background:var(--bg-card); color:var(--text); }
[data-theme="light"] .theme-option-dark { font-weight:400; background:transparent; color:var(--text-secondary); }
[data-theme="light"] .theme-option-light { font-weight:700; background:var(--bg-card); color:var(--text); }
.drawer-logout-btn { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; padding:12px; background:rgba(231,76,60,0.08); color:#e74c3c; border:1px solid rgba(231,76,60,0.15); border-radius:var(--radius); font-weight:600; font-size:0.9rem; transition:all var(--transition); }
.drawer-logout-btn:hover { background:rgba(231,76,60,0.15); }

/* Light mode drawer overrides */
[data-theme="light"] .mobile-drawer {
  background: rgba(255, 255, 255, 0.95);
}
[data-theme="light"] .mobile-drawer-nav a {
  color: #1A1A2E;
}
[data-theme="light"] .mobile-drawer-nav a:hover {
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .mobile-drawer-nav a.active {
  background: var(--primary-bg);
  color: var(--primary);
}

/* ============================================================
   PAGE SPECIFIC STYLES (Profile, Topics, Premium, Settings, etc.)
   ============================================================ */

/* Profile Page */
.profile-page { max-width:800px; margin:0 auto; }
.profile-header-card { display:flex; align-items:center; gap:20px; padding:24px; background:var(--bg-card); backdrop-filter:blur(20px); border:1px solid var(--border); border-radius:var(--radius-lg); margin-bottom:20px; }
.profile-avatar-large { width:80px; height:80px; border-radius:50%; background:var(--purple-gradient); display:flex; align-items:center; justify-content:center; font-size:2.5rem; color:#fff; flex-shrink:0; }
.profile-plan-badge { display:inline-block; padding:4px 14px; border-radius:var(--radius-full); font-size:0.8rem; font-weight:600; }
.profile-plan-badge.premium { background:rgba(251,191,36,0.15); color:#f59e0b; }
.profile-plan-badge.free { background:var(--bg-secondary); color:var(--text-secondary); }
.profile-section-card { background:var(--bg-card); backdrop-filter:blur(20px); border:1px solid var(--border); border-radius:var(--radius); padding:20px; margin-bottom:16px; }

/* Topics Page */
.topics-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:12px; margin-bottom:24px; }
.topic-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:20px 16px; text-align:center; transition:all var(--transition-fast); display:block; color:var(--text); text-decoration:none; }
.topic-card:hover { border-color:var(--primary); transform:translateY(-2px); box-shadow:var(--shadow); }
.topic-name { font-weight:700; color:var(--primary); font-size:1rem; display:block; }

/* Premium Page */
.pricing-cards { display:flex; gap:24px; flex-wrap:wrap; justify-content:center; }
.pricing-card { flex:1; min-width:260px; max-width:360px; background:var(--bg-card); backdrop-filter:blur(20px); border:1px solid var(--border); border-radius:var(--radius-lg); padding:32px 24px; text-align:center; position:relative; }
.pricing-card.featured { border:2px solid var(--primary); box-shadow:0 0 30px rgba(124,77,255,0.2); }
.price { font-size:2.5rem; font-weight:800; margin:12px 0; }
.price span { font-size:1rem; color:var(--text-secondary); }
.premium-features ul { list-style:none; padding:0; }
.premium-features li { padding:6px 0; border-bottom:1px solid var(--border-light); font-size:0.9rem; color:var(--text-secondary); }

/* Settings Page */
.settings-section { background:var(--bg-card); backdrop-filter:blur(20px); border:1px solid var(--border); border-radius:var(--radius); padding:24px; margin-bottom:16px; }
.settings-section h3 { font-size:1.1rem; font-weight:700; margin-bottom:16px; display:flex; align-items:center; gap:8px; }
.setting-toggle { display:flex; align-items:center; justify-content:space-between; padding:8px 0; }
.setting-toggle label { font-size:0.9rem; }
.setting-toggle input[type="checkbox"] { appearance:none; width:44px; height:24px; background:var(--border); border-radius:12px; position:relative; cursor:pointer; transition:background 0.2s; }
.setting-toggle input[type="checkbox"]:checked { background:var(--primary); }
.setting-toggle input[type="checkbox"]::after { content:''; position:absolute; top:2px; left:2px; width:20px; height:20px; background:#fff; border-radius:50%; transition:left 0.2s; }
.setting-toggle input[type="checkbox"]:checked::after { left:22px; }

/* ----- Utility & Animations ----- */
.fade-in { animation:fadeInUp 0.5s ease-out forwards; }
@keyframes fadeInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

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

/* ----- Accessibility ----- */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration:0.01ms !important; transition-duration:0.01ms !important; } }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (min-width:768px) {
  .header-search { display:flex; }
  .page-content { padding:24px; }
}
@media (min-width:1024px) {
  .sidebar { display:flex; }
  .insights { display:block; }
  .mobile-nav { display:none; }
  .header-drawer-btn { display:none; }
  .page-content { max-width:720px; margin:0 auto; }
}
@media (min-width:1440px) {
  .page-content { max-width:800px; }
}

/* ----- Mobile feed composer bar (below tabs) ----- */
.feed-composer-bar {
  margin-bottom:16px;
}
.feed-composer-btn {
  width:100%; padding:12px 16px; background:var(--bg-input);
  border:1px solid var(--border); border-radius:var(--radius-full);
  display:flex; align-items:center; gap:10px; color:var(--text-secondary);
  font-size:0.9rem; transition:all var(--transition-fast);
}
.feed-composer-btn:hover { background:var(--bg-card-hover); border-color:var(--primary-light); color:var(--text); }
.feed-composer-btn span { font-size:1.1rem; }

/* ----- Additional fixes for light mode components ----- */
[data-theme="light"] .reply-modal {
  background: rgba(255, 255, 255, 0.85);
}
[data-theme="light"] .composer-modal {
  background: rgba(255, 255, 255, 0.85);
}
[data-theme="light"] .emoji-picker {
  background: rgba(255, 255, 255, 0.95);
}