@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
  /* Brand */
  --primary:           #002D62;
  --primary-dark:      #001B3D;
  --primary-light:     #0047A0;
  --secondary:         #E3B23C;
  --secondary-hover:   #D4A02A;
  --accent:            #E3B23C;

  /* Status */
  --success:  #10B981;
  --danger:   #EF4444;
  --warning:  #F59E0B;
  --info:     #3B82F6;

  /* Neutrals — Light Mode */
  --bg-body:      #F9FAFB;
  --bg-card:      #FFFFFF;
  --bg-sidebar:   #0F172A;
  --bg-light:     #F3F4F6;
  --bg-input:     #F8FAFC;
  --dark:         #1F2937;

  --text-heading:  #111827;
  --text-body:     #374151;
  --text-muted:    #6B7280;
  --text-on-dark:  #F9FAFB;
  --border-color:  #E5E7EB;

  /* Sidebar link color */
  --sidebar-link:  #94A3B8;
  --sidebar-hover: #F8FAFC;

  /* Sizing */
  --header-height: 68px;
  --sidebar-width: 260px;
  --admin-topbar-height: 56px;

  /* Radius */
  --radius:    12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-sm:      0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow:         0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.05);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-premium: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --shadow-nav:     0 8px 32px rgba(0,45,98,0.15);

  /* Typography — fluid scale */
  --font-base: 'Inter', 'Lexend', sans-serif;
  --fs-xs:   clamp(0.7rem,  1.5vw,  0.8rem);
  --fs-sm:   clamp(0.8rem,  1.8vw,  0.9rem);
  --fs-base: clamp(0.9rem,  2vw,    1rem);
  --fs-md:   clamp(1rem,    2.5vw,  1.1rem);
  --fs-lg:   clamp(1.15rem, 3vw,    1.35rem);
  --fs-xl:   clamp(1.4rem,  4vw,    1.75rem);
  --fs-2xl:  clamp(1.75rem, 5vw,    2.25rem);
  --fs-3xl:  clamp(2rem,    6vw,    2.75rem);
  --fs-hero: clamp(2.1rem,  7vw,    3.0rem);

  --transition:      all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* ─── DARK MODE ─────────────────────────────────────────────── */
body.dark-mode {
  --bg-body:      #0B1628;
  --bg-card:      #1A2744;
  --bg-light:     #1E2E4A;
  --bg-input:     #162038;
  --dark:         #E2E8F0;
  --text-heading: #F1F5F9;
  --text-body:    #CBD5E1;
  --text-muted:   #94A3B8;
  --border-color: #2D4070;
  --shadow:       0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg:    0 10px 15px -3px rgba(0,0,0,0.5);
  --bg-sidebar:   #060F1F;
  --sidebar-link: #7D9BC1;
  --sidebar-hover:#E2E8F0;
}

