/* ================================================
   REWAYA - Novel Blog Platform
   Dark Arabic Theme with Gold Accents
   RTL Layout
   ================================================ */

/* === CSS CUSTOM PROPERTIES === */
:root {
  /* Color Palette */
  --bg-primary:    #0d0e14;
  --bg-secondary:  #13151f;
  --bg-card:       #1a1d2e;
  --bg-card-hover: #1f2236;
  --bg-input:      #111320;
  --bg-modal:      #161826;

  --gold-light:    #f0c040;
  --gold:          #d4a017;
  --gold-dark:     #a07010;
  --crimson:       #c0392b;
  --crimson-light: #e74c3c;

  --text-primary:  #f0ede8;
  --text-secondary:#a09880;
  --text-muted:    #5a5465;
  --text-gold:     #d4a017;

  --border:        rgba(212, 160, 23, 0.15);
  --border-hover:  rgba(212, 160, 23, 0.4);
  --border-light:  rgba(255,255,255,0.06);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
  --shadow-gold: 0 0 30px rgba(212, 160, 23, 0.2);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;

  --font-heading: 'Amiri', 'Scheherazade New', serif;
  --font-body:    'Cairo', sans-serif;

  --navbar-height: 70px;
  --reader-header-height: 60px;
  --reader-font-size: 18px;
}

/* === LIGHT MODE === */
body.light-mode {
  --bg-primary:    #f5f0e8;
  --bg-secondary:  #ece6d8;
  --bg-card:       #fff9f0;
  --bg-card-hover: #fff3e0;
  --bg-input:      #fdf6ec;
  --bg-modal:      #fff9f0;
  --text-primary:  #1a1209;
  --text-secondary:#4a3828;
  --text-muted:    #8a7060;
  --border:        rgba(160, 112, 16, 0.2);
  --border-hover:  rgba(160, 112, 16, 0.5);
  --border-light:  rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.15);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.2);
}
body.light-mode .navbar {
  background: rgba(245, 240, 232, 0.92);
}
body.light-mode .reader-sticky-header {
  background: rgba(245, 240, 232, 0.97);
  border-bottom-color: rgba(160,112,16,0.2);
}
body.light-mode .chapter-body {
  color: #1a1209;
}
body.light-mode .comments-section {
  background: #ece6d8;
}
body.light-mode .hero-bg {
  background:
    radial-gradient(ellipse at 30% 50%, rgba(212,160,23,0.1) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 30%, rgba(192,57,43,0.07) 0%, transparent 60%),
    linear-gradient(180deg, #f5f0e8 0%, #ece6d8 100%);
}

/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  direction: rtl;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input, textarea, select {
  font-family: inherit;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

a {
  text-decoration: none;
  color: inherit;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* === PAGE LOADER === */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loader-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--gold), var(--crimson));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  animation: pulse-glow 1.5s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(212, 160, 23, 0.5);
}
.loader-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  color: var(--gold);
  letter-spacing: 4px;
}
.loader-bar {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.loader-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--crimson));
  border-radius: 2px;
  animation: load-bar 1.8s ease-in-out;
}
@keyframes load-bar {
  0% { width: 0%; }
  100% { width: 100%; }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 40px rgba(212,160,23,0.5); transform: scale(1); }
  50%       { box-shadow: 0 0 60px rgba(212,160,23,0.8); transform: scale(1.05); }
}

