/* ==========================================================================
   PRATILIPI FULL CLONE - COMPREHENSIVE STYLESHEET
   Supports: 80 APK Activities, 5-Tab Bottom Nav, Floating Audio Series Player,
   Superfan Chatrooms, Quote Sharing Studio, 12 Language Selector, Writer Studio
   ========================================================================== */

:root {
  /* Brand Palette */
  --primary: #E53935;
  --primary-hover: #D32F2F;
  --primary-light: #FFEBEE;
  --primary-glow: rgba(229, 57, 53, 0.25);
  --accent-gold: #F59E0B;
  --accent-blue: #3B82F6;
  --accent-emerald: #10B981;
  --accent-purple: #8B5CF6;

  /* Typography */
  --font-main: 'Noto Sans Tamil', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Noto Sans Tamil', sans-serif;

  /* Dimensions & Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 24px var(--primary-glow);
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Mode (Default) */
[data-theme="dark"] {
  --bg-page: #0B0F19;
  --bg-surface: #151D2F;
  --bg-surface-elevated: #1E293B;
  --bg-surface-hover: #26354D;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --glass-bg: rgba(15, 23, 42, 0.88);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* Light Mode */
[data-theme="light"] {
  --bg-page: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F1F5F9;
  --bg-surface-hover: #E2E8F0;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dim: #94A3B8;
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(0, 0, 0, 0.08);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
}

body.has-bottom-nav {
  padding-bottom: 70px;
}

body.has-audio-bar {
  padding-bottom: 135px;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; color: inherit; }

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), #FF7043);
  color: #FFF;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: transform var(--transition-fast);
}

.logo-icon svg { width: 24px; height: 24px; }
.brand-logo:hover .logo-icon { transform: rotate(-6deg) scale(1.05); }

.brand-text { display: flex; flex-direction: column; }
.brand-tamil { font-size: 1.4rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.brand-sub { font-family: var(--font-display); font-size: 0.65rem; letter-spacing: 0.25em; color: var(--primary); font-weight: 700; }

.search-box {
  position: relative;
  max-width: 440px;
  width: 100%;
}

.search-box input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.65rem 2.2rem 0.65rem 2.6rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--primary);
  background: var(--bg-surface-elevated);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-pill-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-pill-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
}

.view-switcher-pill {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-full);
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-btn svg { width: 16px; height: 16px; }
.view-btn.active {
  background: linear-gradient(135deg, var(--primary), #FF5252);
  color: #FFFFFF;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.admin-badge {
  font-size: 0.6rem;
  background: #FEF08A;
  color: #854D0E;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 800;
}

.view-btn.active .admin-badge { background: rgba(255, 255, 255, 0.25); color: #FFF; }

.coin-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--accent-gold);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.coin-badge:hover { transform: scale(1.04); }

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.theme-toggle-btn .sun-icon { display: none; width: 18px; height: 18px; }
.theme-toggle-btn .moon-icon { display: block; width: 18px; height: 18px; }
[data-theme="light"] .theme-toggle-btn .sun-icon { display: block; }
[data-theme="light"] .theme-toggle-btn .moon-icon { display: none; }

.user-avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid var(--primary);
  cursor: pointer;
}

.user-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #FF5252);
  color: #FFF;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #E53935);
  box-shadow: 0 6px 20px rgba(229, 57, 53, 0.4);
  transform: translateY(-1px);
}
.btn-secondary { background: var(--bg-surface-elevated); border: 1px solid var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background: var(--bg-surface-hover); border-color: var(--text-dim); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(229, 57, 53, 0.05); }

.btn-audio-play {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #FFF;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-audio-play:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.link-btn { background: none; border: none; color: var(--primary); font-weight: 600; cursor: pointer; font-size: 0.85rem; }
.link-btn:hover { text-decoration: underline; }

.styled-select, .styled-select-sm {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}
.styled-select-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; border-radius: var(--radius-sm); }

.view-container { display: none; opacity: 0; transition: opacity var(--transition-normal); }
.view-container.active-view { display: block; opacity: 1; }
.hidden { display: none !important; }

/* User View Tabs */
.user-sub-tab { display: none; }
.user-sub-tab.active-sub-tab { display: block; }

#userViewContainer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
}

