/* ==========================================================================
   IELTS Study Hub - Premium Unified Edition Stylesheet
   Designed by: Maulin Patel
   Version: 6.0.0
   ========================================================================== */

/* ─── TOKENS & SYSTEM VARIABLES ────────────────────────────────────────── */
:root {
  /* Color Palette - Light Mode */
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-accent-pale: #eff6ff;
  --bg-accent-mid: #dbeafe;
  
  --border-light: #e2e8f0;
  --border-mid: #cbd5e1;
  --border-accent: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #94a3b8;
  --text-white: #ffffff;

  --clr-blue: #1d4ed8;
  --clr-blue-light: #eff6ff;
  --clr-green: #15803d;
  --clr-green-light: #f0fdf4;
  --clr-amber: #b45309;
  --clr-amber-light: #fffbeb;
  --clr-red: #b91c1c;
  --clr-red-light: #fdf2f2;
  --clr-purple: #6d28d9;
  --clr-purple-light: #f5f3ff;
  --clr-teal: #0f766e;
  --clr-teal-light: #f0fdfa;
  --clr-pink: #be185d;
  --clr-pink-light: #fdf2f8;
  --clr-gold: #d97706;
  --clr-gold-light: #fef3c7;

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;

  /* Elevation Shadows */
  --sh-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --sh-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --sh-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --sh-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --sh-3d: 0 15px 35px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.1);
  --sh-glow: 0 0 20px rgba(59, 130, 246, 0.25);

  /* Radius & Transitions */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 30px;
  --r-full: 9999px;
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);

  /* Glassmorphism Defaults */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-blur: 20px;
}

/* ─── SYSTEM RESET & CORE STYLES ────────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline-color: var(--border-accent);
}

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

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

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* ─── INTERACTIVE BACKGROUND CANVAS ─────────────────────────────────────── */
#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
  transition: opacity var(--transition-slow);
}

/* ─── SCROLLBAR CUSTOMIZATION ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--r-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-sub);
}

/* ─── FADE-IN SCROLLING ANIMATIONS (Linked via Scroll Cylinder) ──────── */
.fi {
  opacity: 0;
  transform: perspective(1200px) rotateX(15deg) translateY(40px) translateZ(-100px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top center;
  backface-visibility: hidden;
}

.fi.on {
  opacity: 1;
  transform: perspective(1200px) rotateX(0deg) translateY(0) translateZ(0);
}

/* ─── PRELOADER SYSTEM ──────────────────────────────────────────────────── */
.preloader {
  position: fixed;
  inset: 0;
  background-color: #0b0f19;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.preloader.hide {
  opacity: 0;
  visibility: hidden;
}

.preloader-logo {
  width: 96px;
  height: 96px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 36px;
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.4);
  animation: logoPulse 2s infinite ease-in-out;
}

.preloader-text {
  color: #94a3b8;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.preloader-bar {
  width: 240px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--r-full);
  overflow: hidden;
}

.preloader-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: var(--r-full);
  animation: preloaderBarRun 2s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(99, 102, 241, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 60px rgba(99, 102, 241, 0.6); }
}

@keyframes preloaderBarRun {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ─── SCROLL TO TOP BUTTON ─────────────────────────────────────────────── */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: var(--glass-bg);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--sh-md);
  color: var(--text-main);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: all var(--transition-normal);
}

.scroll-top.show {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.scroll-top:hover {
  background: var(--clr-blue);
  color: var(--text-white);
  border-color: var(--clr-blue);
  box-shadow: var(--sh-glow);
  transform: scale(1.05);
}

/* ─── NAVIGATION BAR & DRAWER ───────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 72px;
  z-index: 500;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(var(--glass-blur));
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition-normal), border-bottom var(--transition-normal);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--clr-blue), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 18px;
  box-shadow: var(--sh-md);
}

.nav-name {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.nav-name span {
  color: var(--clr-blue);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--r-md);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a:hover {
  background-color: var(--bg-accent-pale);
  color: var(--clr-blue);
}

.nav-links a.active {
  background-color: var(--clr-blue-light);
  color: var(--clr-blue);
}

.nav-acts {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-cta {
  background: var(--clr-blue);
  color: var(--text-white);
  padding: 10px 20px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: var(--sh-sm);
  transition: all var(--transition-fast);
}

.nav-cta:hover {
  background: #1e40af;
  box-shadow: var(--sh-glow);
  transform: translateY(-1px);
}

.nav-menu-btn {
  display: none;
  font-size: 24px;
  color: var(--text-main);
}

/* Theme Toggle Button */
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--sh-sm);
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-accent-pale);
  border-color: var(--clr-blue);
  transform: scale(1.05);
}

/* Mobile Nav Drawer */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.nav-drawer-box {
  position: absolute;
  top: 0;
  right: 0;
  width: 80%;
  max-width: 300px;
  height: 100%;
  background: var(--bg-surface);
  box-shadow: var(--sh-xl);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}

.nav-drawer.open {
  opacity: 1;
  pointer-events: all;
}

.nav-drawer.open .nav-drawer-box {
  transform: translateX(0);
}

.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-drawer-links a {
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-drawer-links a:hover {
  background: var(--bg-accent-pale);
  color: var(--clr-blue);
}

.nav-drawer-close {
  font-size: 28px;
  color: var(--text-muted);
}



/* ─── HERO SECTION ──────────────────────────────────────────────────────── */
.hero {
  padding: 140px 40px 80px;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 64px;
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--clr-blue-light);
  color: var(--clr-blue);
  padding: 6px 16px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.08;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 20px;
  letter-spacing: -1px;
}

.hero h1 span {
  color: var(--clr-blue);
  position: relative;
  display: inline-block;
}