/* === NAVBAR === */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: rgba(13, 14, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: var(--transition);
}
.navbar.scrolled {
  background: rgba(13, 14, 20, 0.98);
  box-shadow: var(--shadow-md);
}
.nav-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  transition: var(--transition-fast);
}
.nav-logo i {
  font-size: 1.3rem;
  filter: drop-shadow(0 0 8px rgba(212,160,23,0.6));
}
.nav-logo:hover {
  color: var(--gold-light);
  filter: drop-shadow(0 0 10px rgba(212,160,23,0.4));
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-badge {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #1a0a00;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 0 12px rgba(212,160,23,0.4);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}
.user-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #b8860b);
  color: #1a0a00;
  box-shadow: 0 4px 15px rgba(212,160,23,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212,160,23,0.5);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}
.btn-ghost {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--border-hover);
}
.btn-danger {
  background: linear-gradient(135deg, var(--crimson-light), var(--crimson));
  color: #fff;
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(192,57,43,0.4);
}
.btn-back {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 32px;
  margin-top: calc(var(--navbar-height) + 20px);
}
.btn-back:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}
.btn-hero {
  background: linear-gradient(135deg, var(--gold), var(--crimson));
  color: #fff;
  padding: 14px 36px;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(192,57,43,0.3), 0 0 0 1px rgba(212,160,23,0.2);
  letter-spacing: 0.5px;
}
.btn-hero:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 40px rgba(192,57,43,0.5), 0 0 0 2px rgba(212,160,23,0.4);
}
.btn-nav {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: 8px;
}
.btn-nav:hover:not(:disabled) {
  background: rgba(212,160,23,0.1);
  border-color: var(--border-hover);
  color: var(--gold);
}
.btn-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-nav-large {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.btn-nav-large:hover:not(:disabled) {
  background: rgba(212,160,23,0.12);
  border-color: var(--border-hover);
  color: var(--gold);
}
.btn-nav-large:disabled { opacity: 0.3; cursor: not-allowed; }

/* === PAGES === */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* === CONTAINER === */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === HERO === */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: var(--navbar-height);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(212,160,23,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 30%, rgba(192,57,43,0.1) 0%, transparent 60%),
    linear-gradient(180deg, #0d0e14 0%, #0f1018 100%);
}
.hero-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.4;
  animation: float-particle linear infinite;
}
@keyframes float-particle {
  0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.4; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(-20px) rotate(720deg); opacity: 0; }
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  padding: 0 24px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(212,160,23,0.12);
  border: 1px solid rgba(212,160,23,0.3);
  padding: 6px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 28px;
  animation: fadeInDown 0.8s ease;
}
.hero-badge i { font-size: 0.8rem; }
.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 20px;
  animation: fadeInUp 0.8s ease 0.1s both;
}
.gradient-text {
  background: linear-gradient(135deg, var(--gold), var(--crimson-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.8;
  animation: fadeInUp 0.8s ease 0.2s both;
}
.hero-scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
}
.scroll-indicator {
  width: 2px;
  height: 50px;
  background: linear-gradient(to bottom, var(--gold), transparent);
  margin: 0 auto;
  animation: scroll-anim 2s ease-in-out infinite;
}
@keyframes scroll-anim {
  0%,100% { transform: scaleY(1); opacity: 1; }
  50%      { transform: scaleY(0.5); opacity: 0.4; }
}

/* === ANIMATIONS === */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === NOVELS SECTION === */
.novels-section {
  padding: 80px 0;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 16px;
}
.section-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title i {
  color: var(--gold);
  font-size: 1.6rem;
}

/* === FILTER TABS === */
.filter-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}
.filter-tab {
  padding: 7px 18px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-tab.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a0a00;
  box-shadow: 0 2px 10px rgba(212,160,23,0.3);
}
.filter-tab:hover:not(.active) { color: var(--text-primary); }
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.ongoing  { background: #2ecc71; box-shadow: 0 0 6px #2ecc71; }
.status-dot.completed{ background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* === NOVELS GRID === */
.novels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 28px;
}

/* Novel Card */
.novel-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  animation: fadeInUp 0.5s ease both;
}
.novel-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-hover);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), var(--shadow-gold);
}
.novel-card-cover {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1d2e, #252840);
}
.novel-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.novel-card:hover .novel-card-cover img {
  transform: scale(1.06);
}
.novel-card-cover .cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.8) 100%);
}
.novel-card-cover .cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
}
.novel-card-cover .cover-placeholder i {
  font-size: 3rem;
  color: var(--gold-dark);
}
.status-badge-small {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.status-badge-small.ongoing  {
  background: rgba(46,204,113,0.2);
  color: #2ecc71;
  border: 1px solid rgba(46,204,113,0.4);
}
.status-badge-small.completed {
  background: rgba(212,160,23,0.2);
  color: var(--gold);
  border: 1px solid rgba(212,160,23,0.4);
}
.novel-card-body {
  padding: 14px;
}
.novel-card-genre {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.novel-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.novel-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.novel-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.novel-card-meta i { color: var(--gold); font-size: 0.7rem; }
.novel-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Skeleton Loading */
.novel-skeleton {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  aspect-ratio: 2/3;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.empty-state i {
  font-size: 4rem;
  color: var(--gold-dark);
  margin-bottom: 20px;
}
.empty-state h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* === NOVEL DETAIL PAGE === */
.novel-hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  margin-bottom: 64px;
  margin-top: calc(var(--navbar-height) + 20px);
  align-items: start;
}
.novel-cover-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px var(--border);
  aspect-ratio: 2/3;
  flex-shrink: 0;
}
.novel-cover-large {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 50%);
  pointer-events: none;
}
.novel-genre-badge {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(212,160,23,0.15);
  border: 1px solid rgba(212,160,23,0.3);
  border-radius: 20px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.novel-title-large {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 16px;
}
.novel-desc-large {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.9;
  margin-bottom: 24px;
}
.novel-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  min-width: 80px;
}
.stat-item i { color: var(--gold); font-size: 1.1rem; }
.stat-item span { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.stat-item small { font-size: 0.72rem; color: var(--text-muted); }
.novel-status-row { margin-bottom: 24px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}
.status-badge.ongoing  { background: rgba(46,204,113,0.15); color: #2ecc71; border: 1px solid rgba(46,204,113,0.3); }
.status-badge.completed{ background: rgba(212,160,23,0.15); color: var(--gold); border: 1px solid rgba(212,160,23,0.3); }

/* Rating Widget */
.rating-widget {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.rating-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.stars-input {
  display: flex;
  flex-direction: row-reverse;
  gap: 6px;
  margin-bottom: 10px;
}
.star-btn {
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
}
.star-btn:hover,
.star-btn.hovered,
.star-btn.active {
  color: var(--gold);
  transform: scale(1.15);
}
.rating-hint { font-size: 0.8rem; color: var(--text-muted); }

/* Chapters Section */
.chapters-section { margin-bottom: 80px; }
.chapters-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--text-primary);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chapters-title i { color: var(--gold); }
.chapters-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
}
.chapter-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateX(-4px);
}
.chapter-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.chapter-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(212,160,23,0.12);
  border: 1px solid rgba(212,160,23,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}
