/* Reset y configuración básica */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #8B4513 0%, #D2691E 50%, #F4A460 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
}

/* Contenedor del libro */
.book-container {
  position: relative;
  width: 900px;
  height: 600px;
  max-width: 90vw;
  max-height: 80vh;
  perspective: 1000px;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,0.3));
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.5s ease;
}

.book-container.loaded {
  opacity: 1;
  transform: scale(1);
}

.book-container.transitioning {
  transform: scale(1.02);
  transition: transform 0.4s ease;
}

.flipbook {
  width: 100%;
  height: 100%;
  position: relative;
}

.book-ready {
  animation: bookReady 1s ease-out;
}

@keyframes bookReady {
  0% { 
    transform: rotateY(-15deg) scale(0.9);
    opacity: 0;
  }
  100% { 
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

/* Páginas - Mejoradas para funcionamiento sin Turn.js */
.page {
  width: 450px;
  height: 600px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: all 0.4s ease;
}

.page.active {
  display: flex;
  opacity: 1;
  z-index: 10;
}

.page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  pointer-events: none;
}

/* Portada */
.page-cover {
  background: linear-gradient(135deg, #DAA520 0%, #B8860B 50%, #8B4513 100%);
  color: white;
  text-align: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.page-cover::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,215,0,0.2) 0%, transparent 70%);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(180deg); }
}

.logo-container {
  width: 120px;
  height: 120px;
  background: rgba(255,215,0,0.3);
  border-radius: 50%;
  margin: 0 auto 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,215,0,0.5);
  box-shadow: 0 0 30px rgba(255,215,0,0.3);
}

.logo-container i {
  font-size: 60px;
  color: white;
}

.page-cover h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.5em;
  margin-bottom: 20px;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.page-cover p {
  font-size: 1.2em;
  margin-bottom: 30px;
  opacity: 0.9;
}

.btn-open-menu {
  background: rgba(255,215,0,0.2);
  color: white;
  border: 2px solid rgba(255,215,0,0.5);
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 5px 20px rgba(255,215,0,0.2);
  animation: pulse 2s infinite;
}

.btn-open-menu:hover {
  background: rgba(255,215,0,0.4);
  border-color: rgba(255,215,0,0.8);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255,215,0,0.4);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Páginas interiores */
.menu-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #DAA520;
}

.menu-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2em;
  color: #8B4513;
  margin-bottom: 5px;
}

.menu-header p {
  color: #A0522D;
  font-style: italic;
}

.menu-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
}

.menu-content::-webkit-scrollbar {
  width: 6px;
}

.menu-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.menu-content::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #DAA520, #B8860B);
  border-radius: 3px;
}

/* Categorías */
.category {
  margin-bottom: 25px;
  animation: fadeInUp 0.6s ease-out;
}

.category h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5em;
  color: #B8860B;
  margin-bottom: 15px;
  padding-bottom: 5px;
  border-bottom: 1px solid #DAA520;
  position: relative;
}

.category h3::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 50px;
  height: 2px;
  background: linear-gradient(90deg, #DAA520, #B8860B);
}

/* Items del menú */
.item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
  padding: 15px;
  background: rgba(255,248,220,0.9);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(139,69,19,0.1);
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  position: relative;
  overflow: hidden;
}

.item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(218,165,32,0.15), transparent);
  transition: left 0.5s ease;
}

.item:hover {
  transform: translateX(5px);
  box-shadow: 0 5px 20px rgba(218,165,32,0.3);
  border-left-color: #DAA520;
}

.item:hover::before {
  left: 100%;
}

.item-content {
  flex: 1;
}

.item-name {
  font-weight: 600;
  color: #8B4513;
  font-size: 1.1em;
  margin-bottom: 5px;
}

.item-desc {
  color: #A0522D;
  font-size: 0.9em;
  line-height: 1.4;
}

.item-price {
  font-weight: 700;
  color: #B8860B;
  font-size: 1.2em;
  margin-left: 15px;
  white-space: nowrap;
  text-shadow: 1px 1px 2px rgba(218,165,32,0.3);
}

/* Contraportada */
.page-back {
  background: linear-gradient(135deg, #8B4513 0%, #A0522D 50%, #654321 100%);
  color: white;
  text-align: center;
  justify-content: center;
}

.page-back h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2.2em;
  margin-bottom: 20px;
  color: #FFD700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.page-back p {
  font-size: 1.1em;
  margin-bottom: 25px;
  opacity: 0.9;
  line-height: 1.6;
}

.social-icons {
  margin: 30px 0;
}

.social-icons a {
  display: inline-block;
  margin: 0 15px;
  font-size: 2em;
  color: white;
  transition: all 0.3s ease;
}

.social-icons a:hover {
  color: #FFD700;
  transform: translateY(-5px);
  text-shadow: 0 5px 15px rgba(255,215,0,0.5);
}

/* Navegación */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid #eee;
  margin-top: 20px;
}

.page-btn {
  background: #DAA520;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1em;
}

.page-btn:hover:not(:disabled) {
  background: #B8860B;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(218,165,32,0.4);
}

.page-btn:disabled {
  background: #D2B48C;
  cursor: not-allowed;
  transform: none;
}

.page-number {
  font-weight: 600;
  color: #8B4513;
  font-size: 0.9em;
}

