/* --------------------------------------------------
   Maktabah Ma'had Dar El-Ilmi - Design System & CSS
   -------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* --- CSS VARIABLES & TOKENS --- */
:root {
  /* Colors */
  --color-primary: #00AEEF;      /* Cyan Blue */
  --color-secondary: #003366;    /* Navy Blue */
  --color-accent: #F7491D;       /* Accent Orange */
  --color-accent-hover: #dd3912;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  
  /* Light Theme (Default) */
  --bg-primary: #ffffff;
  --bg-secondary: #F8FAFC;
  --bg-tertiary: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border-color: #E2E8F0;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px 0 rgba(0, 51, 102, 0.06);
  
  /* Font Family */
  --font-title: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- DARK MODE VARIABLES --- */
body.dark-mode {
  --bg-primary: #090D16;
  --bg-secondary: #111827;
  --bg-tertiary: #1F2937;
  --text-primary: #F3F4F6;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --border-color: #1F2937;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  --glass-bg: rgba(9, 13, 22, 0.85);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* --- BASICS & LAYOUTS --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: #F1F5F9; /* Desktop gray background */
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-normal);
}

/* Container Frame for Mobile feeling on Desktop */
.app-container {
  width: 100%;
  max-width: 480px; /* Lebar HP standard */
  min-height: 100vh;
  background-color: var(--bg-primary);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 75px; /* Beri ruang untuk Bottom Nav */
  transition: background-color var(--transition-normal);
}

/* Reset for Admin Panel - Full Width */
body.admin-mode {
  display: block !important;
  background-color: var(--bg-secondary) !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
}
body.admin-mode .app-container {
  max-width: 100% !important;
  box-shadow: none !important;
  padding-bottom: 0 !important;
}

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

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--text-primary);
}

/* --- SPLASH SCREEN --- */
#splash-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, #003366 0%, #001F3F 100%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}
#splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}
.splash-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  animation: pulseLogo 2s infinite ease-in-out;
}
.splash-title {
  font-size: 24px;
  font-family: var(--font-title);
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  color: #ffffff;
}
.splash-subtitle {
  font-size: 14px;
  color: var(--color-primary);
  font-weight: 500;
  margin-bottom: 40px;
}
.splash-loader {
  width: 48px;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.splash-loader-bar {
  width: 40%;
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
  position: absolute;
  left: -40%;
  animation: loadingSlide 1.5s infinite linear;
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(0, 174, 239, 0.3)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 25px rgba(0, 174, 239, 0.6)); }
}
@keyframes loadingSlide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* --- GOOGLE LOGIN OVERLAY --- */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 51, 102, 0.95);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  color: white;
  transition: opacity var(--transition-normal);
}
.login-overlay.hidden {
  display: none;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-card h3 {
  font-size: 22px;
  margin-bottom: 12px;
}
.login-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 30px;
  line-height: 1.5;
}
.login-btn-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.login-skip-btn {
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 500;
  padding: 8px 16px;
  transition: color var(--transition-fast);
}
.login-skip-btn:hover {
  color: var(--color-primary);
}

/* --- HEADER --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--glass-shadow);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  width: 32px;
  height: 32px;
}
.header-title {
  font-size: 16px;
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--color-secondary);
}
body.dark-mode .header-title {
  color: var(--color-primary);
}
.header-actions {
  display: flex;
  gap: 12px;
}
.header-icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  transition: all var(--transition-fast);
}
.header-icon-btn:active {
  transform: scale(0.9);
}

/* --- BOTTOM NAVIGATION --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 480px; /* Sesuai app-container */
  background-color: var(--glass-bg);
  backdrop-filter: blur(15px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 998;
  box-shadow: var(--glass-shadow);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  gap: 4px;
  flex: 1;
  transition: color var(--transition-fast);
}
.nav-item i {
  font-size: 20px;
  transition: transform var(--transition-fast);
}
.nav-item.active {
  color: var(--color-primary);
}
.nav-item.active i {
  transform: translateY(-2px);
  color: var(--color-primary);
}

