/* ==========================================================================
   SBEST NGUYỄN — 3D DIGITAL FLIPBOOK STYLES
   Quiet Luxury • Golden Ratio • Mobile Optimized (2-Spread & Single Page)
   ========================================================================== */

:root {
  --bg-stage: #0D0D11;
  --bg-bar: rgba(14, 14, 18, 0.95);
  --gold-accent: #C5A059;
  --gold-light: #E7C98C;
  --gold-dark: #9A7738;
  --text-primary: #FFFFFF;
  --text-secondary: #E0E0E0;
  --text-muted: #8E8E98;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(197, 160, 89, 0.35);
  --font-serif: 'Cinzel', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-stage);
  font-family: var(--font-sans);
  color: var(--text-primary);
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  flex-direction: column;
}

/* ================= LUXURY HEADER BAR ================= */
.app-header {
  height: 56px;
  background: var(--bg-bar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
  width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-logo {
  height: 28px;
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(197, 160, 89, 0.4));
}

.header-info {
  display: flex;
  flex-direction: column;
}

.header-brand {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--gold-light);
  line-height: 1.1;
  white-space: nowrap;
}

.header-title {
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Center Page Indicator */
.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0 8px;
}

.page-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.indicator-label {
  color: var(--text-muted);
}

.indicator-current {
  font-weight: 700;
  color: var(--gold-light);
}

.indicator-total {
  color: var(--text-muted);
}

/* Header Right Buttons */
.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFF;
  border-color: var(--gold-accent);
}

/* Mode Toggle Button (2 Trang vs 1 Trang) */
.mode-toggle-btn {
  background: rgba(197, 160, 89, 0.15);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-weight: 700;
  border-radius: 999px;
  padding: 0 10px;
}

.mode-toggle-btn:hover {
  background: var(--gold-accent);
  color: #111;
  border-color: var(--gold-accent);
}

/* ================= FLIPBOOK STAGE AREA ================= */
.stage-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #181822 0%, #0D0D11 75%);
  width: 100%;
}

.ambient-spotlight {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90vw;
  height: 90vh;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(197, 160, 89, 0.05) 0%, transparent 65%);
  pointer-events: none;
  z-index: 1;
}

/* Floating Navigation Arrows */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(20, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: #FFF;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  transition: all 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.nav-arrow:hover {
  background: var(--gold-accent);
  color: #111;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 25px rgba(197, 160, 89, 0.5);
}

.nav-arrow-left { left: 20px; }
.nav-arrow-right { right: 20px; }

/* Book Wrapper & StPageFlip */
.book-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 10px;
  overflow: hidden;
}

.book-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

.flipbook {
  position: relative;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.75), 0 8px 20px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease;
}

/* Individual Pages */
.page {
  background-color: #FAF8F5;
  overflow: hidden;
  user-select: none;
}

.page-inner {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #FAF8F5;
}

.page-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Hard Cover Embellishments */
.page-cover {
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.15);
}

.page-cover-front::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 20px;
  background: linear-gradient(to right, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
}

.page-cover-back::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 20px;
  background: linear-gradient(to left, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
}

/* Flip Tip */
.flip-tip {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 20;
  animation: fadeInOut 6s ease infinite;
  white-space: nowrap;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

/* ================= FOOTER CONTROL BAR ================= */
.app-footer {
  height: 56px;
  background: var(--bg-bar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
  width: 100%;
}

.footer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 600px;
}

.footer-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.footer-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--gold-accent);
  color: var(--gold-light);
}

.footer-btn.active {
  background: var(--gold-accent);
  color: #111;
  border-color: var(--gold-accent);
}

.download-btn {
  background: var(--gold-accent);
  color: #111;
  font-weight: 700;
}

.download-btn:hover {
  background: var(--gold-light);
  color: #000;
}

.control-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 2px;
}

.page-slider-wrap {
  width: 140px;
  display: flex;
  align-items: center;
  padding: 0 6px;
}

.page-slider-wrap input[type="range"] {
  width: 100%;
  accent-color: var(--gold-accent);
  cursor: pointer;
}

/* ================= THUMBNAILS DRAWER ================= */
.thumbs-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: rgba(14, 14, 18, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-gold);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.thumbs-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  transition: color 0.2s ease;
}

.drawer-close:hover {
  color: #FFF;
}

.thumbs-grid {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-accent) transparent;
  -webkit-overflow-scrolling: touch;
}

.thumb-item {
  flex-shrink: 0;
  width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.thumb-item:hover {
  transform: translateY(-3px);
}

.thumb-img-wrap {
  width: 100%;
  height: 120px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #1A1A22;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  transition: border-color 0.2s ease;
}

.thumb-item.active .thumb-img-wrap {
  border: 2px solid var(--gold-accent);
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.5);
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-num {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.thumb-item.active .thumb-num {
  color: var(--gold-light);
  font-weight: 700;
}

/* ================= RESPONSIVE MOBILE OPTIMIZATIONS ================= */
@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  .nav-arrow {
    display: none;
  }

  .app-header {
    height: 48px;
    padding: 0 8px;
  }

  .header-left {
    gap: 6px;
  }

  .header-logo {
    height: 24px;
  }

  .header-brand {
    font-size: 0.76rem;
    letter-spacing: 0.5px;
  }

  .header-center {
    padding: 0 4px;
  }

  .page-indicator {
    padding: 3px 8px;
    font-size: 0.7rem;
    gap: 3px;
  }

  .indicator-current {
    font-size: 0.72rem;
  }

  .indicator-total {
    font-size: 0.68rem;
  }

  .header-right {
    gap: 4px;
  }

  .icon-btn {
    height: 30px;
    padding: 0 7px;
    font-size: 0.72rem;
    border-radius: 5px;
  }

  .mode-toggle-btn {
    padding: 0 8px;
    font-size: 0.7rem;
  }

  .book-wrapper {
    padding: 6px 2px;
  }

  .flip-tip {
    bottom: 6px;
    font-size: 0.65rem;
    padding: 3px 8px;
  }

  /* Footer Mobile: 3 clean touch buttons */
  .app-footer {
    height: 50px;
    padding: 0 8px;
  }

  .footer-controls {
    width: 100%;
    max-width: 100%;
    gap: 6px;
  }

  .footer-btn {
    flex: 1;
    height: 36px;
    font-size: 0.76rem;
    padding: 0 4px;
    gap: 4px;
    border-radius: 6px;
  }

  .download-btn {
    flex: 1.1;
    font-size: 0.78rem;
  }

  /* Drawer Mobile */
  .thumbs-drawer {
    height: 190px;
  }

  .drawer-header {
    height: 38px;
    padding: 0 12px;
  }

  .drawer-title {
    font-size: 0.75rem;
  }

  .thumbs-grid {
    padding: 8px 12px;
    gap: 8px;
  }

  .thumb-item {
    width: 78px;
  }

  .thumb-img-wrap {
    height: 105px;
  }
}

@media (max-width: 375px) {
  .header-brand {
    display: none;
  }
  
  .mode-toggle-btn {
    padding: 0 6px;
  }
}
