/* ==========================================================================
   MENÚ DIGITAL INTERACTIVO (ESTILO KASOKU SUSHI BAR)
   Los Monos de la Cuncia — Experiencia FlipBook 3D & Dock de Controles
   ========================================================================== */

:root {
  --color-bg-dark: #0a0908;
  --color-bg-panel: rgba(18, 15, 13, 0.88);
  --color-panel-border: rgba(255, 255, 255, 0.12);
  --color-gold: #d4af37;
  --color-gold-hover: #f3cf65;
  --color-fire: #e53935;
  --color-fire-glow: rgba(229, 57, 53, 0.35);
  --color-bone: #f4efe6;
  --color-muted: #9e9382;
  --color-whatsapp: #25d366;
  --color-whatsapp-hover: #2ee672;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --dock-height: 56px;
  --header-height: 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Background Atmosphere */
.menu-stage-bg {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 50% 25%, rgba(229, 57, 53, 0.12) 0%, transparent 65%),
    radial-gradient(circle at 80% 80%, rgba(212, 175, 55, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, #120f0d 0%, #080706 100%);
  z-index: 0;
  pointer-events: none;
}

/* Texture Pattern */
.menu-stage-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: radial-gradient(#fff 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ==========================================================================
   TOP APP BAR
   ========================================================================== */
.menu-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(10, 9, 8, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: var(--color-bone);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.25s ease;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateX(-2px);
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.topbar-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--color-gold);
}

.topbar-title-wrap h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-bone);
  text-transform: uppercase;
}

.topbar-title-wrap p {
  font-size: 11px;
  color: var(--color-gold);
  letter-spacing: 0.06em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-whatsapp-top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--color-whatsapp);
  border: none;
  border-radius: 20px;
  color: #062b13;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
  transition: all 0.25s ease;
}

.btn-whatsapp-top:hover {
  background: var(--color-whatsapp-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
}

/* ==========================================================================
   FLIPBOOK MAIN STAGE & VIEWER
   ========================================================================== */
.flipbook-viewport {
  position: absolute;
  top: var(--header-height);
  bottom: calc(var(--dock-height) + 16px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 16px 20px;
  z-index: 10;
  touch-action: pan-y pinch-zoom;
}

.flipbook-zoom-container {
  display: flex;
  justify-content: center;
  align-items: center;
  transform-origin: center center;
  transition: transform 0.2s cubic-bezier(0.2, 1, 0.3, 1);
  will-change: transform;
}

.flipbook-container {
  box-shadow: 
    0 24px 70px rgba(0, 0, 0, 0.85),
    0 8px 24px rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  position: relative;
  background-color: #1a1715;
}

/* Center book crease & depth */
.flipbook-container::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.75) 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  box-shadow: 
    -6px 0 12px rgba(0, 0, 0, 0.5),
    6px 0 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 25;
}

/* Page styles */
.page {
  background-color: #12100e;
  overflow: hidden;
  position: relative;
}

.page-content {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #12100e;
}

.page-content img,
.page-content canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Book Spine Shadows */
.page.--left {
  box-shadow: inset -24px 0 28px -10px rgba(0, 0, 0, 0.35);
}

.page.--right {
  box-shadow: inset 24px 0 28px -10px rgba(0, 0, 0, 0.35);
}

/* Subtle corner fold animation hint */
.flip-corner-hint {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

/* Flip arrows overlay (Desktop click targets) */
.flip-arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(18, 15, 13, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--color-bone);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.flip-arrow-btn:hover {
  background: rgba(229, 57, 53, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: translateY(-50%) scale(1.08);
}

.flip-arrow-btn.is-disabled {
  opacity: 0.2;
  pointer-events: none;
}

.flip-arrow-btn.arrow-prev {
  left: 24px;
}

.flip-arrow-btn.arrow-next {
  right: 24px;
}

/* ==========================================================================
   BOTTOM DOCK CONTROLS (ESTILO KASOKU SUSHI BAR)
   ========================================================================== */
.menu-dock-container {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: 96vw;
}

.menu-dock {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-bg-panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--color-panel-border);
  border-radius: 36px;
  box-shadow: 
    0 16px 36px rgba(0, 0, 0, 0.6),
    0 2px 8px rgba(0, 0, 0, 0.4);
}

.dock-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-bone);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--color-gold);
  transform: translateY(-1px);
}

.dock-btn:active {
  transform: translateY(1px) scale(0.96);
}

.dock-btn.is-active {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.dock-btn.is-disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Tooltip on hover */
.dock-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(14, 12, 10, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--color-bone);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 120;
}

.dock-btn[data-tip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dock-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}

/* Page selector in dock */
.dock-page-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-bone);
}

.page-num-input {
  width: 36px;
  height: 28px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--color-gold);
  font-weight: 700;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.page-num-input:focus {
  border-color: var(--color-gold);
  background: rgba(255, 255, 255, 0.14);
}

/* Remove number arrows */
.page-num-input::-webkit-outer-spin-button,
.page-num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ==========================================================================
   THUMBNAILS DRAWER MODAL
   ========================================================================== */
.thumbnails-drawer {
  position: fixed;
  bottom: calc(var(--dock-height) + 26px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  width: min(92vw, 820px);
  background: rgba(14, 12, 10, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-panel-border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
}

.thumbnails-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.drawer-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s;
}

.drawer-close-btn:hover {
  color: var(--color-bone);
}

.thumbnails-scroll-wrap {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.thumbnails-scroll-wrap::-webkit-scrollbar {
  height: 6px;
}

.thumbnails-scroll-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

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

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

.thumb-preview {
  width: 100%;
  aspect-ratio: 1 / 1.35;
  background: #1e1b18;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.thumb-preview img,
.thumb-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-item.is-current .thumb-preview {
  border-color: var(--color-gold);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.5);
}

.thumb-caption {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
}

.thumb-item.is-current .thumb-caption {
  color: var(--color-gold);
}

/* ==========================================================================
   LOADING SPINNER / PLACEHOLDER
   ========================================================================== */
.flipbook-loading-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 9, 8, 0.85);
  z-index: 80;
  transition: opacity 0.4s ease;
}

.spinner-ember {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(229, 57, 53, 0.2);
  border-top-color: var(--color-fire);
  border-right-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-bone);
  text-transform: uppercase;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE & TABLET ADAPTATION)
   ========================================================================== */
@media (max-width: 900px) {
  .menu-topbar {
    padding: 0 14px;
  }

  .topbar-title-wrap p {
    display: none;
  }

  .btn-whatsapp-top span {
    display: none;
  }

  .btn-whatsapp-top {
    padding: 8px;
    border-radius: 50%;
  }

  .flip-arrow-btn {
    width: 42px;
    height: 42px;
  }

  .flip-arrow-btn.arrow-prev {
    left: 8px;
  }

  .flip-arrow-btn.arrow-next {
    right: 8px;
  }

  .dock-btn.hide-on-mobile {
    display: none;
  }

  .menu-dock {
    gap: 3px;
    padding: 4px 8px;
  }

  .dock-btn {
    width: 36px;
    height: 36px;
  }

  .dock-page-indicator {
    padding: 0 4px;
    font-size: 12px;
  }

  .page-num-input {
    width: 32px;
    height: 26px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .flipbook-viewport {
    padding: 8px 10px;
  }

  .flip-arrow-btn {
    display: none; /* Mobile uses natural swipe gesture */
  }

  .thumb-item {
    width: 76px;
  }
}