/* --- HERO SECTION --- */
.hero {
  padding: 24px 20px;
  background: linear-gradient(135deg, rgba(0, 51, 102, 0.05) 0%, rgba(0, 174, 239, 0.05) 100%);
  border-bottom: 1px solid var(--border-color);
}
.hero-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 8px;
}
.hero-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 20px;
}

/* --- SEARCH BAR --- */
.search-wrapper {
  position: relative;
  width: 100%;
}
.search-input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px 14px 46px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--card-shadow);
  outline: none;
  transition: all var(--transition-fast);
}
.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.15);
}
.search-wrapper i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

/* --- CATEGORY SLIDER --- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 20px 12px 20px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
}
.section-link {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 600;
}

.category-container {
  padding: 0 20px;
}
.category-slider {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 0;
  scrollbar-width: none;
}
.category-slider::-webkit-scrollbar {
  display: none;
}
.category-pill {
  flex: 0 0 auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.category-pill:active {
  transform: scale(0.95);
}
.category-pill.active {
  background-color: var(--color-secondary);
  color: #ffffff;
  border-color: var(--color-secondary);
}
body.dark-mode .category-pill.active {
  background-color: var(--color-primary);
  color: var(--color-secondary);
  border-color: var(--color-primary);
}

/* --- CONTINUE READING SECTION --- */
.continue-reading-card {
  margin: 0 20px;
  background: linear-gradient(135deg, var(--color-secondary) 0%, #002244 100%);
  border-radius: var(--radius-md);
  padding: 18px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0, 51, 102, 0.15);
}
.continue-reading-card::after {
  content: '';
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(0, 174, 239, 0.15) 0%, transparent 70%);
  border-radius: var(--radius-full);
}
.cr-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-primary);
  font-weight: 700;
  margin-bottom: 8px;
}
.cr-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #ffffff;
}
.cr-author {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
}
.cr-progress-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cr-progress-bar {
  flex: 1;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.cr-progress-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
}
.cr-percent {
  font-size: 12px;
  font-weight: 700;
}
.cr-btn {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: var(--color-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(0, 174, 239, 0.3);
}

/* --- HORIZONTAL BOOK SCROLL --- */
.books-horizontal {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 6px 20px;
  scrollbar-width: none;
}
.books-horizontal::-webkit-scrollbar {
  display: none;
}

/* --- BOOK CARD UI (Clean, Elegant) --- */
.book-card {
  flex: 0 0 140px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition-fast);
}
.book-card:active {
  transform: scale(0.97);
}
.book-cover-wrapper {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-tertiary);
  box-shadow: var(--card-shadow);
  margin-bottom: 10px;
  position: relative;
}
.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}
.book-card:hover .book-cover {
  transform: scale(1.05);
}
.book-badge {
  position: absolute;
  top: 8px; left: 8px;
  background-color: var(--color-secondary);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  text-transform: uppercase;
}
body.dark-mode .book-badge {
  background-color: var(--color-primary);
  color: var(--color-secondary);
}
.book-bookmark-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: all var(--transition-fast);
}
.book-bookmark-btn.active {
  color: var(--color-accent);
}
.book-bookmark-btn:active {
  transform: scale(0.9);
}
.book-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 36px;
}
.book-author {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}
.book-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}
.book-read-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-tertiary);
  border: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-secondary);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
body.dark-mode .book-read-btn {
  color: var(--color-primary);
}
.book-read-btn:active {
  background-color: var(--color-primary);
  color: white;
}

/* Grid Book Layout (Vertical List) */
.books-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 20px;
}
.books-grid .book-card {
  flex: none;
  width: 100%;
}

/* --- REKOMENDASI HARI INI (Large Card) --- */
.recommendation-card {
  margin: 0 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  gap: 16px;
  box-shadow: var(--card-shadow);
}
.rec-cover {
  width: 100px;
  height: 140px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.rec-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.rec-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.rec-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}
