/* =============================================
   FanVault - Master Stylesheet
   Themes: dark (default), light, rose, ocean, purple
   ============================================= */

/* ---- CSS Custom Properties / Themes ---- */
:root,
[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-tertiary: #1a1a24;
  --bg-card: #14141e;
  --bg-hover: #1e1e2a;
  --bg-input: #1a1a24;
  --bg-modal: #0f0f18;
  --border: #2a2a3a;
  --border-subtle: #1e1e2e;
  --accent: #c084fc;
  --accent-hover: #d8b4fe;
  --accent-dim: rgba(192, 132, 252, 0.15);
  --accent-gradient: linear-gradient(135deg, #c084fc 0%, #818cf8 100%);
  --accent2: #818cf8;
  --text-primary: #f1f0f7;
  --text-secondary: #a09db8;
  --text-muted: #6b6888;
  --text-on-accent: #fff;
  --like: #f472b6;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.4);
  --scrollbar: #2a2a3a;
  --scrollbar-thumb: #4a4a6a;
  --verified: #818cf8;
  --story-ring: linear-gradient(135deg, #c084fc, #818cf8, #f472b6);
}

[data-theme="light"] {
  --bg-primary: #f5f4fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0eff9;
  --bg-card: #ffffff;
  --bg-hover: #f5f4fb;
  --bg-input: #f5f4fb;
  --bg-modal: #ffffff;
  --border: #e2e0f0;
  --border-subtle: #ece9f8;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-dim: rgba(139, 92, 246, 0.1);
  --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  --accent2: #6366f1;
  --text-primary: #1a1830;
  --text-secondary: #4a4870;
  --text-muted: #9490b8;
  --text-on-accent: #fff;
  --like: #ec4899;
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --shadow: 0 4px 24px rgba(100,80,200,0.08);
  --shadow-card: 0 2px 12px rgba(100,80,200,0.06);
  --scrollbar: #e2e0f0;
  --scrollbar-thumb: #c4c0e8;
  --verified: #6366f1;
  --story-ring: linear-gradient(135deg, #8b5cf6, #6366f1, #ec4899);
}

[data-theme="rose"] {
  --bg-primary: #0d080c;
  --bg-secondary: #150e13;
  --bg-tertiary: #1e1019;
  --bg-card: #180d16;
  --bg-hover: #221220;
  --bg-input: #1e1019;
  --bg-modal: #120a10;
  --border: #3a1a30;
  --border-subtle: #2a1222;
  --accent: #fb7185;
  --accent-hover: #f9a8d4;
  --accent-dim: rgba(251, 113, 133, 0.15);
  --accent-gradient: linear-gradient(135deg, #fb7185 0%, #f472b6 100%);
  --accent2: #f472b6;
  --text-primary: #fde8ee;
  --text-secondary: #c49aaa;
  --text-muted: #7d5565;
  --text-on-accent: #fff;
  --like: #fb7185;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --shadow: 0 4px 24px rgba(0,0,0,0.6);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.5);
  --scrollbar: #3a1a30;
  --scrollbar-thumb: #6a2a4a;
  --verified: #f472b6;
  --story-ring: linear-gradient(135deg, #fb7185, #f472b6, #fbbf24);
}

[data-theme="ocean"] {
  --bg-primary: #040d18;
  --bg-secondary: #081525;
  --bg-tertiary: #0d1e33;
  --bg-card: #0a1a2e;
  --bg-hover: #111f38;
  --bg-input: #0d1e33;
  --bg-modal: #070f1e;
  --border: #1a3050;
  --border-subtle: #122440;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-dim: rgba(56, 189, 248, 0.15);
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #22d3ee 100%);
  --accent2: #22d3ee;
  --text-primary: #e0f4ff;
  --text-secondary: #8ab4d0;
  --text-muted: #456880;
  --text-on-accent: #020d16;
  --like: #f472b6;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --shadow: 0 4px 24px rgba(0,0,0,0.6);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.5);
  --scrollbar: #1a3050;
  --scrollbar-thumb: #2a5080;
  --verified: #38bdf8;
  --story-ring: linear-gradient(135deg, #38bdf8, #22d3ee, #34d399);
}

[data-theme="purple"] {
  --bg-primary: #07030f;
  --bg-secondary: #0d0618;
  --bg-tertiary: #150c25;
  --bg-card: #100820;
  --bg-hover: #1c0e30;
  --bg-input: #150c25;
  --bg-modal: #0a0515;
  --border: #2e1250;
  --border-subtle: #220d3c;
  --accent: #a855f7;
  --accent-hover: #c084fc;
  --accent-dim: rgba(168, 85, 247, 0.15);
  --accent-gradient: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  --accent2: #7c3aed;
  --text-primary: #ede8ff;
  --text-secondary: #a890cc;
  --text-muted: #6a5090;
  --text-on-accent: #fff;
  --like: #f472b6;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --shadow: 0 4px 24px rgba(0,0,0,0.7);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.6);
  --scrollbar: #2e1250;
  --scrollbar-thumb: #5a1e9a;
  --verified: #a855f7;
  --story-ring: linear-gradient(135deg, #a855f7, #7c3aed, #f472b6);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }
p { color: var(--text-secondary); }

/* ---- Layout ---- */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  gap: 0;
}

.sidebar-left {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main-content {
  min-height: 100vh;
  border-right: 1px solid var(--border);
}

.sidebar-right {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 16px;
  background: var(--bg-secondary);
}

/* ---- Logo ---- */
.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 20px;
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.app-logo .logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}

/* ---- Navigation ---- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s;
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover, .nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-item.active { font-weight: 600; }

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--text-on-accent);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 14px 4px;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ---- User mini profile in nav ---- */
.nav-user-card {
  margin-top: auto;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid var(--border);
}

.nav-user-card:hover { background: var(--bg-hover); }

.nav-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.nav-user-info { flex: 1; min-width: 0; }
.nav-user-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.nav-user-handle {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--text-on-accent);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-dim);
  color: var(--text-on-accent);
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: rgba(248,113,113,0.15);
  color: var(--error);
  border: 1px solid rgba(248,113,113,0.3);
}

.btn-danger:hover { background: rgba(248,113,113,0.25); }

.btn-icon {
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
}

.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-card); }
.card-padded { padding: 20px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

.form-error {
  color: var(--error);
  font-size: 12px;
  margin-top: 4px;
}

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

/* ---- Input with icon ---- */
.input-group { position: relative; }
.input-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-group .form-control { padding-left: 42px; }

/* ---- Post Card ---- */
.post-card {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  padding: 20px;
  transition: background 0.2s;
}

.post-card:hover { background: var(--bg-hover); }

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.post-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
}

.post-meta { flex: 1; }
.post-author {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.post-author:hover { color: var(--accent); }

.verified-badge {
  color: var(--verified);
  display: inline-flex;
}

.post-time {
  font-size: 13px;
  color: var(--text-muted);
}

.post-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Media Grid ---- */
.media-grid {
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  display: grid;
  gap: 2px;
}

.media-grid.count-1 { grid-template-columns: 1fr; }
.media-grid.count-2 { grid-template-columns: 1fr 1fr; }
.media-grid.count-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.media-grid.count-3 .media-item:first-child { grid-row: 1 / 3; }
.media-grid.count-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.media-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-tertiary);
}

.media-item img, .media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
  max-height: 400px;
}

.media-item:hover img, .media-item:hover video { transform: scale(1.02); }

.media-item .play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
}