.chapter-item-title {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 500;
}
.chapter-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.chapter-item-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}
.chapter-item:hover .chapter-item-arrow { color: var(--gold); transform: translateX(-4px); }
.chapters-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* === READER STICKY HEADER === */
.chapter-reader {
  min-height: 100vh;
  padding-bottom: 80px;
}
.reader-sticky-header {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  right: 0;
  z-index: 500;
  background: rgba(13,14,20,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.reader-sticky-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--reader-header-height);
  gap: 12px;
}
.reader-sticky-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.reader-sticky-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}
.reader-sticky-novel {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-sticky-chapter {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-heading);
}
.reader-sticky-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.reader-divider {
  width: 1px;
  height: 24px;
  background: var(--border-light);
  margin: 0 4px;
}
/* Reading Progress Bar */
.reading-progress-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--crimson));
  width: 0%;
  transition: width 0.1s linear;
  position: absolute;
  bottom: 0;
  right: 0;
  border-radius: 0 2px 2px 0;
}
/* Icon Buttons */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.btn-icon:hover:not(:disabled) {
  background: rgba(212,160,23,0.12);
  border-color: var(--border-hover);
  color: var(--gold);
}
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }
.theme-toggle-btn.light-active {
  background: rgba(255,200,50,0.15);
  color: var(--gold);
  border-color: rgba(255,200,50,0.4);
}
.font-size-display {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 26px;
  text-align: center;
  font-weight: 600;
}
.chapter-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0 4px;
  white-space: nowrap;
}
.chapter-content-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding-top: calc(var(--navbar-height) + var(--reader-header-height) + 40px);
  padding-bottom: 48px;
  padding-left: 24px;
  padding-right: 24px;
}
.chapter-novel-name {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.chapter-title-display {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.3;
}
.chapter-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.chapter-body {
  font-family: var(--font-heading);
  font-size: var(--reader-font-size);
  line-height: 2.1;
  color: var(--text-primary);
  transition: font-size 0.2s ease;
}
.chapter-body p { margin-bottom: 1.4em; }
.chapter-body h1, .chapter-body h2, .chapter-body h3 {
  font-family: var(--font-heading);
  color: var(--gold);
  margin: 1.5em 0 0.7em;
}
/* Quill rendered content */
.chapter-body .ql-align-center { text-align: center; }
.chapter-body .ql-align-right  { text-align: right; }
.chapter-body .ql-align-justify{ text-align: justify; }

.chapter-bottom-nav {
  display: flex;
  justify-content: space-between;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid var(--border);
}

/* === REACTIONS BAR === */
.reactions-bar {
  margin-top: 48px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.reactions-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 500;
}
.reactions-list {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.reaction-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
  min-width: 72px;
}
.reaction-btn:hover {
  transform: translateY(-4px) scale(1.05);
  background: rgba(212,160,23,0.08);
  border-color: var(--border-hover);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.reaction-btn.active {
  background: rgba(212,160,23,0.15);
  border-color: var(--border-hover);
  box-shadow: 0 0 0 2px rgba(212,160,23,0.2), 0 8px 20px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}
.reaction-emoji {
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: transform 0.15s ease;
}
.reaction-btn:hover .reaction-emoji {
  transform: scale(1.2);
}
.reaction-btn.active .reaction-emoji {
  animation: pop-reaction 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop-reaction {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.reaction-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}
.reaction-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 700;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 1px 8px;
  min-width: 24px;
  text-align: center;
}
.reaction-btn.active .reaction-count {
  background: rgba(212,160,23,0.2);
  color: var(--gold);
}
.reactions-login-hint {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}


/* === COMMENTS === */
.comments-section {
  background: var(--bg-secondary);
  padding: 64px 0;
  border-top: 1px solid var(--border);
}
.comments-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.comments-title i { color: var(--gold); }
.comments-count {
  background: rgba(212,160,23,0.15);
  color: var(--gold);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.85rem;
}
.add-comment-wrap { margin-bottom: 32px; }
.comment-form {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}
.comment-input-wrap { flex: 1; }
.comment-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.2s;
  direction: rtl;
}
.comment-textarea:focus { border-color: var(--border-hover); }
.comment-input-wrap .btn { margin-top: 10px; }
.comment-login-prompt {
  text-align: center;
  padding: 32px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}
.comment-login-prompt i {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.comment-login-prompt p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.comments-list { display: flex; flex-direction: column; gap: 16px; }
.comment-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  animation: fadeInUp 0.3s ease;
}
.comment-item .comment-avatar { width: 38px; height: 38px; }
.comment-content { flex: 1; }
.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.comment-date { font-size: 0.75rem; color: var(--text-muted); }
.comment-text { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.7; }
.comment-delete-btn {
  background: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition-fast);
}
.comment-delete-btn:hover { color: var(--crimson-light); background: rgba(192,57,43,0.1); }
.no-comments {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.no-comments i { font-size: 2.5rem; margin-bottom: 12px; color: var(--gold-dark); }

/* === ADMIN DASHBOARD === */
.admin-header {
  margin-top: calc(var(--navbar-height) + 40px);
  margin-bottom: 40px;
}
.admin-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}
.admin-subtitle { color: var(--text-muted); font-size: 0.95rem; }
.admin-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 32px;
  width: fit-content;
}
.admin-tab {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
}
.admin-tab.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a0a00;
  box-shadow: 0 4px 12px rgba(212,160,23,0.3);
}
.admin-tab:hover:not(.active) { color: var(--text-primary); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-panel-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--text-primary);
}
.admin-novels-list { display: flex; flex-direction: column; gap: 14px; }
.admin-novel-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.admin-novel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  cursor: pointer;
}
.admin-novel-cover {
  width: 56px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.admin-novel-info { flex: 1; }
.admin-novel-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.admin-novel-stats {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.admin-novel-actions {
  display: flex;
  gap: 8px;
}
.btn-edit, .btn-del {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}
.btn-edit {
  background: rgba(212,160,23,0.12);
  color: var(--gold);
  border: 1px solid rgba(212,160,23,0.3);
}
.btn-edit:hover { background: rgba(212,160,23,0.25); }
.btn-del {
  background: rgba(192,57,43,0.12);
  color: var(--crimson-light);
  border: 1px solid rgba(192,57,43,0.3);
}
.btn-del:hover { background: rgba(192,57,43,0.25); }
.admin-chapters-section {
  border-top: 1px solid var(--border);
  padding: 16px;
  background: rgba(0,0,0,0.15);
}
.admin-chapters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.admin-chapters-header h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.admin-chapter-list { display: flex; flex-direction: column; gap: 8px; }
.admin-chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}
.admin-chapter-title { font-size: 0.9rem; color: var(--text-primary); }
.admin-chapter-date  { font-size: 0.75rem; color: var(--text-muted); }
.admin-chapter-actions { display: flex; gap: 6px; }

/* Admin Comments List */
.admin-comments-list { display: flex; flex-direction: column; gap: 12px; }
.admin-comment-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.admin-comment-card .comment-avatar { width: 38px; height: 38px; }
.admin-comment-meta { flex: 1; }
.admin-comment-novel {
  font-size: 0.75rem;
  color: var(--gold);
  margin-bottom: 4px;
  font-weight: 600;
}
.admin-comment-author { font-weight: 600; font-size: 0.9rem; }
.admin-comment-text { font-size: 0.9rem; color: var(--text-secondary); margin-top: 6px; }
.admin-comment-date { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* Admin Ratings List */
.admin-ratings-list { display: flex; flex-direction: column; gap: 12px; }
.admin-rating-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-rating-info h4 { font-size: 0.95rem; color: var(--text-primary); }
.admin-rating-info p  { font-size: 0.78rem; color: var(--text-muted); }
.admin-rating-stars { display: flex; gap: 3px; }
.admin-rating-stars i { color: var(--gold); font-size: 0.9rem; }
.admin-rating-stars i.empty { color: var(--text-muted); }

.loading-state {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* === FORMS === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-hover);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.08);
}
.form-select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a09880' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
}
.form-select option { background: var(--bg-modal); }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.flex-3 { flex: 3; }
.form-textarea { resize: vertical; min-height: 100px; direction: rtl; }