body.dark-mode a { color: #7EB5FF; }
body.dark-mode a:hover { color: var(--secondary); }
body.dark-mode .text-primary { color: #7EB5FF !important; }
body.dark-mode .btn-primary { color: #fff; }
body.dark-mode .btn-accent  { color: var(--primary-dark); }
body.dark-mode .btn-outline { border-color: #7EB5FF; color: #7EB5FF; }
body.dark-mode .btn-outline:hover { background: #7EB5FF; color: var(--primary-dark); }
body.dark-mode .btn-secondary { background: var(--bg-light); color: var(--text-heading); border-color: var(--border-color); }
body.dark-mode .admin-sidebar { background: var(--bg-sidebar); }
body.dark-mode .hero-slider .slide-content { background: rgba(0,0,0,0.6); }
body.dark-mode #global-loader { background: rgba(11,22,40,0.92); }
body.dark-mode .form-control { background: var(--bg-input); color: var(--text-heading); border-color: var(--border-color); }
body.dark-mode .form-control:focus { background: var(--bg-card); border-color: #7EB5FF; box-shadow: 0 0 0 4px rgba(126,181,255,0.12); }
body.dark-mode th { color: var(--text-muted); }
body.dark-mode .badge-info    { background: rgba(59,130,246,0.2);  color: #93C5FD; }
body.dark-mode .badge-success { background: rgba(16,185,129,0.2);  color: #6EE7B7; }
body.dark-mode .badge-warning { background: rgba(245,158,11,0.2);  color: #FCD34D; }
body.dark-mode .badge-danger  { background: rgba(239,68,68,0.2);   color: #FCA5A5; }
body.dark-mode .feature-card  { background: var(--bg-card); border-color: var(--border-color); }
body.dark-mode .feature-icon  { background: rgba(126,181,255,0.12); color: #7EB5FF; }
body.dark-mode .nav-drawer    { background: var(--bg-card); }
body.dark-mode .nav-drawer nav a { color: var(--text-heading); }
body.dark-mode .dropdown      { background: var(--bg-card); border-color: var(--border-color); }
body.dark-mode .account-sidebar { background: var(--bg-card); border-color: var(--border-color); }
body.dark-mode .chat-bot-msg  { background: var(--bg-light); color: var(--text-heading); }
body.dark-mode .msg-bubble.received { background: var(--bg-light); color: var(--text-heading); }
body.dark-mode .admin-topbar { background: var(--bg-sidebar); }

/* ─── BOX MODEL RESET ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* FIX: Consolidated into a single, clean focus-visible rule — was duplicated */
* { outline: none; }
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg-body);
  color: var(--text-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

body.admin-layout {
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover { color: var(--secondary); }

img, video, picture, iframe {
  max-width: 100%;
  display: block;
  height: auto;
}

/* FIX: Removed deprecated -webkit-optimize-contrast vendor prefix */
img { image-rendering: auto; }
img[loading="lazy"] { opacity: 0; transition: opacity 0.4s ease; }
img[loading="lazy"].loaded,
img[loading="lazy"]:not([src=""]) { opacity: 1; }

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
h1 { font-size: var(--fs-hero); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

ul, ol { list-style: none; }

/* =========================================
   2. LAYOUT & UTILITIES
   ========================================= */
.container {
  width: min(92%, 1200px);
  margin-inline: auto;
  padding-block: 1.25rem;
}

.main-content { flex: 1; }

.d-flex         { display: flex; }
.flex-column    { flex-direction: column; }
.flex-wrap      { flex-wrap: wrap; }
.flex-grow      { flex-grow: 1; }
.flex-1         { flex: 1; }
.align-center   { align-items: center; }
.align-start    { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }

.d-grid { display: grid; }

.d-none        { display: none !important; }
.d-block       { display: block; }
.d-inline-flex { display: inline-flex; }

@media (min-width: 769px)  { .d-md-none     { display: none !important; } }
@media (max-width: 768px)  { .d-none-mobile { display: none !important; } .d-md-block { display: block; } }

.gap-05 { gap: 0.5rem; }
.gap-1  { gap: 1rem; }
.gap-2  { gap: 2rem; }

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.ml-1 { margin-left: 1rem; }
.mr-1 { margin-right: 1rem; }
.mx-auto { margin-inline: auto; }

.p-0  { padding: 0 !important; }
.p-1  { padding: 1rem; }
.p-2  { padding: 2rem; }
.py-0 { padding-block: 0 !important; }
.py-1 { padding-block: 1rem; }
.py-2 { padding-block: 2rem; }
.py-3 { padding-block: 3rem; }
.px-1 { padding-inline: 1rem; }
.px-2 { padding-inline: 2rem; }

.w-80  { width: 80px; }
.w-250 { width: 250px; }
.w-100 { width: 100%; }
.w-auto{ width: auto; }
.h-100 { height: 100%; }
.h-200 { height: 200px; }
.h-250 { height: 250px; }
.min-h-0 { min-height: 0; }

.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-left     { text-align: left; }
.text-white    { color: #fff !important; }
.text-primary  { color: var(--primary) !important; }
.text-secondary{ color: var(--secondary) !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-success  { color: var(--success) !important; }
.text-danger   { color: var(--danger) !important; }
.text-warning  { color: var(--warning) !important; }
.text-info     { color: var(--info) !important; }
.text-heading  { color: var(--text-heading) !important; }
.font-bold     { font-weight: 700; }
.font-medium   { font-weight: 500; }

.text-truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.text-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bg-light       { background-color: var(--bg-light); }
.bg-white       { background-color: var(--bg-card); }
.bg-primary     { background-color: var(--primary); }
.bg-dark        { background-color: var(--dark); }
.bg-dark-overlay {
  background: rgba(0,0,0,0.5);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.border-top    { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.border-white  { border-color: rgba(255,255,255,0.6) !important; }
.border-0      { border: none !important; }

.rounded         { border-radius: var(--radius); }
.rounded-lg      { border-radius: var(--radius-lg); }
.shadow          { box-shadow: var(--shadow); }
.shadow-lg       { box-shadow: var(--shadow-lg); }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.pos-rel         { position: relative; }
.pos-abs         { position: absolute; }
.top-0           { top: 0; }
.left-0          { left: 0; }
.right-0         { right: 0; }
.bottom-0        { bottom: 0; }
.top-10          { top: 10px; }
.right-10        { right: 10px; }
.m-1             { margin: 1rem; }
.object-cover    { object-fit: cover; }
.object-contain  { object-fit: contain; }
.opacity-90      { opacity: 0.9; }
.opacity-80      { opacity: 0.8; }
.cursor-pointer  { cursor: pointer; }
.user-select-none{ user-select: none; }
.transition      { transition: var(--transition); }

/* =========================================
   3. BUTTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  font-family: var(--font-base);
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: 50px;
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover  { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0);    box-shadow: var(--shadow-sm); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px 0 rgba(0,45,98,0.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,45,98,0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-heading);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-light);
  border-color: var(--text-muted);
  color: var(--text-heading);
}

.btn-accent {
  background: var(--secondary);
  color: var(--primary-dark);
  border-color: var(--secondary);
  font-weight: 700;
}
.btn-accent:hover {
  background: var(--secondary-hover);
  border-color: var(--secondary-hover);
  color: var(--primary-dark);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; border-color: #DC2626; color: #fff; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }

.btn-info { background: var(--info); color: #fff; border-color: var(--info); }

.btn-sm { padding: 0.35rem 0.9rem;  font-size: var(--fs-xs); }
.btn-lg { padding: 0.9rem 2.25rem;  font-size: var(--fs-md); }
.btn-xl { padding: 1.1rem 2.75rem;  font-size: var(--fs-lg); }

@media (max-width: 480px) {
  .btn-block-mobile { width: 100%; justify-content: center; }
}

/* =========================================
   4. FORMS
   ========================================= */
.form-group {
  margin-bottom: 1.25rem;
  position: relative;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--text-heading);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-base);
  font-size: max(var(--fs-base), 16px); /* prevents iOS auto-zoom */
  background: var(--bg-input);
  color: var(--text-heading);
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
.form-control:focus {
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,45,98,0.1);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-light);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  
  /* Keep your white text */
  color: #FFFFFF; 
  
  /* FIX 1: Add a dark background to the select box itself */
  background-color: #1F2937; /* A nice dark gray, change hex to match your theme */
}

/* FIX 2: Ensure the dropdown menu items also have a dark background */
select.form-control option {
  background-color: #1F2937;
  color: #FFFFFF;
}

/* FIX 3 (Optional): Ensure highlighted text looks good if the user drags their cursor */
select.form-control::selection {
  background-color: #4B5563; /* A lighter gray for highlighting */
  color: #FFFFFF;
}

textarea.form-control { resize: vertical; min-height: 120px; }

.password-wrapper { position: relative; }
.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  user-select: none;
  padding: 4px;
  background: none;
  border: none;
  font-family: var(--font-base);
  transition: var(--transition-fast);
}
.password-toggle:hover { color: var(--primary); }

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}
.form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }
.invalid-feedback { color: var(--danger);  font-size: var(--fs-xs); margin-top: 0.25rem; }
.valid-feedback   { color: var(--success); font-size: var(--fs-xs); margin-top: 0.25rem; }

/* =========================================
   5. CARDS
   ========================================= */

/* FIX: Removed redundant background-color:#fff (overridden), background-clip:border-box,
   and fixed inconsistent indentation */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.04);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

/* Admin cards should not lift on hover */
.admin-content .card:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text-heading);
  background: rgba(0,0,0,0.01);
}
.card-body   { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: rgba(0,0,0,0.01);
}

.book-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.book-card img {
  height: 280px;
  object-fit: cover;
  width: 100%;
  transition: transform 0.4s ease;
}
.book-card:hover img { transform: scale(1.04); }
.book-card .card-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}
.book-card .btn { margin-top: auto; }

/* =========================================
   6. TABLES
   ========================================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Table-responsive inside a card — strip double shadow/radius */
.card > .table-responsive,
.card .table-responsive {
  border-radius: 0;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  font-size: var(--fs-sm);
}
thead tr { background: var(--bg-light); }
th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
  vertical-align: middle;
}
tr:last-child td   { border-bottom: none; }
tbody tr:hover td  { background: rgba(0,45,98,0.03); }

/* =========================================
   7. BADGES
   ========================================= */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 50px;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-primary { background: rgba(0,45,98,0.1);   color: var(--primary); }
.badge-info    { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.1); color: #B45309; }
.badge-danger  { background: rgba(239,68,68,0.1);  color: var(--danger); }

/* =========================================
   8. HEADER & NAVIGATION
   ========================================= */
header {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}
header .container {
  padding-block: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
}

.logo {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  text-decoration: none;
}
.logo:hover { color: var(--primary-dark); }
.logo img   { height: 40px; width: auto; }

.header-desktop {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

nav {
  display: flex;
  align-items: center;
}

nav > ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
}

nav > ul > li { position: relative; }

nav > ul > li > a {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.8rem;
  color: var(--text-heading);
  font-weight: 500;
  font-size: var(--fs-sm);
  border-radius: 8px;
  transition: var(--transition-fast);
  white-space: nowrap;
}
nav > ul > li > a:hover,
nav > ul > li > a.active {
  color: var(--primary);
  background: rgba(0,45,98,0.06);
}
nav > ul > li > a .nav-chevron {
  font-size: 0.65em;
  transition: transform 0.25s ease;
}
nav > ul > li:hover > a .nav-chevron { transform: rotate(180deg); }

.nav-cart-wrap { position: relative; }
.nav-cart-badge {
  position: absolute;
  top: -4px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-nav);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1000;
  list-style: none;
}
.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown li a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.875rem;
  color: var(--text-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: 8px;
  transition: var(--transition-fast);
  white-space: nowrap;
}
.dropdown li a:hover { background: var(--bg-light); color: var(--primary); }
.dropdown li a i { width: 1rem; text-align: center; color: var(--text-muted); }
.dropdown li + li { margin-top: 0.1rem; }
.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.4rem 0;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-heading);
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: var(--transition-fast);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.menu-toggle:hover { background: var(--border-color); }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1998;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.nav-overlay.open { opacity: 1; }

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--bg-card);
  z-index: 1999;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-premium);
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.nav-drawer-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-heading);
  font-size: 1rem;
  transition: var(--transition-fast);
}
.nav-drawer-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.nav-drawer nav { flex: 1; padding: 1rem; }
.nav-drawer nav > ul {
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
}
.nav-drawer nav > ul > li { width: 100%; }
.nav-drawer nav > ul > li > a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-heading);
  font-weight: 500;
  font-size: var(--fs-base);
  border-radius: var(--radius);
  transition: var(--transition-fast);
  width: 100%;
  justify-content: space-between;
}
.nav-drawer nav > ul > li > a:hover,
.nav-drawer nav > ul > li > a.active {
  background: rgba(0,45,98,0.07);
  color: var(--primary);
}
.nav-drawer-link-left { display: flex; align-items: center; gap: 0.75rem; }
.nav-drawer-link-left i { width: 1.25rem; text-align: center; color: var(--primary); }

.nav-drawer .drawer-sub {
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  padding-left: 2.5rem;
  padding-bottom: 0.5rem;
}
.nav-drawer .drawer-sub.open { display: flex; }
.nav-drawer .drawer-sub li a {
  display: block;
  padding: 0.55rem 0.75rem;
  color: var(--text-body);
  font-size: var(--fs-sm);
  border-radius: 8px;
}
.nav-drawer .drawer-sub li a:hover { background: var(--bg-light); color: var(--primary); }

