/* ============================================
   DL-LIBRARY.UZ — Design System
   Renessans Ta'lim Universiteti Raqamli Kutubxona
   ============================================ */

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

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Primary palette */
  --primary-400: #818cf8;
  --primary-500: #667eea;
  --primary-600: #5a67d8;
  --primary-700: #4c51bf;

  /* Accent */
  --accent-400: #a78bfa;
  --accent-500: #764ba2;
  --accent-600: #6b21a8;

  /* Gradient */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-hero: linear-gradient(135deg, #1a1a3e 0%, #252550 50%, #352b6e 100%);
  --gradient-card-hover: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.12));

  /* Category colors */
  --cat-fandastur: #e11d48;
  --cat-darslik: #3b82f6;
  --cat-monografiya: #8b5cf6;
  --cat-qollanma: #10b981;
  --cat-lugat: #f59e0b;
  --cat-boshqa: #6b7280;

  /* Dark mode (default) — LIGHTENED for readability */
  --bg-body: #141428;
  --bg-surface: #1c1c3a;
  --bg-card: rgba(32, 32, 72, 0.7);
  --bg-card-hover: rgba(45, 45, 95, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-strong: rgba(255, 255, 255, 0.1);
  --bg-modal: rgba(10, 10, 30, 0.92);
  --bg-input: rgba(255, 255, 255, 0.08);

  --text-primary: #eeeeff;
  --text-secondary: #b8b8d8;
  --text-muted: #8888aa;
  --text-accent: #a0a8f8;

  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 12px 40px rgba(102, 126, 234, 0.2);
  --shadow-modal: 0 25px 80px rgba(0, 0, 0, 0.5);

  /* Dimensions */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50%;

  --header-height: 80px;
  --max-width: 1280px;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Light Mode ---------- */
[data-theme="light"] {
  --bg-body: #f4f4fb;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-glass: rgba(255, 255, 255, 0.6);
  --bg-glass-strong: rgba(255, 255, 255, 0.85);
  --bg-modal: rgba(255, 255, 255, 0.97);
  --bg-input: rgba(0, 0, 20, 0.04);

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8888aa;
  --text-accent: #5a67d8;

  --border-color: rgba(0, 0, 40, 0.08);
  --border-hover: rgba(0, 0, 40, 0.16);

  --shadow-card: 0 4px 24px rgba(0, 0, 40, 0.08);
  --shadow-card-hover: 0 12px 40px rgba(102, 126, 234, 0.15);
  --shadow-modal: 0 25px 80px rgba(0, 0, 40, 0.15);

  --gradient-hero: linear-gradient(135deg, #e8e8f8 0%, #f4f4fb 50%, #ede8f5 100%);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: transparent;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: color var(--transition-normal);
}

/* ---------- Neural Network Background ---------- */
.neural-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
}

/* ---------- Animated Background ---------- */
.bg-decoration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: orbFloat 20s ease-in-out infinite;
}

.bg-orb--1 {
  width: 500px;
  height: 500px;
  background: var(--primary-500);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.bg-orb--2 {
  width: 400px;
  height: 400px;
  background: var(--accent-500);
  bottom: -50px;
  left: -100px;
  animation-delay: -7s;
}

.bg-orb--3 {
  width: 300px;
  height: 300px;
  background: #3b82f6;
  top: 50%;
  left: 50%;
  animation-delay: -14s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.1); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 30px) scale(1.05); }
}

[data-theme="light"] .bg-orb { opacity: 0.08; }

/* ---------- Container ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  height: var(--header-height);
  transition: background var(--transition-normal), border var(--transition-normal);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.navbar__logo-img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: #fff;
  padding: 2px;
  border: 1px solid var(--border-color);
}

.navbar__logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.navbar__logo-text span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Language Switcher ---------- */
.lang-switcher {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lang-btn {
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--gradient-primary);
  color: #fff;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}

/* ---------- Hero Section ---------- */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}

.hero__logo {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-full);
  object-fit: contain;
  border: 3px solid transparent;
  background-image: var(--gradient-primary);
  background-origin: border-box;
  background-clip: content-box, border-box;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  animation: logoGlow 4s ease-in-out infinite alternate;
  padding: 8px;
  background-color: #fff;
}