.hero h1 span::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 0;
  width: 100%;
  height: 8px;
  background: rgba(59, 130, 246, 0.15);
  z-index: -1;
  border-radius: var(--r-sm);
}

.hero-desc {
  color: var(--text-muted);
  font-size: 17.5px;
  line-height: 1.75;
  max-width: 580px;
  margin-bottom: 36px;
}

.hero-btns {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.btn-blue {
  background: var(--clr-blue);
  color: var(--text-white);
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.3);
}

.btn-blue:hover {
  background: #1e40af;
  box-shadow: 0 6px 20px rgba(29, 78, 216, 0.45);
  transform: translateY(-2px);
}

.btn-white {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1.5px solid var(--border-light);
  box-shadow: var(--sh-sm);
}

.btn-white:hover {
  border-color: var(--clr-blue);
  color: var(--clr-blue);
  background: var(--clr-blue-light);
  transform: translateY(-2px);
}

.hero-stats {
  display: flex;
  gap: 36px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-num {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Profile Card in Hero - Flat Design (No 3D Tilt) */
.profile-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--sh-xl);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.profile-card:hover {
  box-shadow: var(--sh-xl), 0 12px 24px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.profile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--clr-blue), #7c3aed);
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--clr-green-light);
  color: var(--clr-green);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--r-full);
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background-color: var(--clr-green);
  border-radius: var(--r-full);
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--clr-blue), #8b5cf6);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 22px;
  box-shadow: var(--sh-md);
}

.profile-name {
  font-weight: 800;
  font-size: 17px;
  color: var(--text-main);
}

.profile-role {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.plinks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plink {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  background: var(--bg-surface);
}

.plink:hover {
  border-color: var(--clr-blue);
  color: var(--clr-blue);
  background: var(--bg-accent-pale);
  transform: translateX(4px);
}

.plink-icon {
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.plink:hover .plink-icon {
  background: var(--bg-accent-mid);
}

/* ─── GENERAL SECTIONS ──────────────────────────────────────────────────── */
.section {
  padding: 80px 40px;
  position: relative;
  transform-style: preserve-3d;
}

.section.gray {
  background-color: var(--bg-base);
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
}

.section-top {
  margin-bottom: 48px;
}

.eyebrow {
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--clr-blue);
  margin-bottom: 12px;
}

.section-h2 {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.5vw, 40px);
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.15;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.section-h2 em {
  font-style: italic;
  font-weight: 700;
  color: var(--clr-blue);
}

.section-sub {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.7;
  max-width: 600px;
}

.divider {
  height: 1px;
  background-color: var(--border-light);
  border: none;
}

/* ─── SCROLLABLE CONTAINERS (SMART LAYOUTS) ─────────────────────────────── */
.scroll-panel {
  max-height: 580px;
  overflow-y: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  padding: 28px;
  box-shadow: var(--sh-md);
  margin-bottom: 24px;
}

.scroll-panel::-webkit-scrollbar {
  width: 6px;
}

.scroll-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
}

.scroll-panel::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--r-full);
}

.scroll-panel::-webkit-scrollbar-thumb:hover {
  background: var(--text-sub);
}

/* ─── TABS & CATEGORY SELECTORS ─────────────────────────────────────────── */
.tab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.tabs {
  display: flex;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  padding: 4px;
  border-radius: var(--r-md);
  gap: 2px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 8px 18px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--clr-blue);
  box-shadow: var(--sh-sm);
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 380px;
  min-width: 260px;
}

.search-input-field {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  background-color: var(--bg-surface);
  transition: all var(--transition-fast);
}

.search-input-field:focus {
  border-color: var(--clr-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub);
  font-size: 15px;
}

.tab-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  padding: 4px 12px;
  border-radius: var(--r-full);
}

/* ─── UNIFIED BOOK COVER GRID ───────────────────────────────────────────── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 36px 24px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.book-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  /* Card base is flat (no card-level 3D perspective rotation on hover to keep buttons stable) */
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--sh-sm);
  position: relative;
}

.book-card:hover {
  transform: translateY(-4px); /* Very minor lift, no rotation */
  box-shadow: var(--sh-md);
  border-color: var(--border-mid);
}

.book-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--sh-md);
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(-8deg); /* Default shelf angle */
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  margin-bottom: 12px;
  /* The active mouse tracking tilt happens exclusively here! */
}

/* Fallback default rotation if JS is deactivated */
.book-card:hover .book-cover {
  box-shadow: var(--sh-3d);
}

.book-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.05) 50%, rgba(255, 255, 255, 0.1) 100%);
  z-index: 5;
}

.book-front {
  width: 100%;
  height: 100%;
  background: var(--bc, linear-gradient(135deg, var(--clr-blue), #1e3a8a));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 18px 12px;
  text-align: center;
  position: relative;
}

.book-front::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%, rgba(0, 0, 0, 0.15) 100%);
}

.book-pub {
  font-size: 8px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 1px;
  text-transform: uppercase;
  z-index: 2;
}

.book-series {
  font-size: 10px;
  font-weight: 900;
  color: var(--text-white);
  letter-spacing: 1px;
  text-transform: uppercase;
  z-index: 2;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-num {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 900;
  color: var(--text-white);
  line-height: 1;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
  z-index: 2;
  margin: 10px 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-type {
  font-size: 8px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 2;
}

.book-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 34px;
  margin-bottom: 12px;
  width: 100%;
}

/* Dual Card Actions Layout - Totally flat, stable, and highly responsive */
.book-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  position: relative;
  z-index: 10; /* Keep above any cover bounds */
}

.book-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 700;
  transition: all var(--transition-fast);
  text-align: center;
  box-shadow: var(--sh-sm);
}

.book-btn-view {
  background: var(--bg-accent-pale);
  color: var(--clr-blue);
  border: 1px solid var(--border-light);
}