.nav-drawer-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-toggle-btn {
  background: transparent;
  border: 1.5px solid var(--border-color);
  padding: 0.4rem 0.875rem;
  border-radius: 20px;
  color: #FFFFFF;
  font-size: var(--fs-xs);
  font-weight: 500;
  font-family: var(--font-base);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.theme-toggle-btn:hover { background: var(--bg-light); border-color: var(--text-muted); }

.header-select-form select.form-control {
  padding: 0.3rem 2rem 0.3rem 0.6rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  background-color: transparent;
  border-color: var(--border-color);
  border-radius: 8px;
  height: auto;
  min-width: 0;
  cursor: pointer;
}

/* =========================================
   9. HERO / IMAGE SLIDER
   ========================================= */
.hero-slider {
  position: relative;
  width: 100%;
  height: clamp(340px, 55vw, 600px);
  overflow: hidden;
  border-radius: var(--radius-xl);
  margin-bottom: 3rem;
  box-shadow: var(--shadow-premium);
  background: var(--dark);
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.9s ease-in-out;
  pointer-events: none;
}
.slide.active { opacity: 1; pointer-events: auto; }
.slide > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 8s ease;
}
.slide.active > img { transform: scale(1.05); }

.slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,45,98,0.55) 100%);
}

.slide-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  max-width: min(680px, 90%);
  animation: slideUp 0.6s ease 0.3s both;
}
.slide.active .slide-content { animation: slideUp 0.6s ease 0.3s both; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.slide-content h1 {
  font-size: clamp(1.5rem, 4.5vw, 2.5rem);
  color: #fff;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  font-weight: 800;
}
.slide-content p {
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  color: rgba(255,255,255,0.92);
  margin-bottom: 1.5rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
  color: #fff;
  width: clamp(36px, 5vw, 48px);
  height: clamp(36px, 5vw, 48px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  transition: var(--transition);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent;
}
.slider-btn:hover { background: rgba(255,255,255,0.35); transform: translateY(-50%) scale(1.1); }
.slider-prev { left: clamp(8px, 2.5vw, 20px); }
.slider-next { right: clamp(8px, 2.5vw, 20px); }

.slider-dots {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}
.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}
.slider-dot.active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}

.hero-section {
  position: relative;
  min-height: clamp(300px, 50vw, 560px);
  background: linear-gradient(rgba(0,45,98,0.72), rgba(0,45,98,0.72)),
              url('images/hero-bg.jpg') center/cover no-repeat;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-premium);
  padding: clamp(2rem, 5vw, 4rem) 1.5rem;
}
.hero-content h1 {
  font-size: var(--fs-hero);
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
  margin-bottom: 1rem;
}
.hero-content p {
  font-size: var(--fs-lg);
  opacity: 0.92;
  margin-bottom: 2rem;
  max-width: 580px;
  margin-inline: auto;
}

/* =========================================
   10. HOMEPAGE SECTIONS
   ========================================= */
.section-title { text-align: center; margin-bottom: 2.5rem; }
.section-title h2 { font-size: var(--fs-3xl); color: var(--primary); margin-bottom: 0.4rem; }
.section-title p  { color: var(--text-muted); font-size: var(--fs-md); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(180px, 22vw, 260px), 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-bottom: 3.5rem;
}
.feature-card {
  text-align: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid transparent;
}
.feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.feature-icon {
  width: clamp(52px, 8vw, 64px);
  height: clamp(52px, 8vw, 64px);
  background: rgba(0,45,98,0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  color: var(--primary);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}
.feature-card h3 { font-size: var(--fs-md); margin-bottom: 0.5rem; }
.feature-card p  { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 0; }

.grid-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(160px, 22vw, 220px), 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
}

.cta-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  text-align: center;
  padding: clamp(2rem, 5vw, 4rem) 1.5rem;
}
.cta-banner h2 { color: #fff; }
.cta-banner p  { color: rgba(255,255,255,0.88); }

/* =========================================
   11. ACCOUNT / DASHBOARD LAYOUT
   ========================================= */
.account-layout {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
  align-items: flex-start;
}
.account-sidebar {
  width: min(280px, 30vw);
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1rem;
  border: 1px solid var(--border-color);
  position: sticky;
  top: calc(var(--header-height) + 1rem);
}
.user-brief {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.user-avatar {
  width: 72px;
  height: 72px;
  background: var(--bg-light);
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--text-muted);
  border: 2px solid var(--border-color);
}
.account-nav { list-style: none; }
.account-nav li { margin-bottom: 0.15rem; }
.account-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  color: var(--text-body);
  font-weight: 500;
  font-size: var(--fs-sm);
  transition: var(--transition-fast);
}
.account-nav a:hover { background: var(--bg-light); color: var(--primary); }
.account-nav a.active {
  background: rgba(0,45,98,0.07);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding-left: 0.85rem;
}
.account-nav i      { width: 18px; text-align: center; font-size: 0.9em; }
.account-content    { flex: 1; min-width: 0; }

/* =========================================
   12. ADMIN LAYOUT — SIDEBAR + CONTENT
   ========================================= */
body.admin-layout {
  flex-direction: row !important;
  overflow: hidden;
  height: 100vh;
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1),
              width 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.admin-sidebar::-webkit-scrollbar       { width: 4px; }
.admin-sidebar::-webkit-scrollbar-track { background: transparent; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.admin-sidebar .logo { color: #fff; }
.admin-sidebar .sidebar-main {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.admin-sidebar ul { list-style: none; padding: 0.75rem; }
.admin-sidebar li { margin-bottom: 0.25rem; }
.admin-sidebar a {
  color: var(--sidebar-link);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  transition: var(--transition-fast);
  font-weight: 500;
  font-size: var(--fs-sm);
  text-decoration: none;
}
.admin-sidebar a:hover {
  background: rgba(255,255,255,0.08);
  color: var(--sidebar-hover);
}
.admin-sidebar a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left: 3px solid var(--secondary);
  padding-left: 0.85rem;
}
.admin-sidebar i { width: 1.1rem; text-align: center; font-size: 0.9em; opacity: 0.8; }

.sidebar-section-label {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  margin-top: 0.25rem;
}

.admin-content {
  flex: 1;
  min-width: 0;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-body);
  height: 100vh;
}

.admin-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: var(--bg-sidebar);
  height: var(--admin-topbar-height);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 999;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.admin-topbar .logo         { color: #fff; font-size: var(--fs-md); }
.admin-topbar .logo:hover   { color: var(--secondary); }
.admin-topbar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.admin-topbar-toggle:hover { background: rgba(255,255,255,0.15); }

.admin-menu-toggle {
  display: none;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.45rem 0.875rem;
  color: var(--text-heading);
  font-family: var(--font-base);
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.admin-menu-toggle:hover { background: var(--bg-light); }

.admin-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1998; cursor: pointer; }
.admin-overlay.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(160px, 22vw, 220px), 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--border-color);
}
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}
.stat-card .stat-value {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =========================================
   13. CHAT WIDGET
   ========================================= */
#chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,45,98,0.45);
  display: flex !important;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 5000;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
#chat-widget:hover { transform: scale(1.1); box-shadow: 0 6px 22px rgba(0,45,98,0.55); }

#chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: clamp(300px, 90vw, 360px);
  height: min(500px, 70vh);
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-premium);
  display: none;
  flex-direction: column;
  z-index: 5000;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.chat-header {
  padding: 0.875rem 1rem;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header span { font-weight: 600; font-size: var(--fs-sm); }

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg-light);
  -webkit-overflow-scrolling: touch;
}
.chat-user-msg {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 0.875rem;
  border-radius: 14px 14px 2px 14px;
  max-width: 82%;
  font-size: var(--fs-sm);
  word-wrap: break-word;
}
.chat-bot-msg {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-heading);
  padding: 0.65rem 0.875rem;
  border-radius: 14px 14px 14px 2px;
  max-width: 82%;
  font-size: var(--fs-sm);
  word-wrap: break-word;
}
.chat-input {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  background: var(--bg-card);
}
.chat-input .form-control { font-size: 14px; padding: 0.55rem 0.875rem; }

