/* ===================================================
   KITOBCHI.UZ — ULTRA-PREMIUM LUXURY GLASSMORPHISM
   Midnight Velvet + Refractive Frosted Glass + Pure Amber Gold
   =================================================== */

:root {
  --bg-primary: #070a0f;
  --bg-surface: rgba(14, 20, 32, 0.65);
  --bg-surface-elevated: rgba(21, 30, 48, 0.75);
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-glass-strong: rgba(255, 255, 255, 0.18);
  --border-gold: rgba(245, 158, 11, 0.35);
  --border-gold-glow: rgba(251, 191, 36, 0.6);
  --gold-primary: #f59e0b;
  --gold-glow: #d97706;
  --gold-light: #fef3c7;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-cinzel: 'Cinzel', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-h: 5rem;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
}

/* Cursor pointer on all interactive elements */
button, a, select, input[type="range"], input[type="checkbox"], [role="button"], [data-tariff], [data-open], [data-fav] {
  cursor: pointer;
}

/* Accessibility focus indicator */
:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #070a0f; }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; border: 1px solid rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb:hover { background: #f59e0b; }

.scrollbar-none { scrollbar-width: none; -ms-overflow-style: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }

.line-clamp-1, .line-clamp-2, .line-clamp-3 {
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
}
.line-clamp-1 { -webkit-line-clamp: 1; }
.line-clamp-2 { -webkit-line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; }

/* ===================================================
   GLASSMORPHISM TOKENS & SHEEN
   =================================================== */

.glass-panel {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%), rgba(11, 16, 26, 0.72);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.12), 0 8px 24px -6px rgba(0, 0, 0, 0.5);
}

.glass-panel-elevated {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%), rgba(14, 20, 32, 0.82);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--border-glass-strong);
  box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.18), 0 20px 48px -12px rgba(0, 0, 0, 0.7);
}

.glass-panel-gold {
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.12) 0%, rgba(14, 20, 32, 0.75) 100%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-gold);
  box-shadow: inset 0 1px 2px 0 rgba(251, 191, 36, 0.25), 0 16px 40px -10px rgba(245, 158, 11, 0.2);
}

/* Ambient glow background orbs */
.ambient-glow-orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.45;
  will-change: transform;
}

/* ===================================================
   VIP CARDVIEW ARCHITECTURE
   =================================================== */

.vip-card-view {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  border-radius: 1.5rem;
  padding: 1.75rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%), rgba(14, 20, 32, 0.75);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.12), 0 12px 36px -8px rgba(0, 0, 0, 0.6);
  transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  overflow: hidden;
}

.vip-card-view:hover {
  transform: translateY(-6px) scale(1.015);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.25), 0 24px 50px -10px rgba(245, 158, 11, 0.2);
}

.vip-card-popular {
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.14) 0%, rgba(245, 158, 11, 0.03) 50%, rgba(14, 20, 32, 0.85) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.65);
  box-shadow: inset 0 1px 2px rgba(251, 191, 36, 0.45), 0 20px 50px -10px rgba(245, 158, 11, 0.3);
}

.vip-card-popular:hover {
  transform: translateY(-8px) scale(1.025);
  border-color: rgba(251, 191, 36, 0.9);
  box-shadow: inset 0 1px 3px rgba(251, 191, 36, 0.6), 0 28px 60px -10px rgba(245, 158, 11, 0.45);
}

.vip-card-view::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transition: left 0.6s ease;
  pointer-events: none;
}

.vip-card-view:hover::before {
  left: 100%;
}

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

.badge-gold-shimmer {
  background: linear-gradient(90deg, #d97706 0%, #fef3c7 50%, #d97706 100%);
  background-size: 200% 100%;
  animation: goldShimmer 3s infinite linear;
  color: #78350f;
  font-weight: 800;
}

/* ===================================================
   3D BOOK CARD IN CATALOG
   =================================================== */

.book-card-3d-wrapper {
  perspective: 1200px;
}

.book-card-3d {
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease, border-color 0.3s ease;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%), rgba(14, 20, 32, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 12px 28px -6px rgba(0, 0, 0, 0.6);
}

.book-card-3d:hover {
  transform: translateY(-8px) rotateY(-5deg) rotateX(3deg);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2), 0 22px 48px -10px rgba(245, 158, 11, 0.25);
}

.book-spine-effect {
  position: relative;
  overflow: hidden;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.6),
              inset 6px 0 12px rgba(255, 255, 255, 0.15),
              inset -4px 0 8px rgba(0, 0, 0, 0.6);
}