/* Cover Upload */
.cover-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s;
  overflow: hidden;
  cursor: pointer;
}
.cover-upload-area:hover { border-color: var(--border-hover); }
.cover-upload-placeholder {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.cover-upload-placeholder i { font-size: 2.5rem; color: var(--gold-dark); }
.cover-upload-placeholder p { font-size: 0.9rem; color: var(--text-secondary); }
.cover-upload-placeholder small { font-size: 0.75rem; }
.cover-preview-img { width: 100%; max-height: 300px; object-fit: contain; }

/* Chapter Editor */
.chapter-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-input);
  min-height: 300px;
}
.ql-toolbar.ql-snow {
  background: rgba(255,255,255,0.05);
  border: none;
  border-bottom: 1px solid var(--border);
}
.ql-container.ql-snow {
  border: none;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  direction: rtl;
}
.ql-editor {
  min-height: 280px;
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
}
.ql-editor.ql-blank::before {
  color: var(--text-muted);
  right: 15px;
  left: auto;
  font-style: italic;
}
.ql-toolbar .ql-stroke { stroke: var(--text-secondary) !important; }
.ql-toolbar .ql-fill   { fill: var(--text-secondary) !important; }
.ql-toolbar button:hover .ql-stroke { stroke: var(--gold) !important; }
.ql-toolbar button:hover .ql-fill   { fill: var(--gold) !important; }
.ql-toolbar .ql-picker-label { color: var(--text-secondary); }