.rec-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rec-btn {
  align-self: flex-start;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: var(--color-secondary);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 174, 239, 0.2);
}

/* --- ARTIKEL LITERASI --- */
.article-card {
  margin: 0 20px 16px 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}
.article-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
}
.article-body {
  padding: 16px;
}
.article-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
.article-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 10px;
}
.article-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* --- DETAIL BUKU (LAYOUT PREMIUM) --- */
.book-detail-hero {
  background: linear-gradient(to bottom, rgba(0, 51, 102, 0.08) 0%, rgba(255,255,255,0) 100%);
  padding: 30px 20px 20px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.detail-cover {
  width: 160px;
  height: 230px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: 0 15px 35px rgba(0, 51, 102, 0.15);
  margin-bottom: 20px;
}
.detail-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.3;
}
.detail-author {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 12px;
}
.detail-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}
.detail-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}
.badge-difficulty {
  background-color: rgba(0, 174, 239, 0.1);
  color: var(--color-primary);
}
.badge-category {
  background-color: rgba(0, 51, 102, 0.1);
  color: var(--color-secondary);
}
body.dark-mode .badge-category {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.detail-stats {
  display: flex;
  justify-content: space-around;
  width: 100%;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 0;
  margin-bottom: 24px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.detail-description {
  padding: 0 20px;
  margin-bottom: 24px;
}
.detail-description h4 {
  font-size: 15px;
  margin-bottom: 8px;
}
.detail-desc-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
}
.detail-desc-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.desc-toggle-btn {
  display: inline-block;
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 600;
  margin-top: 6px;
  cursor: pointer;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px;
  margin-bottom: 30px;
}
.btn-primary {
  width: 100%;
  background-color: var(--color-primary);
  color: var(--color-secondary);
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(0, 174, 239, 0.25);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-secondary {
  width: 100%;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-secondary:active {
  transform: scale(0.98);
}
.btn-accent {
  width: 100%;
  background-color: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(247, 73, 29, 0.25);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-accent:active {
  transform: scale(0.98);
}

/* --- IMMERSIVE READER UI (`baca.php`) --- */
.reader-wrapper {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #f5f5f5;
  z-index: 10000;
  display: flex;
  flex-direction: column;
}
.reader-canvas-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}
.reader-canvas-page {
  background-color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  margin-bottom: 20px;
  max-width: 100%;
  transition: filter var(--transition-normal);
}

/* Header & Footer Melayang Reader */
.reader-overlay-panel {
  position: absolute;
  left: 0; right: 0;
  background-color: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10001;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}
.reader-header {
  top: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transform: translateY(0);
}
.reader-header.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.reader-footer {
  bottom: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-direction: column;
  gap: 12px;
  transform: translateY(0);
}
.reader-footer.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.reader-title-info {
  max-width: 60%;
}
.reader-book-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-book-author {
  font-size: 11px;
  color: #94a3b8;
}
.reader-header-actions {
  display: flex;
  gap: 12px;
}
.reader-btn {
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 20px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}
.reader-btn:active {
  background-color: rgba(255,255,255,0.1);
}

/* Controls inside Reader Footer */
.reader-slider-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}
.page-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  outline: none;
}
.page-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0,174,239,0.5);
}
.reader-page-indicator {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  min-width: 60px;
  text-align: right;
}

/* Floating Controls (Mini Taps in the Center) */
.reader-tap-zone {
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 20%;
  right: 20%;
  z-index: 9999;
}

