@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&family=Playfair+Display:ital,wght@0,700;0,800;1,700;1,800&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

/*==========================================
  1. CONFIGURACIÓN BASE Y VARIABLES
==========================================*/
@layer base {
    :root {
        --gold: #C5A059;
        --gold-light: #D4AF37;
        --primary: #0F0F0F;
        --secondary: #F9F9F9;
        --dark-card: #1A1A1A;
        --dark-bg: #080808;
    }

    body {
        @apply bg-secondary text-primary font-sans transition-colors duration-500 overflow-x-hidden;
    }

    .dark body {
        @apply bg-dark-bg text-white;
    }

    h1, h2, h3, .font-serif {
        @apply font-serif italic;
    }

    /* Scrollbar Premium */
    ::-webkit-scrollbar { width: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { 
        background: var(--gold); 
        border-radius: 10px;
    }
}

/* BLOQUEO DE DESBORDAMIENTO HORIZONTAL */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    position: relative;
    /* Evita el rebote elástico en iPhones que a veces muestra blanco */
    height: -webkit-fill-available; 
}

/* Forzar que todos los contenedores respeten el ancho */
* {
    box-sizing: border-box;
}

/* Ajuste para Swiper: a veces se sale del ancho */
.swiper {
    width: 100% !important;
    max-width: 100vw !important;
}

/*==========================================
  2. HERO PREMIUM (Efecto Cinematográfico)
==========================================*/
.heroSwiper {
    width: 100%;
    height: 100vh;
    background: #000;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7);
    transform: scale(1);
    transition: transform 10s linear;
}

/* Efecto de zoom lento (Ken Burns) */
.swiper-slide-active .hero-image {
    transform: scale(1.15);
}

/* Animación de entrada de textos en el Hero */
.heroSwiper h1, .heroSwiper h2, .heroSwiper p, .heroSwiper span, .heroSwiper .btn-gold {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.swiper-slide-active h1, 
.swiper-slide-active h2, 
.swiper-slide-active p, 
.swiper-slide-active span, 
.swiper-slide-active .btn-gold {
    opacity: 1;
    transform: translateY(0);
}

.swiper-slide-active span { transition-delay: 0.2s; }
.swiper-slide-active h1, .swiper-slide-active h2 { transition-delay: 0.4s; }
.swiper-slide-active p { transition-delay: 0.6s; }
.swiper-slide-active .btn-gold { transition-delay: 0.8s; }

/*==========================================
  3. CATEGORÍAS (Diseño de Tarjeta Alta)
==========================================*/
.categoriesSwiper {
    padding-bottom: 80px !important;
    overflow: visible !important;
}

.category-card {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 30px;
    height: 520px; /* Recuperamos la altura elegante */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.5s ease;
}

.category-card:hover img {
    transform: scale(1.1);
}

.category-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
    text-align: left;
}