/* Hero Carousel */
.hero-carousel-section { margin-bottom: 1.75rem; }
.hero-banner-card {
  position: relative;
  background: linear-gradient(135deg, rgba(229, 57, 53, 0.08), rgba(15, 23, 42, 0.6)), var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.hero-badge-tag {
  position: absolute;
  top: 1.25rem;
  left: 2.25rem;
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid rgba(229, 57, 53, 0.3);
  color: #FF5252;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-content { flex: 1; padding-top: 1.5rem; max-width: 680px; }
.hero-title { font-size: 2.1rem; font-weight: 800; line-height: 1.2; margin-bottom: 0.75rem; color: var(--text-main); }
.hero-desc { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 1.25rem; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.meta-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.meta-badge { padding: 0.2rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 700; }
.genre-badge { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }

.hero-cover-wrap { perspective: 1000px; }
.hero-book-cover {
  width: 220px;
  height: 310px;
  border-radius: 8px 16px 16px 8px;
  box-shadow: -8px 12px 30px rgba(0, 0, 0, 0.5), inset 4px 0 8px rgba(255, 255, 255, 0.15);
  transform: rotateY(-12deg) rotateX(4deg);
  transition: transform var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.hero-book-cover:hover { transform: rotateY(-4deg) rotateX(2deg) translateY(-8px); }

.cover-art {
  width: 100%;
  height: 100%;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 6px solid rgba(0, 0, 0, 0.4);
}
.cover-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: 0.5;
}
.cover-title-group { position: relative; z-index: 2; margin-top: auto; }
.cover-tag { display: block; font-size: 0.65rem; color: #FBBF24; letter-spacing: 0.1em; font-weight: 800; margin-bottom: 0.35rem; }
.cover-title-text { display: block; font-size: 1.25rem; font-weight: 800; color: #FFF; line-height: 1.25; margin-bottom: 0.35rem; }
.cover-author-text { font-size: 0.85rem; color: #CBD5E1; }

/* Streak Strip */
.streak-strip {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.1), rgba(229, 57, 53, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.5rem;
  margin-bottom: 1.75rem;
}
.streak-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap; }
.streak-icon-wrap { font-size: 1.8rem; }
.streak-info { flex: 1; font-size: 0.88rem; }
.streak-info strong { color: var(--accent-gold); }
.streak-info span { color: var(--text-muted); }
.streak-progress-box { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; font-weight: 700; }
.streak-bar { width: 120px; height: 8px; background: var(--bg-surface-elevated); border-radius: var(--radius-full); overflow: hidden; }
.streak-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-gold), var(--primary)); border-radius: var(--radius-full); }

/* Quick Feature Shortcuts */
.portal-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.portal-shortcut-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}
.portal-shortcut-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.shortcut-icon { font-size: 1.8rem; }
.shortcut-text strong { display: block; font-size: 0.95rem; color: var(--text-main); }
.shortcut-text small { color: var(--text-muted); font-size: 0.78rem; }

/* Category Pills */
.categories-nav-section { margin-bottom: 2rem; }
.categories-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
}
.categories-container::-webkit-scrollbar { display: none; }
.cat-pill {
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.cat-pill:hover { background: var(--bg-surface-hover); color: var(--text-main); }
.cat-pill.active { background: var(--primary); color: #FFF; border-color: var(--primary); box-shadow: 0 4px 12px var(--primary-glow); }

/* Stories Catalog Section */
.section-header-row { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; }
.section-title { font-size: 1.5rem; font-weight: 800; }
.section-sub { font-size: 0.9rem; color: var(--text-muted); }
.catalog-sort-box { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: var(--text-muted); }

.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.story-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.story-card:hover {
  transform: translateY(-6px);
  border-color: rgba(229, 57, 53, 0.4);
  box-shadow: var(--shadow-md), 0 0 16px var(--primary-glow);
}

.card-cover-container {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  margin-bottom: 0.75rem;
}
.card-cover-inner {
  width: 100%;
  height: 100%;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 4px solid rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-normal);
}
.story-card:hover .card-cover-inner { transform: scale(1.03); }

.card-genre-pill {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.6);
  color: #FFF;
}
.card-cover-title { font-size: 1.05rem; font-weight: 800; color: #FFF; line-height: 1.25; margin-bottom: 0.2rem; }
.card-cover-author { font-size: 0.78rem; color: #E2E8F0; }

.card-info { display: flex; flex-direction: column; flex: 1; }
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-author-row { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.verified-icon { color: #38BDF8; font-size: 0.75rem; }
.card-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}
.card-stat { display: inline-flex; align-items: center; gap: 0.25rem; }
.card-badge-superfan {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFF;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Page Headers */
.page-header-box { margin-bottom: 1.75rem; }
.page-title { font-size: 1.65rem; font-weight: 800; margin-bottom: 0.25rem; }
.page-sub { font-size: 0.9rem; color: var(--text-muted); }

/* Library Sub-Tab */
.library-tabs-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}
.lib-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: var(--radius-md);
}
.lib-tab-btn.active {
  background: rgba(229, 57, 53, 0.1);
  color: var(--primary);
}

.library-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.lib-card-horizontal {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  align-items: center;
}
.lib-thumb { width: 60px; height: 80px; border-radius: 4px; flex-shrink: 0; }
.lib-details h4 { font-size: 0.98rem; margin-bottom: 0.25rem; }
.lib-details p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }

/* Writer Studio Sub-Tab */
.writer-studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.writer-actions-bar { display: flex; gap: 0.75rem; }
.writer-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.writer-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.w-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.w-val { font-size: 1.6rem; font-weight: 800; color: var(--text-main); }

.my-stories-list { display: flex; flex-direction: column; gap: 1rem; }
.my-story-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  gap: 1rem;
}
.my-story-title-info strong { display: block; font-size: 1rem; margin-bottom: 0.2rem; }
.my-story-title-info span { font-size: 0.82rem; color: var(--text-muted); }