[data-theme="dark"] .hero__logo {
  background-color: rgba(255,255,255,0.95);
}

@keyframes logoGlow {
  0% { box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3); }
  100% { box-shadow: 0 8px 48px rgba(118, 75, 162, 0.4); }
}

.hero__name {
  font-family: 'Outfit', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.hero__title {
  font-size: 1.55rem;
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 24px;
  opacity: 0.9;
}

.hero__bio {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 750px;
  margin: 0 auto 24px;
  line-height: 1.85;
  text-align: justify;
}

/* ---------- Contact Section ---------- */
.hero__contact {
  max-width: 600px;
  margin: 0 auto 32px;
  padding: 20px 24px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

.hero__contact-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.6;
}

.hero__contact-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.contact-link:hover {
  border-color: var(--primary-500);
  background: rgba(102, 126, 234, 0.1);
  transform: translateX(4px);
}

.contact-link__icon {
  font-size: 1rem;
}

/* ---------- Stats ---------- */
.stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
  padding: 16px 24px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  min-width: 120px;
  transition: all var(--transition-fast);
}

.stat:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat__number {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}

.stat__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ---------- Controls ---------- */
.controls {
  padding: 32px 0 16px;
  position: sticky;
  top: var(--header-height);
  z-index: 50;
  background: var(--bg-body);
  transition: background var(--transition-normal);
}

.controls::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, var(--bg-body), transparent);
  pointer-events: none;
}

.search-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 16px 20px 16px 50px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.search-count {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  padding: 8px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ---------- Books Grid ---------- */
.books-section {
  padding: 24px 0 80px;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
}

.no-results__icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.no-results__text {
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* ---------- Book Card ---------- */
.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: default;
  transition: all var(--transition-normal);
  position: relative;
  backdrop-filter: blur(10px);
  animation: fadeInUp 0.6s ease-out both;
}

.book-card:hover {
  transform: translateY(-8px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
  background: var(--bg-card-hover);
}

.book-card__cover-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-body));
}

.book-card__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.book-card:hover .book-card__cover {
  transform: scale(1.05);
}

.book-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  backdrop-filter: blur(8px);
}

.book-card__badge--fandastur { background: rgba(225, 29, 72, 0.85); }
.book-card__badge--darslik { background: rgba(59, 130, 246, 0.85); }
.book-card__badge--monografiya { background: rgba(139, 92, 246, 0.85); }
.book-card__badge--qollanma { background: rgba(16, 185, 129, 0.85); }
.book-card__badge--lugat { background: rgba(245, 158, 11, 0.85); }
.book-card__badge--boshqa { background: rgba(107, 114, 128, 0.85); }

.book-card__lang-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.book-card__body {
  padding: 20px;
}

.book-card__title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.book-card__year, .book-card__author {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.book-card__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
}

/* ---------- QR Code on Card ---------- */
.book-card__qr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.book-card__qr-img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  padding: 3px;
}

.book-card__qr-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.book-card__actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--gradient-primary);
  color: #fff;
  flex: 1;
}

.btn--primary:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn--secondary {
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn--secondary:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: scale(1.03);
}

/* ============================================
   FLIPBOOK MODAL
   ============================================ */
.flipbook-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.flipbook-overlay.active {
  opacity: 1;
  visibility: visible;
}

.flipbook-modal-content {
  width: 100%;
  max-width: 1200px;
  height: 94vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  transform: scale(0.92) translateY(20px);
  transition: transform var(--transition-normal);
}

.flipbook-overlay.active .flipbook-modal-content {
  transform: scale(1) translateY(0);
}

/* Flipbook Header */
.flipbook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-glass);
  flex-shrink: 0;
}

.flipbook-header__title {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.flipbook-header__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flipbook-header__page-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0 12px;
  min-width: 70px;
  text-align: center;
}

.flipbook-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.flipbook-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: scale(1.08);
}

.flipbook-btn--close:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

/* Flipbook Body */
.flipbook-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(20,20,40,0.5), rgba(30,30,60,0.5));
}