/* Reader Settings Modal */
.reader-settings-modal {
  position: absolute;
  bottom: 85px;
  left: 16px;
  right: 16px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 20px;
  z-index: 10002;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity var(--transition-normal);
  transform: translateY(0);
}
.reader-settings-modal.hidden {
  transform: translateY(150px);
  opacity: 0;
  pointer-events: none;
}
.settings-option-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.theme-selector {
  display: flex;
  gap: 10px;
}
.theme-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.theme-btn.theme-light { background-color: #ffffff; color: #1a1a1a; }
.theme-btn.theme-sepia { background-color: #f4ecd8; color: #5b4636; border-color: #e4dcc8; }
.theme-btn.theme-dark { background-color: #121212; color: #e0e0e0; border-color: #222; }
.theme-btn.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(0, 174, 239, 0.2);
}
.zoom-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}
.zoom-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
}
.zoom-val {
  font-size: 14px;
  font-weight: 700;
}

/* Reader Filters on Canvas */
.reader-theme-sepia .reader-canvas-page {
  filter: sepia(0.6) contrast(0.95);
}
.reader-theme-sepia {
  background-color: #f4ecd8 !important;
}
.reader-theme-dark .reader-canvas-page {
  filter: invert(0.9) hue-rotate(180deg);
}
.reader-theme-dark {
  background-color: #121212 !important;
}

.reader-progress-bar {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  background-color: var(--color-primary);
  transition: width 0.1s ease;
}

/* --- CAMPAIGN CARD MODAL (In-App Announcement) --- */
.campaign-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 51, 102, 0.4);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  transition: opacity var(--transition-normal);
}
.campaign-overlay.hidden {
  display: none;
}
.campaign-card {
  width: 100%;
  max-width: 360px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  display: flex;
  flex-direction: column;
}
.campaign-close-btn {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  z-index: 1;
  cursor: pointer;
}
.campaign-banner {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.campaign-body {
  padding: 20px;
}
.campaign-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.campaign-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* --- AKUN / PROFILE PAGE --- */
.profile-card {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--color-primary);
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}
.profile-name {
  font-size: 18px;
  font-weight: 700;
}
.profile-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.profile-stats-row {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}
.profile-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.profile-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-secondary);
}
body.dark-mode .profile-stat-val {
  color: var(--color-primary);
}

.menu-list {
  padding: 10px 20px;
}
.menu-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 0 8px 0;
  letter-spacing: 0.5px;
}
.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}
.menu-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}
.menu-item i {
  font-size: 18px;
}
.menu-item-left i {
  color: var(--text-secondary);
}

/* Switch Toggle Styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}
.slider-switch:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
input:checked + .slider-switch {
  background-color: var(--color-primary);
}
input:checked + .slider-switch:before {
  transform: translateX(20px);
}

/* --- ADMIN DASHBOARD LAYOUT & STYLES --- */
.admin-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar styling */
.admin-sidebar {
  width: 260px;
  background-color: var(--color-secondary);
  color: white;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 1001;
  transition: transform var(--transition-normal);
}

.admin-sidebar-header {
  padding: 0 24px 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 20px;
}

.admin-sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.admin-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  border-left: 4px solid transparent;
  transition: all var(--transition-fast);
}

.admin-menu-link:hover, .admin-menu-link.active {
  color: white;
  background-color: rgba(255,255,255,0.05);
}

.admin-menu-link.active {
  border-left-color: var(--color-primary);
  background-color: rgba(0, 174, 239, 0.1);
}

.admin-content {
  flex: 1;
  padding: 30px;
  background-color: var(--bg-tertiary);
  overflow-y: auto;
  min-width: 0; /* Penting untuk mencegah grid/tabel merusak flexbox layout */
}

/* Mobile topbar (Hidden on desktop) */
.admin-mobile-topbar {
  display: none;
}

/* Sidebar overlay on mobile */
.admin-sidebar-overlay {
  display: none;
}

/* Responsive grid classes */
.admin-grid-2, .admin-grid-1-2, .admin-grid-2-1 {
  display: grid;
  gap: 20px;
  margin-bottom: 30px;
}
.admin-grid-2 > *, .admin-grid-1-2 > *, .admin-grid-2-1 > * {
  min-width: 0;
}