/* Updates Sub-Tab */
.updates-feed-list { display: flex; flex-direction: column; gap: 1.25rem; max-width: 800px; }
.update-card {
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.update-header { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; }
.update-author-info { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.update-content-box { font-size: 0.92rem; color: var(--text-main); }

/* Profile Sub-Tab */
.profile-page-shell { max-width: 900px; margin: 0 auto; }
.profile-hero-card {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.75rem;
}
.profile-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary);
  flex-shrink: 0;
}
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.profile-name-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.4rem; }
.golden-author-badge {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-gold);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}
.profile-bio { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5; }
.profile-stats-bar { display: flex; gap: 1.75rem; font-size: 0.88rem; }
.p-stat strong { display: block; font-size: 1.2rem; color: var(--text-main); }
.p-stat span { font-size: 0.78rem; color: var(--text-dim); }

.profile-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}
.profile-menu-item:hover { border-color: var(--primary); transform: translateX(3px); }
.profile-menu-item .icon { font-size: 1.4rem; }
.profile-menu-item strong { display: block; font-size: 0.92rem; }
.profile-menu-item small { color: var(--text-muted); }
.profile-menu-item .arrow { margin-left: auto; color: var(--text-dim); }
.profile-menu-item.danger { border-color: rgba(239, 68, 68, 0.3); }
.profile-menu-item.danger strong { color: #EF4444; }

/* Floating Audio Series Player */
.floating-audio-bar {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(30, 27, 75, 0.96);
  border-top: 1px solid rgba(139, 92, 246, 0.3);
  backdrop-filter: blur(12px);
  padding: 0.65rem 1.5rem;
  color: #FFF;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  animation: slideUpAudio 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUpAudio { from { transform: translateY(100%); } to { transform: translateY(0); } }

.audio-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.audio-cover-thumb { font-size: 1.8rem; }
.audio-meta-text { flex: 1; }
.audio-meta-text strong { display: block; font-size: 0.92rem; color: #EDE9FE; }
.audio-meta-text span { font-size: 0.78rem; color: #A78BFA; }
.audio-controls-row { display: flex; align-items: center; gap: 0.6rem; }
.audio-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #FFF;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}
.audio-btn.play-pause-btn { background: #8B5CF6; font-size: 1.1rem; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* Bottom Navigation Bar */
.bottom-app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  height: 60px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 1rem;
}
.bottom-nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.bottom-nav-item .nav-icon { font-size: 1.2rem; }
.bottom-nav-item .nav-label { font-size: 0.72rem; font-weight: 700; }
.bottom-nav-item.active { color: var(--primary); }

/* Superfan Chatroom Shell */
.chat-card-shell { height: 600px; display: flex; flex-direction: column; }
.chat-header-info { display: flex; align-items: center; gap: 0.75rem; }
.chat-badge-icon { font-size: 1.8rem; }
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-page);
}
.chat-msg {
  max-width: 80%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.4;
}
.chat-msg.received {
  align-self: flex-start;
  background: var(--bg-surface-elevated);
  border-bottom-left-radius: 2px;
}
.chat-msg.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), #FF5252);
  color: #FFF;
  border-bottom-right-radius: 2px;
}
.msg-sender { display: block; font-size: 0.75rem; font-weight: 700; color: var(--accent-gold); margin-bottom: 0.2rem; }
.msg-time { display: block; font-size: 0.65rem; opacity: 0.7; text-align: right; margin-top: 0.3rem; }
.chat-input-bar {
  display: flex;
  gap: 0.65rem;
  padding: 0.85rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}
.chat-input-bar input {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
}