[data-theme="light"] .flipbook-body {
  background: linear-gradient(135deg, #e8e8f0, #f0f0f8);
}

/* Flipbook Container */
#flipbook-container {
  position: relative;
}

.flipbook-page {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.flipbook-page canvas {
  display: block;
}

.flipbook-page__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f8f8f8;
  color: #bbb;
  font-size: 1.5rem;
  font-weight: 300;
}

/* Flipbook Loading Overlay */
.flipbook-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
}

.flipbook-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.flipbook-loading__text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Flipbook QR in Modal */
.flipbook-qr {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 5;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  transition: all var(--transition-fast);
}

.flipbook-qr:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.flipbook-qr__img {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  padding: 3px;
  display: block;
}

/* Nav arrows */
.flipbook-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}

.flipbook-nav--prev { left: 12px; }
.flipbook-nav--next { right: 12px; }

.flipbook-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

.flipbook-nav-btn:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

/* ---------- Footer ---------- */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer__text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.footer__text a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer__text a:hover {
  color: var(--primary-400);
}

.footer__heart {
  color: #ef4444;
  display: inline-block;
  animation: heartbeat 1.5s ease-in-out infinite;
}

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

/* ---------- Scroll to Top ---------- */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-normal);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.5);
}

/* ---------- Loading Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-glass) 25%, var(--bg-glass-strong) 50%, var(--bg-glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero { padding: 40px 0 24px; }
  .hero__logo { width: 120px; height: 120px; }
  .hero__name { font-size: 1.7rem; }
  .hero__title { font-size: 1.1rem; }
  .hero__bio { font-size: 0.88rem; text-align: left; }
  .hero__contact { padding: 16px; }
  .hero__contact-text { font-size: 0.82rem; }
  .contact-link { font-size: 0.8rem; padding: 6px 12px; }
  .stats { gap: 8px; flex-wrap: wrap; }
  .stat { padding: 10px 12px; min-width: 80px; flex: 0 0 auto; }
  .stat__number { font-size: 1.3rem; }
  .controls { padding: 20px 0 12px; }
  .search-input { padding: 14px 16px 14px 46px; font-size: 0.95rem; }
  .filters { gap: 6px; }
  .filter-btn { padding: 6px 14px; font-size: 0.8rem; }
  .books-grid { grid-template-columns: 1fr; gap: 16px; }
  .book-card__body { padding: 16px; }

  .flipbook-modal-content { height: 97vh; border-radius: var(--radius-lg); }
  .flipbook-header { padding: 10px 14px; }
  .flipbook-header__title { font-size: 0.85rem; max-width: 40%; }
  .flipbook-nav { display: none; }
  .flipbook-qr { bottom: 10px; right: 10px; }
  .flipbook-qr__img { width: 56px; height: 56px; }

  .navbar__logo-text { font-size: 1rem; }
  .lang-btn { padding: 5px 8px; font-size: 0.72rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero__name { font-size: 1.4rem; }
  .hero__logo { width: 90px; height: 90px; }
  .stats { gap: 6px; }
  .stat { min-width: 65px; padding: 8px 6px; }
  .stat__number { font-size: 1.1rem; }
  .stat__label { font-size: 0.6rem; }
  .navbar__logo-text { display: none; }
}

@media (min-width: 1024px) {
  .books-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1400px) {
  .books-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Content Protection ---------- */
/* Prevent selection on protected elements */
.book-card,
.book-card__cover,
.book-card__qr-img,
.flipbook-overlay,
.flipbook-page,
.flipbook-page canvas {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Prevent image dragging */
.book-card img {
  -webkit-user-drag: none;
  user-drag: none;
}

.flipbook-page img,
.flipbook-page canvas {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

/* Clickable areas on book cards */
.book-card__cover-wrapper,
.book-card__title {
  cursor: pointer;
}

.book-card__cover-wrapper:hover .book-card__cover {
  transform: scale(1.08);
}

.book-card__title:hover {
  color: var(--text-accent);
}

/* Footer sub-text */
.footer__text--sub {
  margin-top: 4px;
  font-size: 0.78rem;
  opacity: 0.7;
}