.book-btn-view:hover {
  background: var(--bg-accent-mid);
  border-color: var(--clr-blue);
}

.book-btn-dl {
  background: var(--clr-blue);
  color: var(--text-white);
}

.book-btn-dl:hover {
  background: #1e40af;
  box-shadow: var(--sh-glow);
}

.new-ribbon {
  position: absolute;
  top: 10px;
  right: -4px;
  background: var(--clr-red);
  color: var(--text-white);
  font-size: 8px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  letter-spacing: 1px;
  box-shadow: var(--sh-sm);
  z-index: 3;
}

.latest-ribbon {
  position: absolute;
  top: 10px;
  right: -4px;
  background: var(--clr-purple);
  color: var(--text-white);
  font-size: 8px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  letter-spacing: 1px;
  box-shadow: var(--sh-sm);
  z-index: 3;
  animation: ribbonPulse 2s infinite;
}

/* MKP Must Read Ribbon - Premium Gold Glow */
.mustread-ribbon {
  position: absolute;
  top: 10px;
  right: -4px;
  background: linear-gradient(135deg, var(--clr-gold), #f59e0b);
  color: var(--text-white);
  font-size: 8px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  letter-spacing: 1px;
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.4);
  z-index: 3;
  animation: mustReadPulse 1.5s infinite ease-in-out;
}

@keyframes ribbonPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes mustReadPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(217, 119, 6, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 18px rgba(217, 119, 6, 0.7); }
}

/* ─── INTERACTIVE BAND CALCULATOR (Equalized Dimensions) ────────────────── */
.band-calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: stretch; /* Stretch both columns to equal height */
}

.matrix-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--sh-md);
  height: 100%; /* Fill full layout height */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0; /* Prevents grid item content overflow */
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 12px;
}

.matrix-table-card table {
  width: 100%;
  min-width: 320px; /* Reduced to fit perfectly on standard mobile viewports */
  border-collapse: collapse;
  text-align: left;
}

.matrix-table-card th {
  padding: 12px 16px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-light);
}

.matrix-table-card td {
  padding: 14px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-light);
  min-width: 0;
}

.matrix-table-card tr:last-child td {
  border-bottom: none;
}

.req-points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.req-points li {
  position: relative;
  padding-left: 12px;
  line-height: 1.35;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.req-points li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--clr-blue);
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
}

.band-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  line-height: 1;
}

.band-pill.b9 { background: var(--clr-blue-light); color: var(--clr-blue); }
.band-pill.b85 { background: var(--clr-purple-light); color: var(--clr-purple); }
.band-pill.b8 { background: var(--clr-purple-light); color: var(--clr-purple); opacity: 0.95; }
.band-pill.b75 { background: var(--clr-green-light); color: var(--clr-green); }
.band-pill.b7 { background: var(--clr-green-light); color: var(--clr-green); opacity: 0.95; }
.band-pill.b65 { background: var(--clr-amber-light); color: var(--clr-amber); }
.band-pill.b6 { background: var(--clr-amber-light); color: var(--clr-amber); opacity: 0.95; }
.band-pill.b55 { background: var(--clr-red-light); color: var(--clr-red); }
.band-pill.b5 { background: var(--clr-red-light); color: var(--clr-red); opacity: 0.95; }


/* Flat Calculator Card (Equalized Dimensions) */
.calc-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--sh-xl);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  height: 100%; /* Fill full layout height */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0; /* Prevents grid item content overflow */
}

.calc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-xl), 0 12px 24px rgba(0, 0, 0, 0.05);
}

.calc-head {
  margin-bottom: 24px;
}

.calc-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.calc-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.calc-module {
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cm-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.cm-ctrl {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cm-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow: var(--sh-sm);
  transition: all var(--transition-fast);
}

.cm-btn:hover {
  border-color: var(--clr-blue);
  color: var(--clr-blue);
  background: var(--clr-blue-light);
}

.cm-val {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
}

.cm-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: var(--r-full);
  overflow: hidden;
}

.cm-bar-fill {
  height: 100%;
  background: var(--clr-blue);
  border-radius: var(--r-full);
  transition: width var(--transition-normal);
}

.calc-result {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--clr-blue-light);
  border: 1px solid rgba(29, 78, 216, 0.1);
  border-radius: var(--r-md);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.calc-ring {
  width: 80px;
  height: 80px;
  border-radius: var(--r-full);
  background: conic-gradient(var(--ring-clr, var(--clr-blue)) calc(var(--pct, 0) * 1%), rgba(0,0,0,0.06) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.calc-ring-inner {
  width: 66px;
  height: 66px;
  border-radius: var(--r-full);
  background: var(--bg-surface-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.calc-ring-num {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
}

.calc-ring-lbl {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.calc-info {
  flex: 1;
}

.calc-level {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-main);
}

.calc-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

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

.calc-act-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--sh-sm);
  transition: all var(--transition-fast);
}

.calc-act-save {
  background: var(--clr-blue);
  color: var(--text-white);
}

.calc-act-save:hover {
  background: #1e40af;
  box-shadow: var(--sh-glow);
}

.calc-act-reset {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.calc-act-reset:hover {
  background: var(--clr-red-light);
  color: var(--clr-red);
  border-color: var(--clr-red);
}

/* Calculator History Table */
.calc-history-container {
  margin-top: 24px;
  border-top: 1px dashed var(--border-light);
  padding-top: 20px;
}

.history-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.history-list {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 12px;
}

.history-val {
  font-weight: 800;
  color: var(--clr-blue);
}

.history-date {
  color: var(--text-muted);
}

.history-del {
  color: var(--text-sub);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.history-del:hover {
  color: var(--clr-red);
}

/* ─── TIPS & PREPARATION CARDS ───────────────────────────────────────────── */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.tip-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 24px;
  box-shadow: var(--sh-sm);
  transition: all var(--transition-normal);
}

.tip-card:hover {
  border-color: var(--clr-blue);
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
}

.tip-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--clr-blue);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.tip-card h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.tip-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── FAQ PANEL ────────────────────────────────────────────────────────── */
.faq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.faq-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 24px;
  box-shadow: var(--sh-sm);
}

.faq-card h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.faq-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── CONTACT SECTION ───────────────────────────────────────────────────── */
.contact-strip {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e1b4b 100%);
  color: var(--text-white);
  border-radius: var(--r-lg);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--sh-xl);
}