/* Quote Card Studio */
.quote-preview-box {
  padding: 2.5rem 2rem;
  border-radius: var(--radius-md);
  color: #FFF;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.quote-icon-mark { font-size: 4rem; position: absolute; top: -10px; left: 10px; opacity: 0.2; line-height: 1; }
.quote-preview-box blockquote { font-size: 1.25rem; font-weight: 700; line-height: 1.5; z-index: 2; margin-bottom: 1.25rem; }
.quote-card-footer { display: flex; flex-direction: column; font-size: 0.85rem; opacity: 0.85; }
.quote-colors-row { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1.25rem; font-size: 0.85rem; color: var(--text-muted); }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #FFF; cursor: pointer; }

/* 12 Language Grid */
.languages-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.lang-opt-card {
  padding: 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}
.lang-opt-card:hover { border-color: var(--primary); background: var(--bg-surface-hover); }
.lang-opt-card.active { border-color: var(--primary); background: rgba(229, 57, 53, 0.15); }
.lang-opt-card strong { display: block; font-size: 1.1rem; margin-bottom: 0.2rem; }
.lang-opt-card small { color: var(--text-muted); font-size: 0.75rem; }

/* Coin Store Packs Grid */
.current-bal-display {
  padding: 0.85rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.current-bal-display strong { font-size: 1.25rem; color: var(--accent-gold); }
.coin-packs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.coin-pack-card {
  padding: 1.25rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  position: relative;
}
.coin-pack-card.featured { border-color: var(--primary); box-shadow: 0 4px 14px var(--primary-glow); }
.popular-ribbon {
  position: absolute;
  top: -10px;
  background: var(--primary);
  color: #FFF;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.pack-coins { font-size: 1rem; font-weight: 800; color: var(--text-main); }
.pack-price { font-size: 1.35rem; font-weight: 800; color: var(--accent-emerald); }
.payment-trust-badge { font-size: 0.75rem; color: var(--text-dim); text-align: center; line-height: 1.4; }

/* Leaderboard List */
.leaderboard-list { display: flex; flex-direction: column; gap: 0.85rem; }
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
}
.rank-badge { font-size: 1.3rem; font-weight: 800; width: 45px; }
.lb-author { flex: 1; }
.lb-author strong { display: block; font-size: 0.95rem; }
.lb-author small { color: var(--text-muted); }

/* Admin Dashboard Specifics */
.admin-dashboard-layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 65px); }
.admin-sidebar { background: var(--bg-surface); border-right: 1px solid var(--border-color); padding: 1.5rem 1rem; display: flex; flex-direction: column; }
.admin-profile-snippet { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--bg-surface-elevated); border-radius: var(--radius-md); margin-bottom: 1.5rem; }
.admin-avatar { font-size: 1.8rem; }
.admin-name { display: block; font-weight: 700; font-size: 0.88rem; }
.admin-role { font-size: 0.72rem; color: var(--text-dim); }
.admin-nav-menu { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}
.admin-nav-item svg { width: 18px; height: 18px; }
.admin-nav-item:hover { background: var(--bg-surface-hover); color: var(--text-main); }
.admin-nav-item.active { background: rgba(229, 57, 53, 0.1); color: var(--primary); border-left: 3px solid var(--primary); }
.nav-count-pill { margin-left: auto; background: var(--primary); color: #FFF; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-full); }
.sidebar-footer-box { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: 0.75rem; }
.system-health { display: flex; align-items: center; gap: 0.45rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); }
.version-label { color: var(--text-dim); }