.chat-list-pane {
  width: min(300px, 100%);
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  padding-right: 1rem;
  overflow-y: auto;
}
.chat-view-pane {
  flex-grow: 1;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.messages-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.04);
}
.msg-bubble {
  max-width: 72%;
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 18px;
  font-size: var(--fs-sm);
  word-wrap: break-word;
}
.msg-bubble.sent {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-bubble.received {
  align-self: flex-start;
  background: #E5E7EB;
  color: var(--text-heading);
  border-bottom-left-radius: 4px;
}

/* =========================================
   14. TOASTS
   ========================================= */
#toast-container {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  background: var(--dark);
  color: #fff;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastSlideIn 0.3s ease;
  font-size: var(--fs-sm);
  pointer-events: auto;
  min-width: 240px;
}
.toast-success { background: var(--success); }
.toast-danger  { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--dark); }
.toast-info    { background: var(--info); }

@keyframes toastSlideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* =========================================
   15. GLOBAL LOADER
   ========================================= */
#global-loader {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
#global-loader.active { opacity: 1; pointer-events: all; }

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================
   16. READER / WATERMARK
   ========================================= */
.reader-content     { position: relative; min-height: 80vh; }
.watermark-overlay  { position: absolute; inset: 0; pointer-events: none; z-index: 100; }

/* =========================================
   17. FOOTER
   ========================================= */
footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
footer a { color: var(--text-muted); transition: var(--transition-fast); }
footer a:hover { color: var(--primary); }
body.dark-mode footer a       { color: var(--text-muted); }
body.dark-mode footer a:hover { color: #7EB5FF; }

/* =========================================
   18. MISC COMPONENTS
   ========================================= */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: var(--fs-sm);
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.alert-success { background: rgba(16,185,129,0.1);  border-color: var(--success); color: #065F46; }
.alert-danger  { background: rgba(239,68,68,0.1);   border-color: var(--danger);  color: #991B1B; }
.alert-warning { background: rgba(245,158,11,0.1);  border-color: var(--warning); color: #92400E; }
.alert-info    { background: rgba(59,130,246,0.1);  border-color: var(--info);    color: #1E40AF; }
body.dark-mode .alert-success { color: #6EE7B7; }
body.dark-mode .alert-danger  { color: #FCA5A5; }
body.dark-mode .alert-warning { color: #FCD34D; }
body.dark-mode .alert-info    { color: #93C5FD; }

.pagination {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-body);
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 0 0.5rem;
}
.page-btn:hover    { background: var(--bg-light); color: var(--primary); border-color: var(--primary); }
.page-btn.active   { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.progress-wrap { background: var(--bg-light); border-radius: 50px; overflow: hidden; height: 8px; }
.progress-bar  { height: 100%; background: var(--primary); border-radius: 50px; transition: width 0.4s ease; }

.divider { height: 1px; background: var(--border-color); margin: 1.5rem 0; }

/* =========================================
   19. TOOLBAR ACTIONS
   ========================================= */
.toolbar-actions {
  padding-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
}

/* On mobile: currency form spans full width and centers */
.toolbar-actions > form:last-child {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 200px;
}

@media (min-width: 768px) {
  .toolbar-actions {
    grid-template-columns: auto auto auto;
    /* FIX: justify-content:flex-end is not valid on grid — use end */
    justify-content: end;
  }

  .toolbar-actions > form:last-child {
    grid-column: auto;
    justify-self: auto;
    max-width: none;
  }
}

/* =========================================
   20. FLEXBOX GRID SYSTEM
   ========================================= */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

[class*="col-"] {
  position: relative;
  width: 100%;
  padding: 10px;
}

/* Mobile (default) */
.col-1  { width: 8.333333%; }
.col-2  { width: 16.666667%; }
.col-3  { width: 25%; }
.col-4  { width: 33.333333%; }
.col-5  { width: 41.666667%; }
.col-6  { width: 50%; }
.col-7  { width: 58.333333%; }
.col-8  { width: 66.666667%; }
.col-9  { width: 75%; }
.col-10 { width: 83.333333%; }
.col-11 { width: 91.666667%; }
.col-12 { width: 100%; }

/* Tablet / md ≥ 768px */
@media (min-width: 768px) {
  .col-md-1  { width: 8.333333%; }
  .col-md-2  { width: 16.666667%; }
  .col-md-3  { width: 25%; }
  .col-md-4  { width: 33.333333%; }
  .col-md-5  { width: 41.666667%; }
  .col-md-6  { width: 50%; }
  .col-md-7  { width: 58.333333%; }
  .col-md-8  { width: 66.666667%; }
  .col-md-9  { width: 75%; }
  .col-md-10 { width: 83.333333%; }
  .col-md-11 { width: 91.666667%; }
  .col-md-12 { width: 100%; }
}

/* Extra large / xl ≥ 1200px */
@media (min-width: 1200px) {
  .col-xl-1  { width: 8.333333%; }
  .col-xl-2  { width: 16.666667%; }
  .col-xl-3  { width: 25%; }
  .col-xl-4  { width: 33.333333%; }
  .col-xl-5  { width: 41.666667%; }
  .col-xl-6  { width: 50%; }
  .col-xl-7  { width: 58.333333%; }
  .col-xl-8  { width: 66.666667%; }
  .col-xl-9  { width: 75%; }
  .col-xl-10 { width: 83.333333%; }
  .col-xl-11 { width: 91.666667%; }
  .col-xl-12 { width: 100%; }
}

/* =========================================
   21. RESPONSIVE — TABLET (≤ 1024px)
   ========================================= */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .hero-slider       { height: clamp(280px, 45vw, 500px); }
  .account-sidebar   { width: min(240px, 35vw); }
  .grid-books        { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .features-grid     { grid-template-columns: repeat(2, 1fr); }
  .admin-content     { padding: 1.5rem; }
}

/* =========================================
   22. RESPONSIVE — TABLET (≤ 900px)
   ========================================= */
@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 2000;
    transform: translateX(-100%);
    height: 100vh;
  }
  .admin-sidebar.active { transform: translateX(0); }

  body.admin-layout {
    flex-direction: column !important;
    height: auto;
    overflow: auto;
  }
  .admin-content {
    width: 100%;
    height: auto;
    min-height: 100vh;
    overflow-y: visible;
    padding: 1rem;
  }

  .admin-topbar      { display: flex; }
  .admin-menu-toggle { display: none !important; }
}

/* =========================================
   23. RESPONSIVE — MOBILE (≤ 768px)
   ========================================= */
@media (max-width: 768px) {
  .container { width: 96%; }

  .menu-toggle     { display: flex; }
  .header-desktop  { display: none; }

  .hero-slider  { border-radius: var(--radius); margin-bottom: 2rem; }
  .hero-section { border-radius: var(--radius); }

  .section-title { margin-bottom: 1.75rem; }

  .grid-books    { grid-template-columns: repeat(2, 1fr); gap: 0.875rem; }
  .book-card img { height: 200px; }

  .account-layout  { flex-direction: column; gap: 1rem; }
  .account-sidebar { width: 100%; position: static; order: -1; }

  .card > table,
  .card .table-responsive { border-radius: 0; }
  .table-responsive table { display: table; }
  th, td { white-space: nowrap; }

  #chat-widget { bottom: 16px; right: 16px; width: 50px; height: 50px; }

  /* ── Chat window: full-screen on mobile ── */
  #chat-window {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
    max-height: 100dvh; /* dvh respects browser chrome on iOS/Android */
  }

  .chat-list-pane {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0 0 1rem;
    max-height: 220px;
  }
  .chat-view-pane { padding-left: 0; }

  #toast-container { top: calc(var(--header-height) + 8px); right: 8px; left: 8px; max-width: 100%; }
  .toast           { min-width: unset; width: 100%; }

  .p-2    { padding: 1.25rem; }
  .py-2   { padding-block: 1.5rem; }
  .gap-2  { gap: 1rem; }
  .card-body   { padding: 1rem; }
  .card-header { padding: 0.875rem 1rem; }

  .features-grid { grid-template-columns: 1fr 1fr; gap: 0.875rem; }
  .btn-lg        { padding: 0.8rem 1.75rem; font-size: var(--fs-base); }
}

/* =========================================
   24. RESPONSIVE — SMALL MOBILE (≤ 480px)
   ========================================= */
@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
  .grid-books    { grid-template-columns: 1fr 1fr; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }

  .btn    { padding: 0.6rem 1.2rem;  font-size: var(--fs-sm); }
  .btn-lg { padding: 0.75rem 1.5rem; font-size: var(--fs-base); }
  .btn-sm { padding: 0.3rem 0.75rem; font-size: var(--fs-xs); }

  .hero-content p { font-size: var(--fs-base); }
  .slider-btn     { width: 32px; height: 32px; font-size: 0.8rem; }

  .p-2  { padding: 1rem; }
  .py-3 { padding-block: 2rem; }
}

/* FIX: Extracted from invalid nested @media — was silently dropped by all browsers */
@media (max-width: 360px) {
  .grid-books { grid-template-columns: 1fr; }
}

/* =========================================
   25. PRINT
   ========================================= */
@media print {
  header, .admin-sidebar, .admin-topbar, #chat-widget, #chat-window,
  #toast-container, #global-loader, .no-print { display: none !important; }
  body { background: white; color: black; font-size: 12pt; }
  .container { width: 100%; max-width: 100%; }
  a { color: black; text-decoration: underline; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
/* =========================================
   26. SKELETON LOADING STATES
   ========================================= */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-light) 25%,
    var(--border-color) 50%,
    var(--bg-light) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite linear;
  border-radius: var(--radius);
  pointer-events: none;
  user-select: none;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 0.9rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}
.skeleton-text.short  { width: 50%; }
.skeleton-text.medium { width: 75%; }
.skeleton-text.long   { width: 100%; }

.skeleton-title {
  height: 1.4rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-img {
  width: 100%;
  height: 200px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.skeleton-btn {
  height: 40px;
  width: 120px;
  border-radius: 50px;
}

/* Skeleton Book Card */
.skeleton-book-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.skeleton-book-card .skeleton-img {
  height: 200px;
  border-radius: 0;
  margin-bottom: 0;
}
.skeleton-book-card .skeleton-body {
  padding: 0.875rem;
}
.skeleton-book-card .skeleton-title {
  margin-bottom: 0.5rem;
}

/* Skeleton Table Row */
.skeleton-row td { vertical-align: middle; }
.skeleton-row .skeleton-text { margin-bottom: 0; }

/* Skeleton Stat Card */
.skeleton-stat {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}
.skeleton-stat .skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  margin-bottom: 1rem;
}

/* Dark mode skeleton */
body.dark-mode .skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-light) 25%,
    rgba(255,255,255,0.05) 50%,
    var(--bg-light) 75%
  );
  background-size: 200% 100%;
}

/* =========================================
   27. PREMIUM FOOTER
   ========================================= */
footer.footer-premium {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.75);
  border-top: none;
  font-size: var(--fs-sm);
}

.footer-main {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(1.5rem, 4vw, 3rem);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
}

/* Tablet View */
@media (max-width: 1024px) {
  .footer-grid { 
    grid-template-columns: repeat(2, 1fr); 
  }
}

/* Mobile View */
@media (max-width: 576px) {
  .footer-grid { 
    /* Changes from 1 column to 2 columns */
    grid-template-columns: repeat(2, 1fr); 
    /* Optional: slightly tighter gap for mobile screens */
    gap: 1.5rem; 
  }

  /* OPTIONAL BUT RECOMMENDED: 
     If your first column is a brand logo/description, it usually looks 
     better spanning the full width on mobile, leaving the menus 2-per-row below it. */
  .footer-grid > *:first-child {
    grid-column: 1 / -1; 
  }
}

.footer-brand .footer-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  text-decoration: none;
}
.footer-brand .footer-logo img { height: 42px; width: auto; }
.footer-brand .footer-logo-text {
  font-size: var(--fs-md);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.footer-brand p {
  color: rgba(255,255,255,0.6);
  font-size: var(--fs-sm);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  max-width: 300px;
}

.footer-social {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.footer-social a {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}
.footer-social a:hover {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--primary-dark);
  transform: translateY(-2px);
}

.footer-col h5 {
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col ul li a {
  color: rgba(255,255,255,0.6);
  transition: var(--transition-fast);
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.footer-col ul li a:hover {
  color: var(--secondary);
  padding-left: 4px;
}

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
  color: rgba(255,255,255,0.6);
  font-size: var(--fs-sm);
}
.footer-contact-item i {
  color: var(--secondary);
  width: 16px;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom p {
  color: rgba(255,255,255,0.45);
  font-size: var(--fs-xs);
  margin: 0;
}

.footer-bottom-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.footer-bottom-links a {
  color: rgba(255,255,255,0.45);
  font-size: var(--fs-xs);
  transition: var(--transition-fast);
}
.footer-bottom-links a:hover { color: var(--secondary); }

.footer-toolbar {
  background: rgba(255,255,255,0.04);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 0.875rem 0;
}
.footer-toolbar .container {
  padding-block: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Dark mode footer overrides */
body.dark-mode footer.footer-premium { background: #040d1a; }

/* =========================================
   28. STORE PAGE STYLES (moved from inline)
   ========================================= */
.store-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 1.5rem;
}

.store-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  position: sticky;
  top: calc(var(--header-height) + 1rem);
}

.store-sidebar h3 {
  font-size: var(--fs-md);
  margin-bottom: 1rem;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.store-sidebar h3 a {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
}
.store-sidebar h3 a:hover { color: var(--danger); }

.filter-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: 1rem;
}
.filter-section-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.category-list { list-style: none; margin-bottom: 0; }
.category-list li { margin-bottom: 0.1rem; }
.category-list a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.6rem;
  border-radius: 6px;
  font-size: var(--fs-sm);
  color: var(--text-body);
  transition: var(--transition-fast);
}
.category-list a:hover { background: var(--bg-light); color: var(--primary); }
.category-list a.active { background: rgba(0,45,98,0.09); color: var(--primary); font-weight: 600; }
.category-list .cat-count {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-light);
  border-radius: 50px;
  padding: 0.05rem 0.45rem;
}

.price-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.price-inputs input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-size: var(--fs-sm);
  background: var(--bg-light);
  color: var(--text-body);
  transition: border-color 0.2s;
}
.price-inputs input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

.range-track {
  position: relative;
  height: 4px;
  background: var(--border-color);
  border-radius: 4px;
  margin: 0.75rem 0 0.4rem;
}
.range-fill {
  position: absolute;
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  pointer-events: none;
}
.range-wrap { position: relative; height: 18px; margin-bottom: 0.65rem; }
.range-wrap input[type=range] {
  -webkit-appearance: none;
  position: absolute;
  width: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  pointer-events: none;
  height: 18px;
}
.range-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  pointer-events: auto;
}
.range-wrap input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  pointer-events: auto;
  border: none;
}

.toggle-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border: 1.5px solid var(--border-color);
  border-radius: 50px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  text-decoration: none;
  transition: var(--transition-fast);
  font-family: var(--font-base);
}
.toggle-chip:hover { border-color: var(--primary); color: var(--primary); }
.toggle-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.toggle-chip.active-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

.sort-select {
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-size: var(--fs-sm);
  background: var(--bg-light) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
  -webkit-appearance: none;
  color: var(--text-body);
  cursor: pointer;
  transition: border-color 0.2s;
}
.sort-select:focus { outline: none; border-color: var(--primary); background-color: var(--bg-card); }

.check-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}
.check-toggle span { font-size: var(--fs-sm); color: var(--text-body); }
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--border-color);
  border-radius: 50px;
  transition: background 0.25s;
}
.switch input:checked ~ .switch-track { background: var(--primary); }
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked ~ .switch-track .switch-thumb { left: 18px; }