.contact-strip h2 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 12px;
}

.contact-strip p {
  color: #94a3b8;
  font-size: 16px;
  max-width: 500px;
  margin: 0 auto 32px;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.c-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.c-btn-white {
  background: var(--text-white);
  color: #0f172a;
}

.c-btn-white:hover {
  background: #f1f5f9;
  transform: translateY(-2px);
}

.c-btn-ghost {
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: var(--text-white);
}

.c-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-white);
  transform: translateY(-2px);
}

/* ─── SEO TEXT AREA ─────────────────────────────────────────────────────── */
.seo-content {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border-light);
  padding-top: 24px;
}

/* ─── FOOTER SECTION ────────────────────────────────────────────────────── */
footer {
  background-color: #0f172a;
  color: #94a3b8;
  padding: 64px 40px 32px;
  border-top: 1px solid #1e293b;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--clr-blue), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 16px;
}

.footer-brand-name {
  font-weight: 800;
  font-size: 18px;
  color: var(--text-white);
}

.footer-brand-name span {
  color: #3b82f6;
  font-family: var(--font-serif);
  font-style: italic;
}

.footer-socials {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-socials a {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-socials a:hover {
  color: var(--text-white);
}

.footer-info {
  font-size: 13px;
  color: #64748b;
}

.footer-disclaimer {
  font-size: 11px;
  color: #475569;
  max-width: 700px;
  line-height: 1.6;
}

/* ─── TOAST NOTIFICATIONS ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--clr-blue);
  box-shadow: var(--sh-lg);
  padding: 12px 20px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  0% { transform: translateY(24px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.toast.success { border-left-color: var(--clr-green); }
.toast.warning { border-left-color: var(--clr-amber); }
.toast.error { border-left-color: var(--clr-red); }
.toast.info { border-left-color: var(--clr-blue); }

/* ─── SYSTEM DARK THEME VARIABLE OVERRIDES ────────────────────────────────── */
[data-theme="dark"] {
  --bg-base: #0b0f19;
  --bg-surface: #131a2c;
  --bg-surface-elevated: #1a233a;
  --bg-accent-pale: #1e293b;
  --bg-accent-mid: #334155;

  --border-light: #243049;
  --border-mid: #334155;
  --border-accent: #3b82f6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-sub: #64748b;

  --clr-blue-light: rgba(59, 130, 246, 0.1);
  --clr-green-light: rgba(34, 197, 94, 0.1);
  --clr-amber-light: rgba(245, 158, 11, 0.1);
  --clr-red-light: rgba(239, 68, 68, 0.1);
  --clr-purple-light: rgba(168, 85, 247, 0.1);
  --clr-teal-light: rgba(20, 184, 166, 0.1);
  --clr-pink-light: rgba(236, 72, 153, 0.1);

  --glass-bg: rgba(19, 26, 44, 0.8);
  --glass-border: rgba(36, 48, 73, 0.4);
}

/* ─── RESPONSIVE LAYOUT & MEDIA QUERIES ──────────────────────────────────── */
@media (max-width: 1024px) {
  nav {
    padding: 0 24px;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 48px;
    padding-top: 120px;
    text-align: center;
  }
  .hero-desc {
    margin: 0 auto 36px;
  }
  .hero-btns {
    justify-content: center;
  }
  .hero-stats {
    justify-content: center;
  }
  .hero-right {
    display: flex;
    justify-content: center;
  }
  .profile-card {
    width: 100%;
    max-width: 440px;
  }
  .band-calc-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .nav-menu-btn {
    display: block;
  }
  .section {
    padding: 60px 24px;
  }
  .faq-grid {
    grid-template-columns: 1fr;
  }
  .contact-strip {
    padding: 40px 24px;
  }
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 24px 16px;
  }
}

@media (max-width: 600px) {
  .matrix-table-card {
    padding: 20px 16px;
  }
  .matrix-table-card td, .matrix-table-card th {
    padding: 10px 8px;
    font-size: 12.5px;
  }
  .band-pill {
    padding: 3px 8px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  nav {
    padding: 0 16px;
  }
  .nav-acts {
    gap: 8px;
  }
  .nav-cta {
    padding: 8px 14px;
    font-size: 12px;
  }
  .hero {
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 100px;
  }
  .hero h1 {
    font-size: 32px;
  }
  .hero-desc {
    font-size: 15px;
    line-height: 1.6;
  }
  .hero-stats {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }
  .profile-card {
    padding: 24px 16px;
  }
  .calc-card {
    padding: 24px 16px;
  }
  .calc-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .calc-module {
    padding: 10px 12px;
    gap: 6px;
  }
  .cm-label {
    font-size: 11.5px;
  }
  .cm-val {
    font-size: 17px;
  }
  .cm-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  .calc-result {
    flex-direction: column;
    text-align: center;
    padding: 16px;
    gap: 16px;
  }
  .calc-actions {
    flex-direction: column;
    gap: 10px;
  }
  .c-btn {
    width: 100%;
    justify-content: center;
  }
  .section {
    padding: 48px 16px;
  }
}

/* Container query simulation for small mobile screens */
@media (max-width: 440px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px 12px !important;
  }
}

@media (max-width: 400px) {
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px 12px;
  }
  .book-card {
    padding: 10px;
  }
  .book-label {
    font-size: 11.5px;
    height: 30px;
    margin-bottom: 8px;
  }
  .book-actions {
    gap: 4px;
  }
  .book-btn {
    font-size: 9px;
    padding: 6px 2px;
  }
  .book-num {
    font-size: 20px;
  }
  .book-front {
    padding: 12px 6px;
  }
}