.admin-content-area { padding: 2rem; background: var(--bg-page); overflow-y: auto; }
.admin-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }
.admin-page-title { font-size: 1.65rem; font-weight: 800; margin-bottom: 0.25rem; }
.admin-page-sub { font-size: 0.9rem; color: var(--text-muted); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.25rem; }
.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.stat-icon-badge { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.stat-icon-badge.blue { background: rgba(59, 130, 246, 0.15); }
.stat-icon-badge.red { background: rgba(229, 57, 53, 0.15); }
.stat-icon-badge.purple { background: rgba(139, 92, 246, 0.15); }
.stat-icon-badge.amber { background: rgba(245, 158, 11, 0.15); }
.stat-value { font-size: 1.85rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.4rem; }
.stat-trend { font-size: 0.75rem; font-weight: 600; }
.stat-trend.positive { color: var(--accent-emerald); }
.stat-trend.neutral { color: var(--text-dim); }

.admin-dashboard-columns { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.admin-box { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.5rem; }
.box-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.box-header h3 { font-size: 1.1rem; font-weight: 700; }

.table-responsive { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { padding: 0.75rem 0.9rem; background: var(--bg-surface-elevated); color: var(--text-muted); font-weight: 700; border-bottom: 1px solid var(--border-color); }
.data-table td { padding: 0.85rem 0.9rem; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg-surface-hover); }

.status-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: var(--radius-full); font-size: 0.72rem; font-weight: 700; }
.status-badge.published { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.status-badge.draft { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); }
.status-badge.superfan { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

.action-btns-group { display: flex; gap: 0.4rem; }
.btn-icon-action { background: var(--bg-surface-elevated); border: 1px solid var(--border-color); padding: 0.35rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.75rem; cursor: pointer; }
.btn-icon-action:hover { border-color: var(--primary); color: var(--primary); }
.btn-icon-action.delete:hover { border-color: #EF4444; color: #EF4444; }

.admin-action-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.admin-action-list li { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.85rem; background: var(--bg-surface-elevated); border-radius: var(--radius-md); font-size: 0.82rem; }
.action-bullet { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.action-bullet.pending { background: var(--accent-gold); }
.action-bullet.alert { background: #EF4444; }
.action-bullet.success { background: var(--accent-emerald); }

.cms-toolbar { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.cms-search { flex: 1; }
.cms-search input { width: 100%; padding: 0.65rem 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-surface); font-size: 0.88rem; outline: none; }

.feedback-list { display: flex; flex-direction: column; gap: 1rem; }
.feedback-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.feedback-card-header { display: flex; align-items: center; justify-content: space-between; }
.feedback-user-info { display: flex; align-items: center; gap: 0.65rem; }
.feedback-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-surface-elevated); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.feedback-rating { color: var(--accent-gold); font-size: 0.9rem; }
.feedback-comment-text { font-size: 0.9rem; line-height: 1.5; }
.feedback-story-tag { font-size: 0.78rem; color: var(--text-dim); }
.feedback-actions-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border-subtle); }

.analytics-charts-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1.5rem; }
.bar-chart-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; font-size: 0.85rem; }
.bar-genre-label { width: 140px; text-align: right; color: var(--text-muted); font-weight: 600; }
.bar-track { flex: 1; height: 16px; background: var(--bg-surface-elevated); border-radius: var(--radius-full); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--radius-full); transition: width 1s ease-out; }
.bar-val { width: 55px; font-weight: 700; }

.platform-metrics { display: flex; flex-direction: column; gap: 1rem; margin: 1.25rem 0; }
.metric-row { display: flex; align-items: center; gap: 1rem; font-size: 0.85rem; }
.metric-row span { width: 160px; color: var(--text-muted); }
.metric-row .progress-track { flex: 1; height: 8px; background: var(--bg-surface-elevated); border-radius: var(--radius-full); overflow: hidden; }
.metric-row .progress-fill { height: 100%; background: var(--primary); border-radius: var(--radius-full); }
.apollo-graphql-status { padding: 1rem; background: var(--bg-surface-elevated); border-radius: var(--radius-md); margin-top: 1.5rem; font-size: 0.85rem; }

/* Modern Reader Mode Modal */
.reader-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}
.reader-modal-shell {
  width: 100%;
  max-width: 860px;
  height: 100%;
  background: var(--bg-surface);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}