.filter-toggle-btn {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-base);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-heading);
  cursor: pointer;
  margin-bottom: 1rem;
  transition: var(--transition-fast);
}
.filter-toggle-btn:hover { background: var(--bg-light); border-color: var(--primary); color: var(--primary); }
.filter-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  border-radius: 50px;
  padding: 0.1rem 0.5rem;
  font-weight: 700;
  min-width: 1.2rem;
  text-align: center;
}

.store-main { flex: 1; min-width: 0; }
.store-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.store-header h2 { margin-bottom: 0; font-size: var(--fs-xl); }
.store-count { font-size: var(--fs-sm); color: var(--text-muted); }

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.results-bar-label { font-size: var(--fs-sm); color: var(--text-muted); }
.results-bar-sort { display: flex; align-items: center; gap: 0.5rem; font-size: var(--fs-sm); }

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.book-card-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}
.book-card-inner:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.book-thumb {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: var(--bg-light);
  flex-shrink: 0;
}
.book-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}
.book-card-inner:hover .book-thumb img { transform: scale(1.05); }

.book-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.book-thumb-badge {
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.book-thumb-badge.out { background: rgba(239,68,68,0.85); }

.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.875rem;
}
.book-title {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-heading);
  margin-bottom: 0.25rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}
.book-price {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
}
.book-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
}
.book-actions .btn { flex: 1; font-size: 0.75rem; padding: 0.45rem 0.5rem; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  background: rgba(0,45,98,0.08);
  color: var(--primary);
  border-radius: 50px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-fast);
}
.filter-chip:hover { background: rgba(0,45,98,0.16); color: var(--primary); }
.filter-chip.danger { background: rgba(239,68,68,0.09); color: var(--danger); }
.filter-chip.danger:hover { background: rgba(239,68,68,0.18); color: var(--danger); }

.store-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2001;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.open { opacity: 1; }

.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-heading);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}
.sidebar-close-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

@media (max-width: 768px) {
  .filter-toggle-btn { display: flex; }
  .store-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw);
    z-index: 2002;
    border-radius: 0;
    border: none;
    overflow-y: auto;
    transform: translateX(-110%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-premium);
    padding: 1.5rem 1.25rem;
    padding-top: 2.5rem;
  }
  .store-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; pointer-events: none; }
  .sidebar-backdrop.open { pointer-events: auto; }
  .sidebar-close-btn { display: flex !important; position: absolute; top: 0.75rem; right: 0.75rem; }
  .store-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .book-thumb { height: 170px; }
  .results-bar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .book-thumb { height: 150px; }
  .book-info { padding: 0.65rem; }
  .book-title { font-size: 0.78rem; }
  .book-price { font-size: 0.85rem; margin-bottom: 0.5rem; }
}

@media (min-width: 1024px) {
  .store-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .book-thumb { height: 230px; }
}

/* =========================================
   29. ACCOUNT PAGE STYLES (moved from inline)
   ========================================= */
.avatar-upload-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.avatar-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid var(--border-color);
  background: var(--bg-light);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-muted);
  position: relative;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.avatar-circle:hover { border-color: var(--primary); }
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-circle .avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,45,98,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: #fff;
  font-size: 1.1rem;
  border-radius: 50%;
}
.avatar-circle:hover .avatar-overlay { opacity: 1; }

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 600px) {
  .field-row { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .avatar-circle { width: 110px; height: 110px; }
}

.profile-card .card-body { padding: 1.25rem; }
@media (min-width: 600px) {
  .profile-card .card-body { padding: 1.75rem; }
}

.form-section-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.field-disabled { position: relative; }
.field-disabled::after {
  content: "Cannot be changed";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  color: var(--text-muted);
  pointer-events: none;
}

.security-card .card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.security-info h4 { font-size: var(--fs-base); margin-bottom: 0.25rem; }
.security-info p  { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
@media (max-width: 480px) {
  .form-actions .btn { width: 100%; justify-content: center; }
}

@media (max-width: 768px) {
  .account-layout { gap: 1rem; margin-top: 1rem; }
  .account-content { margin-top: 0; }
}

/* =========================================
   30. ACCOUNT SIDEBAR STYLES (moved from inline)
   ========================================= */
.account-menu-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-base);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-heading);
  cursor: pointer;
  margin-bottom: 1rem;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.account-menu-toggle:hover {
  background: var(--bg-light);
  border-color: var(--primary);
  color: var(--primary);
}
.account-menu-toggle .toggle-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.account-menu-toggle .toggle-left i { color: var(--primary); }
.account-menu-toggle .toggle-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.account-menu-toggle .toggle-chevron {
  font-size: 0.7rem;
  transition: transform 0.25s ease;
}

.account-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2001;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: none;
}
.account-sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.account-sidebar-close { display: none; }

@media (max-width: 768px) {
  .account-menu-toggle { display: flex; }
  .account-sidebar-backdrop { display: block; }
  .account-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw) !important;
    height: 100vh;
    border-radius: 0 !important;
    border: none !important;
    z-index: 2002;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-110%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-premium);
    padding: 1.5rem 1.25rem;
    padding-top: 3.5rem;
  }
  .account-sidebar.open { transform: translateX(0); }
  .account-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 34px;
    height: 34px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-heading);
    font-size: 0.9rem;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    z-index: 1;
  }
  .account-sidebar-close:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
  }
}

/* =========================================
   31. ADMIN SIDEBAR CLOSE BTN (moved from inline)
   ========================================= */
.admin-sidebar-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.admin-sidebar-close-btn:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

/* =========================================
   32. PREMIUM ADMIN DASHBOARD
   ========================================= */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.admin-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}
.admin-stat-card.stat-success::before { background: var(--success); }
.admin-stat-card.stat-warning::before { background: var(--warning); }
.admin-stat-card.stat-info::before    { background: var(--info); }
.admin-stat-card.stat-danger::before  { background: var(--danger); }
.admin-stat-card.stat-accent::before  { background: var(--secondary); }