.category-overlay span {
    color: var(--gold);
    letter-spacing: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.category-overlay h3 {
    color: white;
    font-size: 32px;
    line-height: 1;
    margin-bottom: 15px;
}

.category-overlay p {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.category-overlay small {
    color: var(--gold);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 11px;
}

/* Efecto de enfoque para Swiper */
.categoriesSwiper .swiper-slide {
    transition: 0.6s;
    opacity: 0.4;
    transform: scale(0.85);
}

.categoriesSwiper .swiper-slide-active {
    opacity: 1;
    transform: scale(1);
}

/*==========================================
  4. BOTONES Y UI (Luxury Details)
==========================================*/
@layer components {
    .btn-gold {
        position: relative;
        overflow: hidden;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background-color: var(--gold);
        color: #0F0F0F !important;
        padding: 16px 36px;
        border-radius: 14px;
        font-weight: 800;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.2em;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        box-shadow: 0 10px 25px rgba(197, 160, 89, 0.3);
        border: 2px solid var(--gold);
    }

    .btn-gold:hover {
        background-color: transparent;
        color: var(--gold) !important;
        transform: translateY(-5px);
        box-shadow: 0 15px 35px rgba(197, 160, 89, 0.4);
    }

    .btn-reservation-top {
        @apply w-full py-5 rounded-2xl font-black uppercase tracking-[0.25em] text-[12px] flex items-center justify-center gap-3 transition-all duration-500 shadow-2xl;
        background: linear-gradient(135deg, #C5A059 0%, #D4AF37 50%, #C5A059 100%);
        background-size: 200% auto;
        color: #0F0F0F !important;
    }

    .btn-reservation-top:hover {
        background-position: right center;
        @apply -translate-y-2 shadow-gold/40;
    }

    .input-premium {
        @apply w-full rounded-2xl py-4 px-6 outline-none transition-all text-sm border-gray-100 dark:border-white/5;
        background-color: #f1f1f1;
    }
    .dark .input-premium { @apply bg-white/5 text-white; }
    .input-premium:focus { @apply ring-4 ring-gold/10 border-gold bg-white; }
}

/*==========================================
  5. ESCUDO CONTRA PARPADEO (Refinado)
==========================================*/
#cartSidebar, #mobileMenu, #cartOverlay, #menuOverlay {
    visibility: hidden;
}

#cartSidebar.translate-x-0, #cartSidebar.translate-x-full,
#mobileMenu.translate-x-0, #mobileMenu.-translate-x-full,
#cartOverlay:not(.hidden), #menuOverlay:not(.hidden) {
    visibility: visible;
}

/*==========================================
  6. EXTRAS Y ANIMACIONES
==========================================*/
@keyframes shine { 100% { left: 125%; } }
.btn-gold::before {
    content: '';
    position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
    transform: skewX(-25deg); transition: 0.5s;
}
.btn-gold:hover::before { animation: shine 0.75s forwards; }

.img-gradient {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.backdrop-blur-xl { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

/* Fix para Swiper Fade en el Hero */
.heroSwiper .swiper-slide {
    opacity: 0 !important;
}
.heroSwiper .swiper-slide-active {
    opacity: 1 !important;
}

/* EFECTO TEXT POP (Animación de entrada del texto en el Hero) */
.swiper-slide-active h1, 
.swiper-slide-active h2, 
.swiper-slide-active p, 
.swiper-slide-active .btn-gold {
    animation: textPop 1.2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes textPop {
    from { opacity: 0; transform: translateY(50px); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ZOOM SUAVE EN LA IMAGEN ACTIVA */
.swiper-slide-active .hero-image {
    animation: zoomKenBurns 10s linear infinite alternate;
}

@keyframes zoomKenBurns {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}

/* SOMBRA DE TEXTO PARA LEGIBILIDAD */
.shadow-text {
    text-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

/* Asegurar que el toast y los sidebars estén siempre al frente */
#toast-container {
    z-index: 10001 !important;
}

#mobileMenu, #cartSidebar {
    z-index: 1000 !important;
    visibility: visible !important;
}

#menuOverlay, #cartOverlay {
    z-index: 950 !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

/* Evitar que el modo oscuro oculte el texto en el carrito */
.dark #cartSidebar {
    background-color: rgba(26, 26, 26, 0.98) !important;
}


/* Ajuste para los Toasts de Marca */
.bg-gold {
    background: linear-gradient(135deg, #C5A059 0%, #D4AF37 100%) !important;
}

#toast-container span {
    text-shadow: none; /* Limpiamos sombras de texto para máxima legibilidad */
}

/* Animación de entrada más elegante */
@keyframes fade-up {
    from { opacity: 0; transform: translate(-50%, 30px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/*==========================================
  INPUTS Y SELECTORES PREMIUM
==========================================*/

/* Estilo Base para Inputs y Selects */
.input-premium {
    width: 100%;
    background-color: #f3f4f6; /* Gris muy suave */
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px; /* Bordes muy redondeados modernos */
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none; /* Quita el estilo nativo */
}

/* Modo Oscuro para Inputs */
.dark .input-premium {
    background-color: rgba(255, 255, 255, 0.05); /* Fondo traslúcido */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Estado de Enfoque (Focus) - El Brillo Dorado */
.input-premium:focus {
    background-color: #ffffff;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.15); /* Resplandor dorado suave */
    transform: translateY(-1px);
}

.dark .input-premium:focus {
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.2);
}

/* Personalización del Selector (Flecha Dorada) */
select.input-premium {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23C5A059' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

/* Asegurar que las opciones se vean bien en modo oscuro */
.input-premium option {
    background-color: #ffffff;
    color: #1a1a1a;
    padding: 10px;
}

.dark .input-premium option {
    background-color: #1a1a1a;
    color: #ffffff;
}

/* Labels Estilizados */
.label-premium {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #888;
    margin-bottom: 8px;
    margin-left: 4px;
    transition: color 0.3s ease;
}

.input-premium:focus + .label-premium,
.label-premium:has(+ .input-premium:focus) {
    color: var(--gold);
}

/*==========================================
  DISEÑO DE FILTROS GOURMET
==========================================*/

.filter-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 99px; /* Botón tipo píldora */
    background: transparent;
    border: 1px solid rgba(197, 160, 89, 0.2); /* Borde dorado muy suave */
    color: #888;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    white-space: nowrap;
}

/* Hover: Se ilumina el borde y el icono */
.filter-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-2px);
}

.filter-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.filter-btn:hover i {
    transform: scale(1.2);
}

/* CATEGORÍA ACTIVA: Dorado Sólido */
.active-filter {
    background-color: var(--gold) !important;
    color: #0F0F0F !important; /* Texto negro para contraste */
    border-color: var(--gold) !important;
    box-shadow: 0 10px 25px rgba(197, 160, 89, 0.3);
    transform: translateY(-3px) scale(1.05);
}

.active-filter i {
    color: #0F0F0F !important;
}

/* Modo Oscuro: Ajuste de bordes */
.dark .filter-btn {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.dark .active-filter {
    background-color: var(--gold) !important;
    color: #0F0F0F !important;
}

/* Mejora del efecto Glassmorphism */
#header.backdrop-blur-xl {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Transición suave para los iconos dentro del header */
#header i, #header h1, #header a {
    transition: color 0.4s ease, transform 0.4s ease;
}

/* Forzar que el header siempre sea legible */
#header {
    background-color: rgba(255, 255, 255, 0.98) !important; /* Blanco sólido casi total */
}

.dark #header {
    background-color: rgba(15, 15, 15, 0.98) !important; /* Negro sólido casi total */
}

/* Asegurar color de letras del menú */
#header .nav-link {
    color: #1a1a1a !important; /* Negro en modo claro */
}

.dark #header .nav-link {
    color: #ffffff !important; /* Blanco en modo oscuro */
}

/* El link activo siempre dorado */
#header .nav-active {
    color: var(--gold) !important;
}