.media-item .play-btn svg {
  width: 56px;
  height: 56px;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.media-more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

/* ---- Locked Post ---- */
.locked-overlay {
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 40px 20px;
  text-align: center;
  position: relative;
}

.locked-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: var(--accent);
}

/* ---- Post Actions ---- */
.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 14px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover { background: var(--bg-hover); }
.action-btn.liked { color: var(--like); }
.action-btn.liked svg { fill: currentColor; }
.action-btn.bookmarked { color: var(--accent); }

.action-btn-spacer { margin-left: auto; }

/* ---- Story Ring ---- */
.story-ring {
  padding: 3px;
  background: var(--story-ring);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.story-ring:hover { transform: scale(1.05); }

.story-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-primary);
  display: block;
}

.story-ring.viewed {
  background: var(--border);
}

/* ---- Stories Bar ---- */
.stories-bar {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
  scrollbar-width: none;
}

.stories-bar::-webkit-scrollbar { display: none; }

.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: pointer;
}

.story-item .story-ring {
  width: 66px;
  height: 66px;
}

.story-name {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 68px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-add {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent);
  transition: all 0.2s;
}

.story-add:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* ---- New Post Composer ---- */
.composer {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.composer-top {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
}

.composer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.composer-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  resize: none;
  outline: none;
  min-height: 80px;
  font-family: inherit;
}

.composer-textarea::placeholder { color: var(--text-muted); }

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.composer-tool {
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s;
}

.composer-tool:hover { background: var(--accent-dim); }

.composer-price {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
}

/* ---- Profile Page ---- */
.profile-cover {
  height: 220px;
  background: var(--bg-tertiary);
  position: relative;
  overflow: hidden;
}

.profile-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.6) 100%);
}

.profile-info-section {
  padding: 0 24px 20px;
  position: relative;
}

.profile-avatar-wrap {
  position: relative;
  display: inline-block;
  margin-top: -50px;
  margin-bottom: 12px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-primary);
  display: block;
}