.reader-modal-shell[data-reader-theme="light"] { background: #FFFFFF; color: #1F2937; }
.reader-modal-shell[data-reader-theme="sepia"] { background: #FBF0D9; color: #4A3B2C; }
.reader-modal-shell[data-reader-theme="dark"] { background: #0B0F19; color: #E2E8F0; }

.reader-header-bar {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: inherit;
  z-index: 10;
}
.reader-header-left { display: flex; align-items: center; gap: 1rem; overflow: hidden; }
.reader-title-text { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.reader-author-text { font-size: 0.78rem; opacity: 0.7; }
.reader-header-right { display: flex; align-items: center; gap: 0.65rem; }

.reading-progress-track { width: 100%; height: 3px; background: rgba(0, 0, 0, 0.1); }
.reading-progress-bar { height: 100%; width: 0%; background: var(--primary); transition: width 0.1s linear; }

.reader-settings-drawer {
  position: absolute;
  top: 65px;
  right: 1.5rem;
  z-index: 50;
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
}
.settings-drawer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.close-drawer-btn { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-dim); }
.setting-item { margin-bottom: 1.1rem; }
.setting-item label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 0.45rem; color: var(--text-muted); }
.theme-options-row, .mode-options-row, .font-family-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 0.4rem; }
.theme-opt-btn, .mode-opt-btn, .font-opt-btn {
  padding: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
}
.theme-opt-btn.active, .mode-opt-btn.active, .font-opt-btn.active { background: var(--primary); color: #FFF; border-color: var(--primary); }
.font-size-controls { display: flex; align-items: center; justify-content: space-between; background: var(--bg-surface-elevated); border-radius: var(--radius-sm); padding: 0.35rem 0.65rem; }
.size-btn { background: none; border: none; font-weight: 800; font-size: 0.9rem; cursor: pointer; padding: 0.2rem 0.6rem; }
.current-font-size { font-size: 0.85rem; font-weight: 700; }

.reader-content-scroll { flex: 1; overflow-y: auto; padding: 2.5rem 3rem; scroll-behavior: smooth; }
.reader-article { max-width: 700px; margin: 0 auto; font-size: 1.15rem; line-height: 1.95; }
.reader-article p { margin-bottom: 1.6rem; text-indent: 1.5rem; }
.reader-article p:first-of-type { text-indent: 0; }
.reader-article p:first-of-type::first-letter { font-size: 2.6rem; font-weight: 800; float: left; line-height: 1; margin-right: 0.5rem; color: var(--primary); }

.reader-paywall-box {
  max-width: 600px;
  margin: 2.5rem auto;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(229, 57, 53, 0.12));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  text-align: center;
}
.paywall-lock-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.reader-paywall-box h3 { font-size: 1.35rem; font-weight: 800; margin-bottom: 0.5rem; }
.reader-paywall-box p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; }
.paywall-actions { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

.reader-bottom-nav { max-width: 700px; margin: 3rem auto 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.reader-comments-section { max-width: 700px; margin: 2rem auto; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }
.add-comment-box { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.add-comment-box textarea { width: 100%; background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.85rem; font-size: 0.9rem; outline: none; }
.chapter-comments-list { display: flex; flex-direction: column; gap: 1rem; }
.comment-item { padding: 0.85rem; background: var(--bg-surface-elevated); border-radius: var(--radius-md); font-size: 0.88rem; }
.comment-item-header { display: flex; justify-content: space-between; margin-bottom: 0.35rem; }
.comment-author-name { font-weight: 700; color: var(--text-main); }
.comment-date { font-size: 0.75rem; color: var(--text-dim); }
.comment-body-text { color: var(--text-muted); line-height: 1.4; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1.25rem; font-weight: 800; }
.close-modal-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-dim); }
.modal-form { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.15rem; max-height: 80vh; overflow-y: auto; }
.form-row { display: flex; gap: 1rem; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  outline: none;
}
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }

/* Toast */
.toast-container { position: fixed; bottom: 80px; right: 2rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.6rem; pointer-events: none; }
.toast {
  pointer-events: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success { border-left: 4px solid var(--accent-emerald); }
.toast.info { border-left: 4px solid var(--accent-blue); }
.toast.warning { border-left: 4px solid var(--accent-gold); }
@keyframes toastSlide { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .admin-dashboard-layout { grid-template-columns: 200px 1fr; }
  .admin-dashboard-columns, .analytics-charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .header-container { padding: 0.65rem 1rem; }
  .search-box { display: none; }
  .hero-banner-card { flex-direction: column; padding: 1.5rem; }
  .hero-book-cover { width: 160px; height: 230px; margin: 1rem auto 0; }
  .hero-title { font-size: 1.6rem; }
  .admin-dashboard-layout { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: none; border-bottom: 1px solid var(--border-color); }
  .admin-nav-menu { flex-direction: row; overflow-x: auto; }
  .reader-content-scroll { padding: 1.5rem 1.25rem; }
  .form-row, .coin-packs-grid, .languages-grid { grid-template-columns: 1fr; }
  .profile-hero-card { flex-direction: column; text-align: center; }
  .profile-name-row { justify-content: center; }
  .profile-stats-bar { justify-content: center; }
}

/* Reading Streak Badge in Header (From ReadingStreakActivity) */
.reading-streak-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 700;
  color: #EF4444;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s;
}
.reading-streak-badge:hover { transform: scale(1.05); }
.streak-flame { font-size: 1.05rem; }

/* Reading Streak Strip on Home */
.reading-streak-strip {
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
}
.streak-strip-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.streak-strip-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.flame-big { font-size: 2rem; }
.streak-strip-left strong { display: block; font-size: 1.05rem; color: var(--text-main); }
.streak-strip-left span { font-size: 0.84rem; color: var(--text-muted); }