@media (max-width: 380px) {
  nav .nav-cta {
    display: none; /* Hide top Drive button on narrow screens, drawer link remains accessible */
  }
}

/* Extra premium class rules */
.glow-effect {
  position: relative;
}
.glow-effect::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, var(--clr-blue), #8b5cf6);
  border-radius: inherit;
  z-index: -2;
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.glow-effect:hover::after {
  opacity: 0.15;
}


/* ══ ADMIN SYSTEM ══════════════════════════════════════ */
.admin-bar{background:linear-gradient(90deg,#0f172a,#1e293b);color:#fff;padding:10px 24px;display:none;align-items:center;gap:12px;flex-wrap:wrap;position:sticky;top:0;z-index:300;}
.admin-bar.show{display:flex;}
.admin-bar-lbl{font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;opacity:.5;flex:1;}
.ab{font-size:12px;font-weight:700;padding:6px 14px;border-radius:6px;cursor:pointer;border:1px solid rgba(255,255,255,.2);background:rgba(255,255,255,.1);color:#fff;transition:all .12s;font-family:inherit;}
.ab:hover{background:rgba(255,255,255,.22);}
.ab.d{border-color:rgba(248,113,113,.4);color:#fca5a5;}
.ab.d:hover{background:rgba(248,113,113,.18);}
.card-del{position:absolute!important;top:8px!important;left:8px!important;width:24px!important;height:24px!important;border-radius:50%!important;background:rgba(0,0,0,.75)!important;color:#fff!important;font-size:10px!important;display:none!important;align-items:center!important;justify-content:center!important;z-index:20!important;cursor:pointer!important;border:1.5px solid rgba(255,255,255,.3)!important;padding:0!important;font-family:inherit!important;}
.card-del:hover{background:#dc2626!important;}

/* Edit button on card (admin mode) */
.card-edit{position:absolute!important;top:8px!important;right:8px!important;width:24px!important;height:24px!important;border-radius:50%!important;background:rgba(27,75,219,.82)!important;color:#fff!important;font-size:10px!important;display:none!important;align-items:center!important;justify-content:center!important;z-index:20!important;cursor:pointer!important;border:1.5px solid rgba(255,255,255,.4)!important;padding:0!important;font-family:inherit!important;}
.card-edit:hover{background:#1e40af!important;}
.admin-mode .book-card .card-edit{display:flex!important;}
/* Edit modal special fields */
.edit-link-preview{font-size:11px;color:var(--text-muted,#64748b);word-break:break-all;margin-top:6px;padding:8px 10px;background:var(--bg-accent-pale,#f8fafc);border-radius:6px;border:1px solid var(--border-light,#e2e8f0);}
.edit-link-preview a{color:var(--clr-blue,#3b82f6);text-decoration:none;}
.edit-link-preview a:hover{text-decoration:underline;}

.admin-mode .book-card .card-del{display:flex!important;}
.adm-ov{position:fixed;inset:0;z-index:2000;background:rgba(0,0,0,.58);backdrop-filter:blur(8px);display:none;align-items:center;justify-content:center;padding:1rem;}
.adm-ov.open{display:flex;}
.adm-box{background:var(--bg-surface-elevated,#fff);border:1px solid var(--border-light,#e2e8f0);border-radius:20px;padding:28px;width:100%;max-width:460px;max-height:90vh;overflow-y:auto;box-shadow:0 25px 60px rgba(0,0,0,.25);position:relative;}
.adm-box h3{font-size:1.25rem;color:var(--text-main,#0f172a);margin-bottom:4px;font-family:var(--font-serif,'Fraunces',serif);}
.adm-sub{font-size:.8125rem;color:var(--text-muted,#64748b);margin-bottom:20px;}
.adm-x{position:absolute;top:14px;right:14px;width:30px;height:30px;border-radius:8px;background:var(--bg-accent-pale,#f1f5f9);color:var(--text-main,#0f172a);display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:13px;border:1px solid var(--border-light,#e2e8f0);font-family:inherit;}
.adm-x:hover{background:rgba(220,38,38,0.15);color:#dc2626;}
.adm-f{margin-bottom:14px;}
.adm-f label{display:block;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted,#64748b);margin-bottom:6px;}
.adm-f input,.adm-f select,.adm-f textarea{width:100%;padding:10px 14px;border:1px solid var(--border-light,#e2e8f0);border-radius:8px;background:var(--bg-accent-pale,#f8fafc);color:var(--text-main,#0f172a);font-size:.875rem;font-family:inherit;transition:border-color .15s;}
.adm-f input:focus,.adm-f select:focus,.adm-f textarea:focus{outline:none;border-color:var(--clr-blue,#3b82f6);}
.adm-f textarea{resize:none;}
.adm-acts{display:flex;gap:10px;justify-content:flex-end;margin-top:20px;}
.bp{padding:10px 20px;border-radius:8px;font-size:.875rem;font-weight:600;background:var(--clr-blue,#3b82f6);color:#fff;cursor:pointer;border:none;font-family:inherit;}
.bp:hover{opacity:.85;}
.bs{padding:10px 20px;border-radius:8px;font-size:.875rem;font-weight:600;background:var(--bg-accent-pale,#f1f5f9);color:var(--text-main,#0f172a);cursor:pointer;border:1px solid var(--border-light,#e2e8f0);font-family:inherit;}
.bs:hover{border-color:var(--clr-blue,#3b82f6);color:var(--clr-blue,#3b82f6);}
.bd{padding:10px 20px;border-radius:8px;font-size:.875rem;font-weight:600;background:#dc2626;color:#fff;cursor:pointer;border:none;font-family:inherit;}
.login-logo-a{width:52px;height:52px;background:var(--clr-blue,#3b82f6);border-radius:14px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:1.125rem;font-weight:700;margin:0 auto 16px;font-family:var(--font-serif,'Fraunces',serif);}
.login-err-a{background:rgba(220,38,38,0.15);color:#dc2626;border-radius:8px;padding:10px 14px;font-size:.875rem;font-weight:600;margin-bottom:14px;display:none;}
.del-name-a{padding:12px;background:rgba(220,38,38,0.15);border-radius:8px;font-weight:600;color:#dc2626;margin-bottom:14px;}
.clr-row-a{display:flex;gap:8px;flex-wrap:wrap;}
.clr-sw-a{width:26px;height:26px;border-radius:50%;cursor:pointer;border:3px solid transparent;transition:all .12s;}
.clr-sw-a.sel{border-color:#0f172a;transform:scale(1.18);}
.upd-strip{background:var(--bg-surface,#fff);border-top:1px solid var(--border-light,#e2e8f0);padding:10px 24px;display:none;align-items:center;gap:12px;}
.upd-strip.show{display:flex;}
.upd-lbl{font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--text-muted,#64748b);flex-shrink:0;white-space:nowrap;}
.upd-chips{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;}
.upd-chips::-webkit-scrollbar{display:none;}
.upd-chip{padding:4px 12px;background:var(--bg-accent-pale,#f8fafc);border:1px solid var(--border-light,#e2e8f0);border-radius:50px;white-space:nowrap;font-size:11px;font-weight:600;color:var(--text-main,#0f172a);cursor:pointer;flex-shrink:0;text-decoration:none;}
.upd-chip:hover{border-color:var(--clr-blue,#3b82f6);color:var(--clr-blue,#3b82f6);}
.upd-chip.n{border-color:#be185d;background:#fdf2f8;color:#be185d;}
.adm-badge{display:none;background:#fdf2f8;color:#be185d;border:1px solid #fbcfe8;font-size:11px;font-weight:700;padding:3px 10px;border-radius:50px;align-items:center;gap:4px;margin-right:4px;}
.adm-badge.show{display:inline-flex;}

/* ─── ANALYTICS DASHBOARD ─────────────────────────────────────────────────── */
.analytics-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--sh-sm);
}
.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.analytics-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.analytics-chart-wrap {
  position: relative;
  height: 160px;
  width: 100%;
}
.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}
@media (max-width: 600px) { .analytics-metrics { grid-template-columns: repeat(2, 1fr); } }
.metric-chip {
  background: var(--bg-accent-pale);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 10px 10px 8px;
  text-align: center;
}
.metric-chip .m-val {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 3px;
}
.metric-chip .m-lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.metric-chip.highlight { border-color: var(--clr-blue); background: var(--clr-blue-light); }
.metric-chip.highlight .m-val { color: var(--clr-blue); }
.metric-chip.warn { border-color: var(--clr-amber); background: var(--clr-amber-light); }
.metric-chip.warn .m-val { color: var(--clr-amber); }
.metric-chip.good { border-color: var(--clr-green); background: var(--clr-green-light); }
.metric-chip.good .m-val { color: var(--clr-green); }
.metric-chip.info { border-color: var(--clr-purple); background: var(--clr-purple-light); }
.metric-chip.info .m-val { color: var(--clr-purple); font-size:13px; }
.analytics-empty {
  text-align: center;
  padding: 28px 0;
  color: var(--text-sub);
  font-size: 12px;
}

/* ─── PDF VIEWER MODAL ────────────────────────────────────────────────────── */
#pdfViewerModal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#pdfViewerModal.open { display: flex; }
.pdf-viewer-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 900px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  overflow: hidden;
  animation: pdfSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pdfSlideIn {
  0% { opacity: 0; transform: scale(0.95) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.pdf-viewer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-surface-elevated);
}
.pdf-viewer-title {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdf-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pdf-act-btn {
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  background: var(--bg-base);
  cursor: pointer;
}
.pdf-act-btn:hover { border-color: var(--clr-blue); color: var(--clr-blue); background: var(--clr-blue-light); }
.pdf-act-btn.blue { background: var(--clr-blue); color: #fff; border-color: var(--clr-blue); }
.pdf-act-btn.blue:hover { background: #1e40af; }
.pdf-viewer-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #f1f1f1;
}
.pdf-viewer-notice {
  padding: 10px 18px;
  font-size: 11px;
  color: var(--text-sub);
  border-top: 1px solid var(--border-light);
  background: var(--bg-accent-pale);
  text-align: center;
  flex-shrink: 0;
}
.book-btn-preview {
  background: var(--clr-purple-light);
  color: var(--clr-purple);
  border: 1px solid rgba(109, 40, 217, 0.2);
}
.book-btn-preview:hover {
  background: var(--clr-purple);
  color: #fff;
  border-color: var(--clr-purple);
}

/* ─── LINK TYPE BADGES ON CARDS ──────────────────────────────────────────── */
.link-type-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 2;
  line-height: 1.4;
}
.lbadge-file { background: rgba(21,128,61,0.15); color: #15803d; border: 1px solid rgba(21,128,61,0.25); }
.lbadge-folder { background: rgba(180,83,9,0.15); color: #b45309; border: 1px solid rgba(180,83,9,0.25); }

/* ─── CARD STAGGER ENTRANCE ANIMATION ────────────────────────────────────── */
@keyframes cardEnter {
  0%  { opacity: 0; transform: translateY(18px) scale(0.97); }
  100%{ opacity: 1; transform: translateY(0)    scale(1); }
}
.book-card.card-visible {
  animation: cardEnter 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ─── SEARCH GRID TRANSITION ─────────────────────────────────────────────── */
.grid-updating { opacity: 0.4; pointer-events: none; transition: opacity 0.15s; }
.grid-ready    { opacity: 1;   transition: opacity 0.2s 0.05s; }

/* ─── PDF VIEWER ENHANCEMENTS ────────────────────────────────────────────── */
.pdf-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-base);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pdf-zoom-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  color: var(--text-muted);
  flex-shrink: 0;
}
.pdf-zoom-btn:hover { border-color: var(--clr-blue); color: var(--clr-blue); background: var(--clr-blue-light); }
.pdf-zoom-label { font-size: 11px; font-weight: 700; color: var(--text-muted); min-width: 42px; text-align: center; }
.pdf-toolbar-sep { width: 1px; height: 20px; background: var(--border-light); flex-shrink: 0; }
.pdf-iframe-wrap { flex: 1; position: relative; background: #f1f1f1; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.pdf-iframe-spinner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg-surface);
  z-index: 5; gap: 12px; transition: opacity 0.35s;
}
.pdf-iframe-spinner.hidden { opacity: 0; pointer-events: none; }
.pdf-spinner-ring {
  width: 42px; height: 42px;
  border: 3px solid var(--border-light);
  border-top-color: var(--clr-blue);
  border-radius: 50%;
  animation: spinRing 0.8s linear infinite;
}
@keyframes spinRing { to { transform: rotate(360deg); } }
.pdf-spinner-text { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.pdf-folder-browse {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  background: var(--bg-surface);
}
.pdf-folder-browse.visible { display: flex; }
.pdf-folder-icon { font-size: 60px; line-height: 1; }
.pdf-folder-title { font-size: 18px; font-weight: 800; color: var(--text-main); }
.pdf-folder-sub { font-size: 13px; color: var(--text-muted); max-width: 400px; line-height: 1.6; }
.pdf-folder-btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* ─── ADMIN PANEL UPGRADES ───────────────────────────────────────────────── */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
@media (max-width: 480px) { .adm-stats-grid { grid-template-columns: repeat(2, 1fr); } }
.adm-stat-chip { background: var(--bg-base); border: 1px solid var(--border-light); border-radius: var(--r-sm); padding: 10px 10px 8px; text-align: center; }
.adm-stat-val { font-size: 22px; font-weight: 900; color: var(--text-main); line-height: 1; }
.adm-stat-lbl { font-size: 9px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }
.adm-tabs { display: flex; gap: 4px; margin-bottom: 14px; background: var(--bg-base); padding: 4px; border-radius: var(--r-sm); overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.adm-tabs::-webkit-scrollbar { display: none; }
.adm-tab { flex: 0 0 auto; padding: 7px 12px; border: none; background: none; border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.adm-tab.active { background: var(--bg-surface); color: var(--clr-blue); box-shadow: var(--sh-sm); }
.adm-tab-pane { display: none; }
.adm-tab-pane.active { display: block; animation: swingIn 0.25s ease both; }
.link-validator-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg-base); border: 1px solid var(--border-light); margin-bottom: 4px; font-size: 11px; }
.lv-type { font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.lv-file { background: rgba(21,128,61,0.15); color: #15803d; }
.lv-folder { background: rgba(180,83,9,0.15); color: #b45309; }
.lv-name { flex: 1; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-mini-btn { padding: 4px 8px; font-size: 10px; font-weight: 700; border-radius: 5px; border: 1px solid var(--border-light); background: var(--bg-surface); cursor: pointer; color: var(--text-muted); transition: all 0.12s; }
.adm-mini-btn:hover { color: var(--clr-blue); border-color: var(--clr-blue); background: var(--clr-blue-light); }
.adm-mini-btn.danger:hover { color: var(--clr-red); border-color: var(--clr-red); background: var(--clr-red-light); }
.adm-export-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.adm-inline-note { font-size: 11px; color: var(--text-muted); margin: 6px 0 10px; line-height: 1.5; }
#adminLinkList { max-height: 320px; overflow-y: auto; }

/* ─── ADMIN DASHBOARD FULL-PAGE PANEL ────────────────────────────────────── */
.adm-dashboard{position:fixed;inset:0;background:var(--bg-base);color:var(--text-main);z-index:1200;display:flex;flex-direction:column;transform:translateX(100%);transition:transform .32s cubic-bezier(.4,0,.2,1);overflow:hidden;}
.adm-dashboard.open{transform:translateX(0);}
.adm-dash-header{display:flex;align-items:center;gap:12px;padding:14px 18px;border-bottom:1px solid var(--border-light);background:var(--bg-surface);flex-shrink:0;}
.adm-dash-title{font-size:15px;font-weight:800;color:var(--text-main);flex:1;letter-spacing:-.2px;}
.adm-dash-close{width:32px;height:32px;border-radius:8px;background:var(--bg-accent-pale);border:1px solid var(--border-light);color:var(--text-main);font-size:15px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.adm-dash-close:hover{background:var(--bg-accent-mid);border-color:var(--border-mid);}
.adm-dash-tabbar{display:flex;padding:0 18px;border-bottom:1px solid var(--border-light);background:var(--bg-surface);flex-shrink:0;overflow-x:auto;gap:0;-webkit-overflow-scrolling:touch;scrollbar-width:none;}
.adm-dash-tabbar::-webkit-scrollbar{display:none;}
.adm-dash-tab{padding:11px 14px;font-size:12px;font-weight:700;color:var(--text-muted);border:none;border-bottom:2px solid transparent;background:none;cursor:pointer;white-space:nowrap;transition:color .15s,border-color .15s;}
.adm-dash-tab.active{color:var(--clr-blue);border-bottom-color:var(--clr-blue);}
.adm-dash-body{flex:1;overflow-y:auto;padding:20px 18px;}
.adm-dash-panel{display:none;}
.adm-dash-panel.active{display:block;animation:swingIn .2s ease both;}
.adm-dash-section-title{font-size:14px;font-weight:800;color:var(--text-main);margin:0 0 14px;}
.adm-dash-stat-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:10px;margin-bottom:16px;}
.adm-fb-bar{background:var(--bg-surface);border:1px solid var(--border-light);border-radius:10px;padding:14px 16px;margin-bottom:14px;font-size:13px;color:var(--text-main);display:flex;align-items:center;gap:8px;}
.adm-fb-dot{width:9px;height:9px;border-radius:50%;background:#94a3b8;flex-shrink:0;}
.adm-fb-dot.on{background:#22c55e;}
.adm-fb-dot.off{background:#f59e0b;}
.adm-dash-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px;}
.adm-res-search{width:100%;padding:9px 13px;border:1px solid var(--border-light);border-radius:8px;font-size:13px;background:var(--bg-surface-elevated);color:var(--text-main);margin-bottom:10px;box-sizing:border-box;}
.adm-res-table{width:100%;border-collapse:collapse;font-size:12px;}
.adm-res-table th{text-align:left;padding:8px 10px;background:var(--bg-base);color:var(--text-muted);font-weight:700;font-size:10px;text-transform:uppercase;letter-spacing:.5px;border-bottom:1px solid var(--border-light);position:sticky;top:0;z-index:1;}
.adm-res-table td{padding:9px 10px;border-bottom:1px solid var(--border-light);color:var(--text-main);vertical-align:middle;}
.adm-res-table tr:hover td{background:var(--bg-accent-pale);}
.adm-inline-form{display:flex;flex-direction:column;gap:14px;max-width:480px;}
.adm-form-field{display:flex;flex-direction:column;gap:4px;}
.adm-form-field label{font-size:11px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;}
.adm-form-field input,.adm-form-field select{padding:10px 12px;border:1px solid var(--border-light);border-radius:8px;font-size:13px;background:var(--bg-surface-elevated);color:var(--text-main);width:100%;box-sizing:border-box;}
.adm-form-field input:focus,.adm-form-field select:focus{outline:none;border-color:var(--clr-blue);box-shadow:0 0 0 3px var(--clr-blue-light);}
.adm-dash-fb-detail{display:flex;flex-direction:column;gap:12px;}
@media(max-width:500px){
  .adm-dash-header { padding: 10px 12px; gap: 8px; }
  .adm-dash-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .adm-dash-tabbar { padding: 0 8px; gap: 0; }
  .adm-dash-tab { padding: 10px 10px; font-size: 11px; }
  .adm-dash-body { padding: 14px 12px; }
}

/* ─── RESPONSIVE POLISH ──────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .book-actions { flex-direction: column; gap: 4px; }
  .book-btn { width: 100%; justify-content: center; }
  .pdf-viewer-box { height: 96vh; }
}
@media (max-width: 520px) {
  .pdf-viewer-header { padding: 10px 12px; gap: 8px; }
  .pdf-viewer-title { font-size: 12px; }
  .pdf-act-btn { font-size: 10px; padding: 5px 10px; }
  .pdf-viewer-toolbar { padding: 6px 12px; gap: 4px; }
}

/* ─── ANIMATED STATUS & ERROR COMPONENTS ────────────────────────────────── */
.error-state-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 24px;
  background: var(--clr-red-light);
  border: 1.5px dashed var(--clr-red);
  border-radius: var(--r-md);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.6;
  animation: shakeError 0.4s ease-in-out forwards;
}

.empty-search-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  animation: swingIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.pulse-loader {
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: var(--clr-purple);
  border-radius: 50%;
  animation: pulseScale 1.2s infinite ease-in-out;
  margin-left: 6px;
  vertical-align: middle;
}

/* ─── STATUS ANIMATION KEYFRAMES ─────────────────────────────────────────── */
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes swingIn {
  0% { opacity: 0; transform: scale(0.9) translateY(15px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pulseScale {
  0%, 100% { transform: scale(0.3); opacity: 0.2; }
  50% { transform: scale(1.2); opacity: 1; }
}

  
/* ── UNIFORM CARD HEIGHT FIX ──────────────────────────── */
.book-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.book-cover {
  flex-shrink: 0;
  aspect-ratio: 3 / 4;
  width: 100%;
}
.book-label {
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.book-actions {
  margin-top: auto;
  flex-shrink: 0;
}
/* Grid uses auto-rows so all cells same height */
#cambridgeGrid {
  align-items: stretch !important;
}
/* Remove any fixed card height that causes size mismatch */
.book-card,
.book-card.glow-effect {
  min-height: unset !important;
  height: 100% !important;
}

/* ─── MOBILE RESPONSIVENESS FOR LINK MANAGER & MODALS ─── */
@media (max-width: 600px) {
  .adm-box { 
    padding: 16px; 
    border-radius: 12px; 
    margin: 10px;
    width: calc(100% - 20px);
  }
  .link-validator-row { 
    flex-wrap: wrap; 
    justify-content: space-between; 
    padding: 10px;
  }
  .lv-name { 
    width: 100%; 
    flex: none; 
    margin-bottom: 6px; 
    font-size: 12px;
  }
  .lv-type {
    order: -1;
  }
}