.book-spine-effect::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 14px;
  background: linear-gradient(90deg, rgba(255,255,255,.25) 0%, rgba(0,0,0,.5) 35%,
              rgba(255,255,255,.08) 70%, transparent 100%);
  pointer-events: none; z-index: 2;
}

.book-spine-effect::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.14) 0%, transparent 60%);
  pointer-events: none; z-index: 2;
}

.cover-fallback {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1rem; height: 100%; width: 100%;
  background: linear-gradient(150deg, #1e293b 0%, #0f172a 55%, #422006 100%);
  color: #fcd34d; font-family: var(--font-serif);
}
.cover-fallback .cf-initials {
  font-size: clamp(1.6rem, 7vw, 2.4rem); font-weight: 900; letter-spacing: .06em;
  color: rgba(252, 211, 77, .95); line-height: 1;
}
.cover-fallback .cf-title {
  margin-top: .6rem; font-size: .7rem; line-height: 1.25; color: rgba(226,232,240,.8);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ===================================================
   FLOATING GLASS DOCK (MOBILE NAVIGATION)
   =================================================== */

.floating-glass-dock {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 460px;
  margin: 0 auto;
  z-index: 45;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%), rgba(11, 16, 26, 0.88);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 16px 36px -6px rgba(0, 0, 0, 0.75), 0 0 20px rgba(245, 158, 11, 0.15);
  padding: 0.5rem 0.75rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  position: relative;
}

.dock-item:hover {
  color: var(--gold-primary);
  background: rgba(255, 255, 255, 0.06);
}

.dock-item.active {
  color: var(--gold-primary);
  background: rgba(245, 158, 11, 0.15);
  box-shadow: inset 0 1px 1px rgba(251, 191, 36, 0.3);
}

.dock-item.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 9999px;
  background: var(--gold-primary);
  box-shadow: 0 0 6px var(--gold-primary);
}

/* ===================================================
   MUTOLAA OYNASI (HIGH-PRECISION 3D PAGE FLIP)
   =================================================== */

#reader-overlay {
  height: 100vh;
  height: 100dvh;
}

.reader-theme-dark   { --reader-page-bg: #131a29; --reader-page-filter: invert(.9) hue-rotate(180deg); }
.reader-theme-sepia  { --reader-page-bg: #f7eedb; --reader-page-filter: sepia(.28) saturate(1.05) brightness(.98); }
.reader-theme-light  { --reader-page-bg: #ffffff; --reader-page-filter: none; }

.stf__parent {
  margin: 0 auto;
  perspective: 2500px;
}

.stf__item {
  background-color: var(--reader-page-bg, #fff) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Exact full-bleed page sheet */
.page-sheet {
  background: var(--reader-page-bg, #fff);
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

/* Spine book shadow gradients */
.page-sheet.even-page::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 32px;
  background: linear-gradient(to left, rgba(0,0,0,0.18), transparent);
  pointer-events: none;
  z-index: 10;
}

.page-sheet.odd-page::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 32px;
  background: linear-gradient(to right, rgba(0,0,0,0.18), transparent);
  pointer-events: none;
  z-index: 10;
}

/* Razor-sharp high-DPI canvas */
.pdf-page-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  filter: var(--reader-page-filter, none);
  transition: filter .25s ease;
}

.page-skeleton-loader {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: shimmerSweep 1.5s infinite;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

.scroll-reader-page {
  background: var(--reader-page-bg, #fff);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .6);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
  min-height: 40vh;
}
.scroll-reader-page canvas {
  width: 100%;
  height: auto;
  display: block;
  filter: var(--reader-page-filter, none);
}

#reader-progress-bar {
  position: absolute;
  top: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, #f59e0b, #fcd34d);
  transition: width .3s ease;
  z-index: 40;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
}

/* Skeleton animation */
@keyframes shimmerSweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  background-size: 200% 100%;
  animation: shimmerSweep 1.4s infinite linear;
  border-radius: .5rem;
}

/* Modal Open Prevention */
body.modal-open { overflow: hidden; }

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .book-card-3d:hover, .vip-card-view:hover { transform: none; }
}

/* Print */
@media print {
  header, footer, .floating-glass-dock, #reader-overlay, #toast-container { display: none !important; }
}

/* Hide mobile floating dock when reader or modals are open */
body.modal-open .floating-glass-dock,
.floating-glass-dock.dock-hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