/* Writing Contest Fellowship Banner (From WriterEducationActivity) */
.contest-banner-card {
  background: linear-gradient(135deg, #431407, #78350F);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}
.contest-badge {
  display: inline-block;
  background: #F59E0B;
  color: #000;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}
.contest-body h3 { font-size: 1.35rem; font-weight: 800; color: #FFF; margin-bottom: 0.4rem; }
.contest-body p { font-size: 0.88rem; color: rgba(255, 255, 255, 0.85); margin-bottom: 1.25rem; max-width: 700px; line-height: 1.5; }

/* Chapter & Audio Series Table Enhancements */
.data-table th, .data-table td { padding: 0.85rem 1rem; text-align: left; }
.status-badge.draft { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }
.status-badge.published { background: rgba(16, 185, 129, 0.15); color: #10B981; }

/* Multi-Chatroom Tabs (From SuperFanChatActivity) */
.chatroom-tabs-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
}
.chatroom-tab-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}
.chatroom-tab-pill:hover { color: var(--text-main); }
.chatroom-tab-pill.active {
  background: var(--primary);
  color: #FFF;
  border-color: var(--primary);
}

/* User Settings Modal (From SettingsActivity, AccountSettingsActivity) */
.settings-modal-card { max-width: 650px; width: 95%; }
.settings-group-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}
.styled-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
}
.styled-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Mobile Responsiveness for Stories, Chatrooms, and Reader */
@media (max-width: 768px) {
  .stories-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 1rem !important;
  }
  .story-card {
    padding: 0.65rem;
  }
  .modal-card {
    width: 95% !important;
    max-height: 90vh !important;
  }
}

@media (max-width: 480px) {
  .stories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  .meta-title { font-size: 0.92rem; }
  .meta-desc { display: none; }
  .cover-parts-badge { display: none; }
  .header-container { padding: 0.5rem 0.75rem; }
  .brand-text .brand-sub { display: none; }
  .reading-streak-badge .streak-count { display: none; }
  .floating-audio-bar {
    bottom: 60px !important;
    padding: 0.5rem 0.75rem;
  }
  .audio-progress-wrap { display: none; }
}





/* ===================================================== */
/* AUTHENTIC MOBILE BOTTOM NAVIGATION & RESPONSIVE RULES */
/* ===================================================== */

body.has-bottom-nav {
  padding-bottom: 74px !important;
}

.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-surface, #1E293B);
  border-top: 1px solid var(--border, #334155);
  display: flex !important;
  justify-content: space-around;
  align-items: center;
  z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  backdrop-filter: blur(12px);
}

.bottom-nav-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted, #94A3B8);
  cursor: pointer;
  padding: 6px 0;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.bottom-nav-item .nav-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.bottom-nav-item .nav-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.bottom-nav-item.active {
  color: var(--primary, #FF6B4A) !important;
}

.bottom-nav-item.active .nav-label {
  font-weight: 700;
}

/* Audio Player Dock Position above Bottom Nav */
.floating-audio-dock {
  bottom: 64px !important;
}

/* Mobile Screens Optimization (Tablets & Phones) */
@media (max-width: 768px) {
  .app-header {
    padding: 0.5rem 0.75rem;
  }
  .header-container {
    gap: 0.5rem;
  }
  .brand-sub {
    display: none;
  }
  .header-right {
    gap: 0.5rem;
  }
  .view-switcher-pill {
    padding: 2px;
  }
  .view-switcher-pill button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
  .stories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    padding: 0.25rem 0;
  }
  .story-card {
    border-radius: 8px;
    overflow: hidden;
  }
  .story-cover-box {
    height: 200px !important;
  }
  .story-meta-box {
    padding: 0.65rem !important;
  }
  .meta-title {
    font-size: 0.88rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .meta-desc {
    display: none !important;
  }
  .meta-footer {
    margin-top: 0.4rem !important;
  }
  .meta-stat {
    font-size: 0.75rem !important;
  }
  .profile-hero-card {
    padding: 1.25rem 1rem !important;
  }
  .profile-options-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
  .modal-card {
    width: 96% !important;
    max-height: 88vh !important;
    padding: 1rem !important;
  }
}

@media (max-width: 480px) {
  .stories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
  .story-cover-box {
    height: 175px !important;
  }
  .cover-title {
    font-size: 0.82rem !important;
  }
  .cover-author {
    font-size: 0.72rem !important;
  }
  .cover-parts-badge, .cover-genre-badge {
    font-size: 0.65rem !important;
    padding: 2px 5px !important;
  }
}


/* ======================================================== */
/* 📱 100% BULLETPROOF MOBILE RESPONSIVE ENGINE (ZERO OVERFLOW) */
/* ======================================================== */

*, *::before, *::after {
  box-sizing: border-box !important;
}

html, body {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  -webkit-text-size-adjust: 100%;
}

body.has-bottom-nav {
  padding-bottom: 76px !important;
}

/* User Sub-tabs visibility fix */
.user-sub-tab.active-sub-tab {
  display: block !important;
}

#userViewContainer {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  padding: 1rem !important;
  margin: 0 auto !important;
}