/*==========================================
  REGLAS DE NAVEGACIÓN (FIX MODO OSCURO)
==========================================*/

/* Clase base para todos los links */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
    opacity: 0.7;
    color: inherit; /* Hereda negro en claro y blanco en oscuro */
}

/* HOVER Y PÁGINA ACTIVA (Dorado Garantizado) */
.nav-link:hover, 
.nav-active,
.dark .nav-link:hover, 
.dark .nav-active {
    opacity: 1 !important;
    color: var(--gold) !important; /* Forzamos el dorado de LACANOB */
}

/* LA RAYA DORADA (Subrayado) */
.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background-color: var(--gold);
    transition: width 0.3s ease;
}

/* Mantener la raya visible en la página activa o al pasar el mouse */
.nav-link:hover::after, 
.nav-active::after,
.dark .nav-active::after {
    width: 100% !important;
}

#cartSidebar, #mobileMenu, #cartOverlay, #menuOverlay {
    visibility: hidden !important;
    opacity: 0 !important;
    transition: none !important; /* Evita que se vea el deslizamiento al cargar */
}

    /* Solo se vuelven visibles cuando tienen la clase de estar abiertos */
#cartSidebar.translate-x-0, 
#mobileMenu.translate-x-0,
#cartOverlay:not(.hidden), 
#menuOverlay:not(.hidden) {
    visibility: visible !important;
    opacity: 1 !important;
    transition: transform 0.5s ease, opacity 0.5s ease !important;
}

/* Asegura que el sidebar use todo el alto disponible restando las barras del navegador */
#cartSidebar {
    height: 100vh; /* Fallback para navegadores viejos */
    height: 100dvh; 
}

/* Evitar que el contenido se pegue al borde inferior en iPhone */
@supports (padding: env(safe-area-inset-bottom)) {
    #cartSidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}