.admin-stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-icon-primary { background: rgba(0,45,98,0.1); color: var(--primary); }
.stat-icon-success { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon-info    { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-icon-danger  { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-icon-accent  { background: rgba(227,178,60,0.1); color: var(--secondary); }

.stat-info-wrap { flex: 1; min-width: 0; }
.stat-info-wrap .stat-val {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1;
  margin-bottom: 0.3rem;
}
.stat-info-wrap .stat-lbl {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-info-wrap .stat-trend {
  font-size: var(--fs-xs);
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* =========================================
   33. MODERN AUTH PAGES
   ========================================= */
.auth-page {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--bg-body) 0%, var(--bg-light) 100%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-premium);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.auth-card-header {
  text-align: center;
  padding: 2.5rem 2rem 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
}
.auth-card-header .auth-logo {
  width: 64px;
  height: 64px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
  color: #fff;
}
.auth-card-header h2 {
  color: #fff;
  margin-bottom: 0.25rem;
  font-size: var(--fs-xl);
}
.auth-card-header p {
  color: rgba(255,255,255,0.8);
  font-size: var(--fs-sm);
  margin: 0;
}

.auth-card-body { padding: 2rem; }
.auth-card-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  background: var(--bg-light);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* =========================================
   34. PAGE HERO BANNER
   ========================================= */
.page-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: clamp(2rem, 5vw, 3.5rem) 0;
  margin-bottom: 0;
}
.page-hero h1 { color: #fff; margin-bottom: 0.5rem; font-size: var(--fs-2xl); }
.page-hero p  { color: rgba(255,255,255,0.8); font-size: var(--fs-md); margin: 0; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.6);
  margin-bottom: 0.5rem;
}
.breadcrumb a { color: rgba(255,255,255,0.75); }
.breadcrumb a:hover { color: #fff; }
.breadcrumb .sep { font-size: 0.6rem; }

/* =========================================
   35. EMPTY STATES
   ========================================= */
.empty-state {
  text-align: center;
  padding: clamp(2rem, 6vw, 4rem) 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  background: var(--bg-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 1.75rem;
  color: var(--text-muted);
}
.empty-state h3 {
  font-size: var(--fs-lg);
  margin-bottom: 0.5rem;
}
.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: var(--fs-sm);
  max-width: 360px;
  margin-inline: auto;
}

/* =========================================
   36. ENHANCED HERO SECTION
   ========================================= */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  flex-wrap: wrap;
  margin-top: 2rem;
}
.hero-stat-item { text-align: center; }
.hero-stat-number {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  color: var(--secondary);
  display: block;
  line-height: 1;
}
.hero-stat-label {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}
.hero-stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.2);
}
@media (max-width: 480px) {
  .hero-stat-divider { display: none; }
  .hero-stats { gap: 1.5rem; }
}

/* =========================================
   37. NOTIFICATION PAGE STYLES (admin)
   ========================================= */
.notif-form-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.notif-form-section h3 {
  font-size: var(--fs-md);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* =========================================
   38. MISC PREMIUM UTILITIES
   ========================================= */
.mb-05 { margin-bottom: 0.5rem; }
.mt-05 { margin-top: 0.5rem; }
.gap-075 { gap: 0.75rem; }

.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-hover-lift { transition: var(--transition); }
.card-hover-lift:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

.badge-pill {
  border-radius: 50px;
  padding: 0.3rem 0.75rem;
}

.input-icon-wrap { position: relative; }
.input-icon-wrap .fa {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}
.input-icon-wrap .form-control { padding-left: 2.5rem; }

.max-w-600 { max-width: 600px; margin-inline: auto; }
.max-w-800 { max-width: 800px; margin-inline: auto; }
.max-w-1000 { max-width: 1000px; margin-inline: auto; }

/* Smooth page transitions */
.fade-in {
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================
   39. REGISTER PAGE ENHANCEMENTS
   ========================================= */
.register-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.5rem;
}
@media (max-width: 640px) {
  .register-grid { grid-template-columns: 1fr; }
}

/* =========================================
   40. DARK MODE ADDITIONS
   ========================================= */
body.dark-mode .admin-stat-card { background: var(--bg-card); border-color: var(--border-color); }
body.dark-mode .skeleton {
  background: linear-gradient(90deg, var(--bg-light) 25%, rgba(255,255,255,0.04) 50%, var(--bg-light) 75%);
  background-size: 200% 100%;
}
body.dark-mode .auth-card-footer { background: var(--bg-light); }
body.dark-mode .toggle-chip { border-color: var(--border-color); color: var(--text-muted); }
body.dark-mode .toggle-chip:hover { border-color: #7EB5FF; color: #7EB5FF; }
body.dark-mode .sort-select { background-color: var(--bg-light); color: var(--text-heading); }
body.dark-mode .price-inputs input { background: var(--bg-light); color: var(--text-heading); border-color: var(--border-color); }
body.dark-mode .footer-premium { background: #040d1a; }

/* =========================================
   41. BOOK READER (read-books.php)
   ========================================= */

/* Layout */
.reader-body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
    background: #0a1628;
    font-family: system-ui, sans-serif;
}
.reader-body html,
.reader-body body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: #0a1628; }

/* Loading Overlay */
#pdf-loader {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 22, 40, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#pdf-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 280px; max-width: 88vw; }
.loader-icon { width: 52px; height: 64px; position: relative; }
.loader-icon svg { width: 100%; height: 100%; }
.loader-icon .page-body { fill: #1a3a6a; stroke: #4a7aaa; stroke-width: 1.5; }
.loader-icon .page-lines { stroke: #4a7aaa; stroke-width: 1.2; stroke-linecap: round; animation: line-pulse 1.6s ease-in-out infinite; }
@keyframes line-pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.loader-title { font-size: 14px; font-weight: 600; color: #e8d5a3; letter-spacing: 0.02em; text-align: center; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loader-subtitle { font-size: 12px; color: #6a8aaa; letter-spacing: 0.05em; text-transform: uppercase; margin-top: -10px; }
.loader-bar-track { width: 100%; height: 4px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; position: relative; }
.loader-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #1a6aaa, #e8d5a3 80%, #f5e6c0); border-radius: 99px; transition: width 0.25s ease-out; position: relative; }
.loader-bar-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%); animation: shimmer-reader 1.2s linear infinite; }
@keyframes shimmer-reader { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.loader-bar-fill.indeterminate { width: 40% !important; animation: indeterminate-reader 1.5s ease-in-out infinite; transition: none; }
@keyframes indeterminate-reader { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.loader-bar-fill.indeterminate::after { display: none; }
.loader-status { font-size: 12px; color: #7a9aba; letter-spacing: 0.03em; min-height: 16px; transition: color 0.3s; }
.loader-status.done { color: #7ec8a3; }
.loader-dots { display: flex; gap: 6px; margin-top: 4px; }
.loader-dots span { width: 5px; height: 5px; background: rgba(255,255,255,0.2); border-radius: 50%; animation: dot-bounce 1.4s ease-in-out infinite; }
.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce { 0%, 80%, 100% { background: rgba(255,255,255,0.15); transform: scale(0.8); } 40% { background: #e8d5a3; transform: scale(1.2); } }

/* Toolbar */
.reader-toolbar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; height: 52px; background: #0f2445; color: #fff; gap: 6px; border-bottom: 1px solid rgba(255,255,255,.08); z-index: 200; }
.reader-toolbar .back-link { color: #7ec8e3; text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.reader-toolbar .book-title { flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: #e8d5a3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.reader-toolbar .controls { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.ctrl-btn { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 5px; padding: 0 8px; font-size: 12px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; height: 34px; min-width: 34px; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.ctrl-btn:active { background: rgba(255,255,255,.24); }
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.zoom-badge { font-size: 10px; color: #a8c0d8; min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.font-select { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 5px; font-size: 11px; padding: 0 4px; cursor: pointer; height: 34px; }
.ctrl-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.12); margin: 0 3px; }

/* Reader Content */
.reader-content { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; background: #1a2035; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }

/* PDF Canvas */
#pdf-reader { display: none; position: relative; }
#pdf-canvas-wrap { display: flex; justify-content: center; align-items: flex-start; padding: 16px 8px 80px; min-height: 100%; position: relative; perspective: 1600px; perspective-origin: 50% 40%; }
#pdf-canvas-wrap canvas { display: block; max-width: 100%; height: auto; box-shadow: 0 8px 40px rgba(0,0,0,.7); border-radius: 2px; }

/* Page Flip Animations */
.page-face { position: relative; display: inline-block; transform-style: preserve-3d; will-change: transform, opacity; transform-origin: left center; }
@keyframes flip-out-fwd { 0% { transform: rotateY(0deg) scaleX(1); opacity: 1; } 35% { transform: rotateY(-30deg) scaleX(0.97); opacity: 0.9; } 70% { transform: rotateY(-80deg) scaleX(0.92); opacity: 0.4; } 100% { transform: rotateY(-90deg) scaleX(0.9); opacity: 0; } }
@keyframes flip-in-fwd  { 0% { transform: rotateY(90deg) scaleX(0.9); opacity: 0; } 30% { transform: rotateY(80deg) scaleX(0.92); opacity: 0.4; } 65% { transform: rotateY(25deg) scaleX(0.97); opacity: 0.85; } 100% { transform: rotateY(0deg) scaleX(1); opacity: 1; } }
@keyframes flip-out-bwd { 0% { transform: rotateY(0deg) scaleX(1); opacity: 1; } 35% { transform: rotateY(30deg) scaleX(0.97); opacity: 0.9; } 70% { transform: rotateY(80deg) scaleX(0.92); opacity: 0.4; } 100% { transform: rotateY(90deg) scaleX(0.9); opacity: 0; } }
@keyframes flip-in-bwd  { 0% { transform: rotateY(-90deg) scaleX(0.9); opacity: 0; } 30% { transform: rotateY(-80deg) scaleX(0.92); opacity: 0.4; } 65% { transform: rotateY(-25deg) scaleX(0.97); opacity: 0.85; } 100% { transform: rotateY(0deg) scaleX(1); opacity: 1; } }
.page-face.flip-out-fwd { animation: flip-out-fwd 0.38s cubic-bezier(.4,0,.6,1) forwards; transform-origin: left center; }
.page-face.flip-in-fwd  { animation: flip-in-fwd  0.38s cubic-bezier(.4,0,.6,1) forwards; transform-origin: left center; }
.page-face.flip-out-bwd { animation: flip-out-bwd 0.38s cubic-bezier(.4,0,.6,1) forwards; transform-origin: right center; }
.page-face.flip-in-bwd  { animation: flip-in-bwd  0.38s cubic-bezier(.4,0,.6,1) forwards; transform-origin: right center; }
.page-face::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 2px; opacity: 0; transition: opacity 0.1s; }
.page-face.flip-out-fwd::after, .page-face.flip-in-fwd::after  { background: linear-gradient(to left,  rgba(0,0,0,0.45) 0%, transparent 60%); opacity: 1; }
.page-face.flip-out-bwd::after, .page-face.flip-in-bwd::after  { background: linear-gradient(to right, rgba(0,0,0,0.45) 0%, transparent 60%); opacity: 1; }
#pdf-guard { position: absolute; top: 16px; left: 8px; right: 8px; bottom: 80px; z-index: 10; cursor: default; background: transparent; touch-action: pan-y; }

/* Text Reader */
#text-reader { display: none; }
#content-text { max-width: 720px; margin: 0 auto; padding: 20px 18px 80px; color: #ddd5c0; font-size: 17px; line-height: 1.85; font-family: Georgia, serif; }

/* Nav Bar */
.nav-bar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; height: 54px; background: #0f2445; border-top: 1px solid rgba(255,255,255,.08); color: #fff; z-index: 200; gap: 8px; }
.nav-btn { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; padding: 0 18px; height: 40px; min-width: 80px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: background .15s; }
.nav-btn:active:not(:disabled) { background: rgba(255,255,255,.26); }
.nav-btn:disabled { opacity: .3; cursor: not-allowed; }
.page-info { flex: 1; text-align: center; font-size: 13px; color: #a8c0d8; font-variant-numeric: tabular-nums; }

/* Swipe Hint */
.swipe-hint { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background: rgba(10,22,40,.88); color: rgba(255,255,255,.8); font-size: 12px; padding: 6px 14px; border-radius: 20px; pointer-events: none; z-index: 300; opacity: 1; transition: opacity 1s ease; border: 1px solid rgba(255,255,255,.1); white-space: nowrap; }
.swipe-hint.hidden { opacity: 0; }

/* Notes Section */
.notes-section { background: #111827; border-top: 1px solid rgba(255,255,255,.07); padding: 16px; padding-bottom: 80px; }
.notes-section h4 { color: #e8d5a3; margin: 0 0 10px; font-size: 15px; }
.note-card { background: #1e2a3a; border-left: 3px solid #e8d5a3; padding: 8px 10px; margin-bottom: 8px; border-radius: 0 5px 5px 0; font-size: 13px; color: #b0bec5; }
.note-card strong { color: #e8d5a3; }
.note-card .note-date { font-size: 11px; color: #546e7a; margin-top: 3px; }
.note-input-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.note-input-row textarea { flex: 1; background: #1e2a3a; border: 1px solid rgba(255,255,255,.12); color: #ddd; border-radius: 6px; padding: 8px 10px; font-size: 13px; resize: none; min-height: 60px; }
.note-save-btn { background: #1a4a7a; border: none; color: #fff; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; height: 60px; white-space: nowrap; }
.note-save-btn:active { background: #1a6aaa; }

/* Bible Verse Refs */
.verse-ref { border-bottom: 1px dotted #7ec8e3; color: #7ec8e3; cursor: pointer; pointer-events: auto; }

/* Reader Toast */
#reader-toast { position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%) translateY(12px); background: rgba(10,22,40,.94); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px; max-width: 90vw; text-align: center; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 9999; border: 1px solid rgba(232,213,163,.25); backdrop-filter: blur(6px); }
#reader-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Print Block */
#print-block { display: none; position: fixed; inset: 0; background: #fff; z-index: 99999; align-items: center; justify-content: center; font-size: 20px; color: #c0392b; text-align: center; padding: 40px; }

/* Security: global no-select for reader */
.reader-body *, .reader-body *::before, .reader-body *::after { -webkit-user-select: none !important; -moz-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; }
.reader-body input, .reader-body textarea { -webkit-user-select: text !important; -moz-user-select: text !important; user-select: text !important; }
.reader-body img, .reader-body canvas { -webkit-user-drag: none; pointer-events: none; }

/* =========================================
   PAGE-SPECIFIC ADDITIONS
   ========================================= */

/* ── Padding Utilities ── */
.p-1-5 { padding: 1.5rem; }
.p-3   { padding: 3rem; }

/* ── Page Hero ── */
.page-hero-content { max-width: 640px; margin: 0 auto; padding: 2.5rem 1rem 2rem; }
.page-hero-icon { font-size: 2.5rem; margin-bottom: 0.75rem; color: rgba(255,255,255,0.8); }

/* ── About Page ── */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  padding: 2.5rem 0;
}
.about-mission-card {
  padding: 2rem;
  text-align: center;
}
.about-icon-wrap {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
}
.about-story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 1rem 0;
}
.about-story-img img { max-height: 420px; object-fit: cover; }
.about-story-text { }
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem 0;
}
.staff-card { padding: 1.5rem 1rem; }
.staff-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 1rem;
  background: var(--bg-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--text-muted);
  border: 3px solid var(--border-color);
}

/* ── Blog Layouts ── */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
  align-items: start;
}
.blog-hero-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 380px;
  margin-bottom: 1.5rem;
}
.blog-hero-img img { width: 100%; height: 100%; object-fit: cover; }
.blog-title { font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.3; margin-bottom: 1rem; }
.blog-meta  { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--text-muted); font-size: var(--fs-sm); padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); margin-bottom: 1.5rem; }
.blog-meta-item { display: flex; align-items: center; gap: 0.4rem; }
.blog-content { line-height: 1.9; font-size: var(--fs-base); }
.blog-share   { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }
.blog-share-label { font-weight: 600; font-size: var(--fs-sm); }
.related-post-item { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; padding: 0.5rem; border-radius: var(--radius); transition: background 0.2s; }
.related-post-item:hover { background: var(--bg-light); }
.related-post-thumb { width: 60px; height: 50px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; background: var(--bg-light); display: flex; align-items: center; justify-content: center; }

/* ── Book Detail Page ── */
.book-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.5rem;
  align-items: start;
}
.book-detail-cover { width: 280px; max-width: 100%; }
.book-detail-info  { }
.book-price-block  { margin-bottom: 1.25rem; }
.book-price { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; color: var(--primary); }

/* ── Cart / Checkout Grid ── */
.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

/* ── Contact Grid ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  padding: 0.5rem 0;
}

/* ── Donate Grid ── */
.donate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
  max-width: 900px;
  margin: 0 auto;
}

/* ── Legal Documents ── */
.legal-doc { }
.legal-section { padding: 1.5rem 0; border-bottom: 1px solid var(--border-color); margin-bottom: 0; }
.legal-section h2 {
  font-size: var(--fs-md);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--primary);
}
.legal-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}
.legal-list { padding-left: 1.25rem; margin: 0.5rem 0 0; }
.legal-list li { margin-bottom: 0.5rem; line-height: 1.7; color: var(--text-body); }

/* ── Hover BG ── */
.hover-bg:hover { background: var(--bg-light); }

/* ── Responsive Overrides ── */
@media (max-width: 900px) {
  .blog-layout      { grid-template-columns: 1fr; }
  .book-detail-grid { grid-template-columns: 1fr; }
  .book-detail-cover { width: 200px; margin: 0 auto; }
  .about-story-grid { grid-template-columns: 1fr; }
  .about-story-img  { display: none; }
  .checkout-grid    { grid-template-columns: 1fr; }
  .contact-grid     { grid-template-columns: 1fr; }
  .donate-grid      { grid-template-columns: 1fr; }
}

/* ── Admin Page Header ── */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color);
}
.admin-page-header h1 {
  font-size: var(--fs-xl);
  margin: 0 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-heading);
}
.admin-page-header h1 i { color: var(--primary); font-size: 1.1em; }