.profile-name {
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-handle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 12px;
}

.profile-bio {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 14px;
  max-width: 500px;
}

.profile-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
}

.profile-stat { text-align: center; }
.profile-stat-value { font-size: 18px; font-weight: 700; }
.profile-stat-label { font-size: 12px; color: var(--text-muted); }

.profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Creator Card (sidebar) ---- */
.creator-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  transition: background 0.2s;
  cursor: pointer;
}

.creator-card:hover { background: var(--bg-hover); }

.creator-avatar {
  position: relative;
  flex-shrink: 0;
}

.creator-avatar img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
}

.creator-info { flex: 1; min-width: 0; }
.creator-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creator-handle {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
}

.tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-width: 500px;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.2s;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-backdrop.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 18px; font-weight: 700; }

/* ---- Toast Notifications ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  font-size: 14px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.info { border-left: 4px solid var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ---- Theme Switcher ---- */
.theme-switcher {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px;
}

.theme-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
  position: relative;
}

.theme-dot:hover { transform: scale(1.15); }
.theme-dot.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-primary); }

.theme-dot[data-theme="dark"] { background: linear-gradient(135deg, #c084fc, #818cf8); }
.theme-dot[data-theme="light"] { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.theme-dot[data-theme="rose"] { background: linear-gradient(135deg, #fb7185, #f472b6); }
.theme-dot[data-theme="ocean"] { background: linear-gradient(135deg, #38bdf8, #22d3ee); }
.theme-dot[data-theme="purple"] { background: linear-gradient(135deg, #a855f7, #7c3aed); }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-success { background: rgba(52,211,153,0.15); color: var(--success); }
.badge-warning { background: rgba(251,191,36,0.15); color: var(--warning); }
.badge-error { background: rgba(248,113,113,0.15); color: var(--error); }
.badge-muted { background: var(--bg-tertiary); color: var(--text-muted); }

/* ---- Subscription Box ---- */
.sub-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}

.sub-box h3 { font-size: 18px; margin-bottom: 6px; }
.sub-box p { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }

.sub-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.sub-plan {
  padding: 12px 8px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  background: var(--bg-card);
}

.sub-plan:hover, .sub-plan.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.sub-plan .plan-price { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.sub-plan .plan-period { font-size: 11px; color: var(--text-muted); }
.sub-plan .plan-save { font-size: 10px; font-weight: 600; color: var(--success); }

/* ---- Messages ---- */
.message-bubble {
  max-width: 72%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.message-bubble.sent {
  background: var(--accent-gradient);
  color: var(--text-on-accent);
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

.message-bubble.received {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message-time { font-size: 11px; opacity: 0.65; margin-top: 4px; display: block; }

/* ---- Wallet Card ---- */
.wallet-card {
  background: var(--accent-gradient);
  border-radius: 20px;
  padding: 28px;
  color: var(--text-on-accent);
  position: relative;
  overflow: hidden;
}

.wallet-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

.wallet-balance { font-size: 36px; font-weight: 900; margin: 8px 0; }

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.stat-value { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-change { font-size: 12px; margin-top: 6px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--error); }

/* ---- Search Bar ---- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  transition: border-color 0.2s;
}

.search-bar:focus-within { border-color: var(--accent); }
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ---- Loading Skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}

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

/* ---- Page Header ---- */
.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(10px);
}

.page-header-title { font-size: 18px; font-weight: 700; }

/* ---- Checkout ---- */
.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
}

/* ---- Auth pages ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px;
}

.auth-logo {
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 28px;
  color: var(--text-primary);
}

.auth-logo span { color: var(--accent); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Dropdown ---- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  min-width: 180px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
  animation: dropIn 0.15s ease;
}

.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu { display: block; }

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger { color: var(--error); }
.dropdown-item.danger:hover { background: rgba(248,113,113,0.1); }

/* ---- Media Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.lightbox.active { opacity: 1; pointer-events: auto; }
.lightbox img, .lightbox video {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Tip Box ---- */
.tip-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tip-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tip-btn:hover, .tip-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* ---- Progress bar ---- */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  transition: width 0.4s;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 220px 1fr 280px; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 70px 1fr; }
  .sidebar-right { display: none; }
  .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 14px; }
  .nav-user-info { display: none; }
  .app-logo .logo-text { display: none; }
  .sidebar-left { padding: 12px 8px; }
}

@media (max-width: 600px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar-left { 
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    border-top: 1px solid var(--border);
    border-right: none;
    z-index: 100;
    padding: 8px;
  }
  .nav-section-title, .nav-divider, .nav-user-card { display: none; }
  body { padding-bottom: 80px; }
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse { animation: pulse 2s infinite; }

/* ---- Utility ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relative { position: relative; }
.rounded-full { border-radius: 9999px; }