.admin-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.admin-grid-1-2 {
  grid-template-columns: 1fr 2fr;
}

.admin-grid-2-1 {
  grid-template-columns: 2fr 1fr;
}

/* Stats Cards styling */
.admin-card-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card-left {
  display: flex;
  flex-direction: column;
}

.stat-card-title {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat-card-val {
  font-size: 26px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--text-primary);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background-color: rgba(0, 174, 239, 0.1);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

/* Tables and Admin CRUD Elements */
.admin-panel-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--card-shadow);
  margin-bottom: 30px;
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap; /* Mencegah wrap pada th/td agar horizontal scroll aktif */
}

.admin-table th, .admin-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  background-color: var(--bg-secondary);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.admin-table td {
  font-size: 13.5px;
  color: var(--text-primary);
}

.admin-table tr:hover {
  background-color: var(--bg-secondary);
}

.badge-table {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: inline-block;
}

.badge-table-pdf { background-color: rgba(247, 73, 29, 0.1); color: var(--color-accent); }
.badge-table-link { background-color: rgba(0, 174, 239, 0.1); color: var(--color-primary); }

.admin-actions-cell {
  display: flex;
  gap: 12px;
}

.btn-table-edit {
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: transform var(--transition-fast);
}

.btn-table-delete {
  color: var(--color-accent);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: transform var(--transition-fast);
}

.btn-table-edit:hover, .btn-table-delete:hover {
  transform: scale(1.15);
}

/* Forms in Admin Panel */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.1);
}

.btn-admin-submit {
  padding: 12px 24px;
  background-color: var(--color-secondary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.btn-admin-submit:hover {
  background-color: #002244;
}

.btn-admin-submit:active {
  transform: scale(0.98);
}

/* --- UTILITY CLASSES --- */
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.p-20 { padding: 20px; }
.text-center { text-align: center; }
.d-none { display: none !important; }

/* Responsive adjustments */
@media (max-width: 992px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 280px;
    height: 100vh;
    transform: translateX(0);
    transition: left var(--transition-normal);
    box-shadow: 10px 0 30px rgba(0,0,0,0.15);
  }
  
  .admin-sidebar.open {
    left: 0;
  }
  
  .admin-layout {
    flex-direction: column;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  .admin-content {
    padding: 20px;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .admin-content > div:first-child h2 {
    font-size: 18px !important;
    line-height: 1.3;
    word-break: break-word;
  }
  
  .admin-content > div:first-child > div {
    width: 100% !important;
  }
  
  .admin-content > div:first-child .btn-secondary {
    width: 100% !important;
    justify-content: center;
    display: inline-flex !important;
  }

  body.admin-mode .btn-admin-submit {
    width: 100% !important;
    justify-content: center;
    display: inline-flex !important;
  }
  
  .admin-panel-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  
  .admin-panel-header .btn-primary, 
  .admin-panel-header .btn-secondary {
    width: 100% !important;
    justify-content: center;
    display: inline-flex !important;
  }
  
  .admin-mobile-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-secondary);
    padding: 14px 20px;
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  
  .admin-mobile-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .admin-mobile-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 17px;
  }
  
  .admin-mobile-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--color-primary);
  }
  
  .admin-sidebar-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    backdrop-filter: blur(2px);
  }
  
  .admin-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  .admin-content {
    padding: 16px;
  }
  
  .admin-panel-card {
    padding: 16px !important;
  }
  
  .admin-grid-2, .admin-grid-1-2, .admin-grid-2-1 {
    grid-template-columns: 1fr;
    width: 100% !important;
  }
  .admin-grid-2 > *, .admin-grid-1-2 > *, .admin-grid-2-1 > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .form-group.full-width {
    grid-column: span 1;
  }
  
  /* Topbar header bar in content on mobile should wrap */
  .admin-content > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  
  .admin-content > div:first-child .btn-secondary {
    width: 100%;
    text-align: center;
  }
}