/* Mobile Screen Layout Rules (Tablets & Phones <= 768px) */
@media (max-width: 768px) {
  .header-container {
    padding: 0.5rem 0.75rem !important;
    gap: 0.5rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    justify-content: space-between !important;
  }

  .header-left {
    flex: 0 0 auto !important;
    gap: 0.5rem !important;
  }

  .brand-logo {
    gap: 0.4rem !important;
  }

  .logo-icon {
    width: 32px !important;
    height: 32px !important;
  }

  .logo-icon svg {
    width: 18px !important;
    height: 18px !important;
  }

  .brand-tamil {
    font-size: 1.15rem !important;
  }

  .brand-sub, .search-box {
    display: none !important;
  }

  .header-right {
    gap: 0.4rem !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
  }

  /* Compact Header Controls on Mobile */
  #headerStreakBadge {
    display: none !important;
  }

  .view-switcher-pill {
    padding: 2px !important;
  }

  .view-btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.72rem !important;
    gap: 0.25rem !important;
  }

  .view-btn svg {
    width: 13px !important;
    height: 13px !important;
  }

  .admin-badge {
    display: none !important;
  }

  .header-pill-btn {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.75rem !important;
  }

  .coin-badge {
    padding: 0.3rem 0.5rem !important;
    font-size: 0.75rem !important;
  }

  .coin-label {
    display: none !important;
  }

  .user-avatar-btn {
    width: 34px !important;
    height: 34px !important;
  }

  /* Hero Section Mobile Zero-Overflow */
  .hero-banner-card {
    flex-direction: column !important;
    padding: 1.25rem 1rem !important;
    gap: 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .hero-badge-tag {
    position: static !important;
    align-self: flex-start !important;
    margin-bottom: 0.5rem !important;
  }

  .hero-content {
    padding-top: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .hero-title {
    font-size: 1.35rem !important;
    line-height: 1.25 !important;
  }

  .hero-desc {
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
  }

  .hero-book-cover {
    width: 140px !important;
    height: 195px !important;
    margin: 0.5rem auto 0 !important;
    transform: none !important;
  }

  /* Story Catalog 2-Column Mobile Grid */
  .stories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .story-card {
    border-radius: 8px !important;
    overflow: hidden !important;
    width: 100% !important;
  }

  .story-cover-box {
    height: 180px !important;
    padding: 0.5rem !important;
  }

  .cover-title {
    font-size: 0.85rem !important;
  }

  .cover-author {
    font-size: 0.72rem !important;
  }

  .story-meta-box {
    padding: 0.5rem 0.65rem !important;
  }

  .meta-title {
    font-size: 0.85rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .meta-author {
    font-size: 0.72rem !important;
  }

  .meta-desc {
    display: none !important;
  }

  .meta-footer {
    margin-top: 0.35rem !important;
  }

  .meta-stat {
    font-size: 0.72rem !important;
  }

  .read-cta-btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.72rem !important;
  }

  /* Profile Page Mobile Optimization */
  .profile-page-shell {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .profile-hero-card {
    flex-direction: column !important;
    text-align: center !important;
    padding: 1.25rem 0.75rem !important;
    width: 100% !important;
  }

  .profile-avatar-large {
    width: 80px !important;
    height: 80px !important;
    margin: 0 auto 0.75rem !important;
  }

  .profile-name-row {
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .profile-counts-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    padding-top: 1rem !important;
  }

  .profile-options-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
    margin-top: 1rem !important;
  }

  .prof-opt-box {
    padding: 1rem !important;
    width: 100% !important;
  }

  /* Categories & Language Pills Horizontal Scroll on Mobile */
  .categories-filter-bar, .library-filters {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding-bottom: 0.5rem !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .category-pill, .pill-btn {
    flex: 0 0 auto !important;
  }
}

@media (max-width: 480px) {
  .stories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem !important;
  }

  .story-cover-box {
    height: 160px !important;
  }

  .cover-title {
    font-size: 0.78rem !important;
  }

  .cover-parts-badge, .cover-genre-badge {
    font-size: 0.6rem !important;
    padding: 1px 4px !important;
  }

  .header-container {
    padding: 0.4rem 0.5rem !important;
  }

  .brand-tamil {
    font-size: 1.05rem !important;
  }
}