/* === MODALS === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(30px) scale(0.97);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.05);
}
.modal-large { max-width: 800px; }
.modal-small { max-width: 420px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--text-primary);
}
.modal-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-light);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}
.modal-close:hover { background: rgba(192,57,43,0.15); color: var(--crimson-light); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}
.confirm-icon {
  text-align: center;
  font-size: 3rem;
  color: var(--gold);
  margin-bottom: 16px;
}
.confirm-message {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 8px;
}

/* === TOAST NOTIFICATION === */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-primary);
  z-index: 9998;
  box-shadow: var(--shadow-md);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  opacity: 0;
  min-width: 240px;
  max-width: 400px;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success #toast-icon { color: #2ecc71; }
.toast.error   #toast-icon { color: var(--crimson-light); }
.toast.info    #toast-icon { color: var(--gold); }


/* ================================================
   RESPONSIVE - Mobile First
   ================================================ */

/* ---- Tablet & Small Desktop (max 1024px) ---- */
@media (max-width: 1024px) {
  .novels-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .novel-hero {
    grid-template-columns: 200px 1fr;
    gap: 32px;
  }
  .novel-stats {
    gap: 12px;
  }
}

/* ---- Mobile & Tablet (max 768px) ---- */
@media (max-width: 768px) {

  /* Root adjustments */
  :root {
    --navbar-height: 60px;
    --reader-header-height: 54px;
  }

  /* === NAVBAR === */
  .nav-container {
    padding: 0 16px;
  }
  .nav-logo {
    font-size: 1.3rem;
  }
  .nav-actions {
    gap: 8px;
  }
  .nav-actions .user-name { display: none; }
  .admin-badge { display: none !important; }
  .btn span { display: none; }
  .btn {
    padding: 9px 12px;
    gap: 0;
  }
  .btn i { font-size: 1rem; }

  /* === HERO === */
  .hero-title {
    font-size: clamp(2.2rem, 9vw, 3.2rem);
  }
  .hero-subtitle {
    font-size: 0.95rem;
  }
  .hero-badge {
    font-size: 0.78rem;
    padding: 5px 14px;
  }
  .btn-hero {
    padding: 12px 28px;
    font-size: 0.95rem;
  }

  /* === NOVELS GRID === */
  .novels-section {
    padding: 48px 0;
  }
  .container {
    padding: 0 16px;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
  }
  .section-title {
    font-size: 1.6rem;
  }
  .filter-tabs {
    align-self: stretch;
    justify-content: center;
  }
  .filter-tab {
    flex: 1;
    justify-content: center;
    padding: 7px 10px;
    font-size: 0.8rem;
  }
  .novels-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .novel-card-title {
    font-size: 0.9rem;
  }
  .novel-card-genre {
    display: none;
  }
  .novel-card-body {
    padding: 10px;
  }
  .novel-card-meta {
    font-size: 0.7rem;
  }

  /* === NOVEL DETAIL PAGE === */
  .novel-hero {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: calc(var(--navbar-height) + 16px);
    margin-bottom: 32px;
  }
  .novel-cover-wrap {
    max-width: 180px;
    margin: 0 auto;
  }
  .novel-info {
    text-align: center;
  }
  .novel-genre-badge {
    display: inline-block;
  }
  .novel-title-large {
    font-size: 1.8rem;
  }
  .novel-desc-large {
    font-size: 0.93rem;
    text-align: right;
  }
  .novel-stats {
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .stat-item {
    min-width: 70px;
    padding: 10px 12px;
  }
  .novel-status-row {
    text-align: center;
  }
  .rating-widget {
    text-align: center;
  }
  .stars-input {
    justify-content: center;
  }
  .btn-back {
    margin-top: calc(var(--navbar-height) + 12px);
    margin-bottom: 20px;
    font-size: 0.82rem;
    padding: 7px 14px;
  }
  .chapters-title {
    font-size: 1.3rem;
  }
  .chapter-item {
    padding: 12px 14px;
  }
  .chapter-item-title {
    font-size: 0.9rem;
  }
  .chapter-num {
    width: 32px;
    height: 32px;
    font-size: 0.72rem;
  }

  /* === READER STICKY HEADER === */
  .reader-sticky-inner {
    padding: 0 12px;
    height: var(--reader-header-height);
    gap: 8px;
  }
  .reader-sticky-novel {
    font-size: 0.65rem;
  }
  .reader-sticky-chapter {
    font-size: 0.78rem;
  }
  .reader-divider { display: none; }
  .font-size-display { display: none; }
  .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 0.82rem;
  }
  .chapter-counter {
    font-size: 0.72rem;
    padding: 0 2px;
  }

  /* === CHAPTER READER CONTENT === */
  .chapter-content-wrap {
    padding-top: calc(var(--navbar-height) + var(--reader-header-height) + 24px);
    padding-bottom: 40px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .chapter-title-display {
    font-size: 1.5rem;
  }
  .chapter-novel-name {
    font-size: 0.82rem;
  }
  .chapter-meta {
    font-size: 0.78rem;
    margin-bottom: 28px;
  }
  .chapter-body {
    font-size: 1.05rem !important;
    line-height: 2;
  }

  /* === REACTIONS === */
  .reactions-bar {
    margin-top: 32px;
    padding: 20px 0;
  }
  .reactions-list {
    gap: 8px;
  }
  .reaction-btn {
    min-width: 56px;
    padding: 10px 8px;
    border-radius: 10px;
  }
  .reaction-emoji {
    font-size: 1.5rem;
  }
  .reaction-label { display: none; }
  .reaction-count {
    font-size: 0.72rem;
    padding: 1px 6px;
  }

  /* === COMMENTS === */
  .comments-section {
    padding: 40px 0;
  }
  .container-narrow {
    padding: 0 16px;
  }
  .comments-title {
    font-size: 1.25rem;
  }
  .comment-form {
    flex-direction: column;
    gap: 10px;
  }
  .comment-form .comment-avatar {
    display: none;
  }
  .comment-item {
    padding: 12px 14px;
    gap: 10px;
  }
  .comment-item .comment-avatar {
    width: 32px;
    height: 32px;
  }
  .comment-author {
    font-size: 0.82rem;
  }
  .comment-text {
    font-size: 0.88rem;
  }

  /* === CHAPTER BOTTOM NAV === */
  .chapter-bottom-nav {
    padding: 16px;
    gap: 8px;
  }
  .btn-nav-large {
    padding: 10px 16px;
    font-size: 0.82rem;
    flex: 1;
    justify-content: center;
  }

  /* === ADMIN DASHBOARD === */
  .admin-header {
    margin-top: calc(var(--navbar-height) + 20px);
    margin-bottom: 24px;
  }
  .admin-title {
    font-size: 1.6rem;
  }
  .admin-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
  }
  .admin-tab {
    padding: 8px 14px;
    font-size: 0.82rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .admin-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .admin-panel-header h2 {
    font-size: 1.2rem;
  }
  .admin-novel-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .admin-novel-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .admin-novel-stats {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* === MODALS === */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100%;
    transform: translateY(100%);
  }
  .modal-overlay.active .modal {
    transform: translateY(0);
  }
  .modal-header {
    padding: 20px 20px 16px;
  }
  .modal-body {
    padding: 16px 20px;
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }
  .modal-footer .btn span { display: inline; }
  .form-row {
    grid-template-columns: 1fr;
  }

  /* === TOAST === */
  .toast {
    bottom: 16px;
    left: 16px;
    right: 16px;
    transform: translateX(0) translateY(80px);
    max-width: 100%;
    min-width: unset;
    border-radius: var(--radius-sm);
    white-space: normal;
    text-align: right;
    justify-content: flex-start;
  }
  .toast.show {
    transform: translateX(0) translateY(0);
  }
}

/* ---- Small Mobile (max 480px) ---- */
@media (max-width: 480px) {
  .novels-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .hero-title {
    font-size: 2rem;
  }
  .novel-stats {
    gap: 6px;
  }
  .stat-item {
    min-width: 60px;
    padding: 8px 10px;
  }
  .stat-item span {
    font-size: 1.1rem;
  }
  .reader-sticky-titles {
    max-width: 140px;
  }
  .admin-novel-cover {
    width: 44px;
    height: 64px;
  }
}

/* ---- Very Small Mobile (max 360px) ---- */
@media (max-width: 360px) {
  .novels-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .reaction-btn {
    min-width: 48px;
    padding: 8px 6px;
  }
  .reaction-emoji {
    font-size: 1.3rem;
  }
  .admin-tab {
    padding: 7px 10px;
    font-size: 0.75rem;
  }
}

/* ---- Touch devices: remove hover effects ---- */
@media (hover: none) {
  .novel-card:hover {
    transform: none;
    box-shadow: none;
  }
  .reaction-btn:hover {
    transform: none;
    box-shadow: none;
  }
  .btn-hero:hover {
    transform: none;
  }
  .chapter-item:hover {
    transform: none;
  }
}

/* ---- Landscape Mobile ---- */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: 100svh;
  }
  .hero-title {
    font-size: 1.8rem;
  }
  .hero-subtitle {
    font-size: 0.85rem;
    margin-bottom: 20px;
  }
  .reader-sticky-header {
    top: 0;
  }
  .chapter-content-wrap {
    padding-top: calc(var(--reader-header-height) + 20px);
  }
}