/* Botón flotante */
.floating-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, #DAA520 0%, #B8860B 100%);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(218,165,32,0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000;
}

.floating-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(218,165,32,0.6);
}

.floating-btn i {
  font-size: 1.5em;
}

/* Indicador de páginas */
.page-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.page-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.page-dot.active {
  background: #DAA520;
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(218,165,32,0.5);
}

/* Botones de navegación */
.nav-buttons {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}

.nav-btn {
  background: rgba(255,248,220,0.95);
  color: #8B4513;
  border: 2px solid #DAA520;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.nav-btn:hover:not(:disabled) {
  background: #DAA520;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(218,165,32,0.4);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Efectos adicionales */
.page-glow {
  animation: pageGlow 1s ease-out;
}

@keyframes pageGlow {
  0% { box-shadow: 0 0 20px rgba(218,165,32,0.5); }
  50% { box-shadow: 0 0 40px rgba(218,165,32,0.8); }
  100% { box-shadow: 0 5px 20px rgba(139,69,19,0.1); }
}

/* Modo nocturno */
.night-mode {
  background: linear-gradient(135deg, #2F1B14 0%, #8B4513 100%);
}

.night-mode .page:not(.page-cover):not(.page-back) {
  background: linear-gradient(135deg, #3C2414 0%, #2F1B14 100%);
  color: #F5DEB3;
}

.night-mode .item {
  background: rgba(139,69,19,0.8);
  color: #F5DEB3;
}

.night-mode .item-name {
  color: #FFD700;
}

.night-mode .item-desc {
  color: #DEB887;
}

.night-mode .menu-header h2 {
  color: #FFD700;
}

.night-mode .menu-header p {
  color: #DEB887;
}

/* Animaciones */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animated {
  animation: fadeInUp 0.6s ease-out;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

/* Efectos de ripple */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  .item:hover {
    transform: none;
  }
  
  .item:active {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(218,165,32,0.3);
    border-left-color: #DAA520;
  }
  
  .animated {
    animation: none;
  }
  
  .reduce-motion .animated {
    animation: none;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .book-container {
    width: 100%;
    height: 500px;
  }
  
  .page {
    width: 100%;
    height: 500px;
    padding: 20px;
  }
  
  .page-cover h1 {
    font-size: 2em;
  }
  
  .page-cover p {
    font-size: 1em;
  }
  
  .logo-container {
    width: 100px;
    height: 100px;
  }
  
  .logo-container i {
    font-size: 50px;
  }
  
  .menu-header h2 {
    font-size: 1.5em;
  }
  
  .category h3 {
    font-size: 1.3em;
  }
  
  .item {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
  }
  
  .item-price {
    margin-left: 0;
    margin-top: 10px;
    font-size: 1.1em;
  }
  
  .item-name {
    font-size: 1em;
  }
  
  .item-desc {
    font-size: 0.85em;
  }
  
  .nav-buttons {
    bottom: 10px;
    gap: 5px;
  }
  
  .nav-btn {
    padding: 8px 16px;
    font-size: 0.9em;
  }
  
  .page-indicator {
    bottom: 10px;
  }
  
  .floating-btn {
    width: 50px;
    height: 50px;
    bottom: 20px;
    right: 20px;
  }
  
  .floating-btn i {
    font-size: 1.2em;
  }
}

@media (max-width: 480px) {
  .book-container {
    height: 450px;
    padding: 10px;
  }
  
  .page {
    height: 450px;
    padding: 15px;
  }
  
  .page-cover h1 {
    font-size: 1.8em;
  }
  
  .menu-header h2 {
    font-size: 1.3em;
  }
  
  .category h3 {
    font-size: 1.2em;
  }
  
  .btn-open-menu {
    padding: 12px 25px;
    font-size: 1em;
  }
  
  .nav-btn {
    padding: 6px 12px;
    font-size: 0.8em;
  }
}

/* Optimizaciones para impresión */
@media print {
  body {
    background: white;
  }
  
  .book-container {
    filter: none;
    box-shadow: none;
  }
  
  .page {
    box-shadow: none;
    break-inside: avoid;
  }
  
  .nav-buttons,
  .page-indicator,
  .floating-btn {
    display: none;
  }
  
  .animated {
    animation: none;
  }
}

/* Estados de carga */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 4px solid #DAA520;
  border-top: 4px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1000;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Efectos de enfoque para accesibilidad */
.nav-btn:focus,
.page-btn:focus,
.btn-open-menu:focus,
.page-dot:focus,
.floating-btn:focus {
  outline: 3px solid #FFD700;
  outline-offset: 2px;
}

/* Transiciones suaves */
.flipbook .page {
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.flipbook .turn-page {
  background-color: #fff;
}

/* Mejoras de rendimiento */
.page,
.nav-btn,
.page-btn,
.floating-btn,
.item {
  will-change: transform;
}

/* Efectos de entrada específicos */
.page-cover .animated {
  opacity: 0;
  animation-fill-mode: forwards;
}

.page-cover .animated.delay-1 {
  animation-delay: 0.5s;
}

.page-cover .animated.delay-2 {
  animation-delay: 1s;
}

.page-cover .animated.delay-3 {
  animation-delay: 1.5s;
}