/* ---- Safe area for notched phones (iPhone X+) ---- */
@supports (padding: max(0px)) {
  .navbar {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  .reader-sticky-header {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  .chapter-bottom-nav {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .toast {
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* ================================================
   NEW FEATURE STYLES: Telegram, Author, and Share
   ================================================ */

/* Novel Author and Meta */
.novel-meta-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.novel-author-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}
body.light-mode .novel-author-badge {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
}

/* Telegram and Share CTA bar */
.novel-cta-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 36px;
  max-width: 100%;
}
.tg-cta-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #229ED9 0%, #177da8 100%);
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  color: #ffffff;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 15px rgba(34, 158, 217, 0.3);
}
.tg-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(34, 158, 217, 0.4);
}
.tg-cta-btn i.fa-telegram-plane {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.tg-cta-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  text-align: right;
  gap: 2px;
}
.tg-cta-text strong {
  font-size: 1.05rem;
  font-weight: 700;
}
.tg-cta-text small {
  font-size: 0.78rem;
  opacity: 0.85;
}
.tg-arrow {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}
.tg-cta-btn:hover .tg-arrow {
  transform: translateX(-4px);
}

.share-novel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--gold);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition-fast);
}
.share-novel-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Telegram Checkbox styling in forms */
.tg-notify-group {
  margin: 20px 0;
}
.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-right: 32px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text-secondary);
  user-select: none;
}
.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}
.checkmark {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  height: 20px;
  width: 20px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: var(--transition-fast);
}
.checkbox-container:hover input ~ .checkmark {
  border-color: var(--border-hover);
}
.checkbox-container input:checked ~ .checkmark {
  background-color: var(--gold);
  border-color: var(--gold);
}
.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}
.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}
.checkbox-container .checkmark:after {
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.label-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Admin settings section */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
}
.settings-heading {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-heading i {
  color: var(--gold);
}
.settings-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}
.tg-test-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.settings-novel-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-novel-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  gap: 16px;
}
.link-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.link-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.link-item-author {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.link-item-url {
  font-size: 0.8rem;
  color: var(--gold);
  text-decoration: underline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-item-actions {
  display: flex;
  gap: 10px;
}

/* Share Modal specific */
.share-modal-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: center;
}
.share-social-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.share-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.share-social-btn:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}
.share-social-btn.wa { background-color: #25D366; }
.share-social-btn.fb { background-color: #1877F2; }
.share-social-btn.tw { background-color: #1DA1F2; }
.share-social-btn.tg { background-color: #229ED9; }

.share-divider-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  position: relative;
  margin-bottom: 16px;
}
.share-divider-text::before,
.share-divider-text::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 25%;
  height: 1px;
  background-color: var(--border-light);
}
.share-divider-text::before { right: 0; }
.share-divider-text::after { left: 0; }

.share-link-copy-wrap {
  display: flex;
  gap: 8px;
}
.share-link-copy-wrap .form-input {
  flex-grow: 1;
  font-size: 0.85rem;
  text-align: left;
}

@media (max-width: 480px) {
  .share-social-grid {
    grid-template-columns: 1fr;
  }
}

