/**
 * Custom Styles - L'Osteria della Nonna
 * Complemento a Tailwind CSS
 * Optimizado para conversión y experiencia de usuario
 */

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
    --italian-green: #009246;
    --italian-red: #CE2B37;
    --warm-beige: #F5E6D3;
    --dark-charcoal: #2C2C2C;
    --cream-white: #FFFEF7;
}

/* ============================================
   PREVENIR SCROLL HORIZONTAL EN MÓVIL - PROFESIONAL
   ============================================ */
html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Solo prevenir overflow horizontal, NO vertical */
.container,
section,
header,
footer {
    overflow-x: clip;
}

/* ============================================
   SMOOTH SCROLLING
   ============================================ */
html {
    scroll-behavior: smooth;
}

/* ============================================
   SCROLL INDICATOR - RESPONSIVE
   ============================================ */
/* Mobile: 46% left, 1rem bottom */
.scroll-indicator {
    left: 46%;
    bottom: 1rem;
    transform: translateX(-50%);
}

/* Desktop: 50% left, 2.5rem bottom */
@media (min-width: 768px) {
    .scroll-indicator {
        left: 50%;
        bottom: 2.5rem;
    }
}

/* ============================================
   ANIMACIONES PERSONALIZADAS
   ============================================ */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out;
}

/* Pulse Animation para CTAs */
@keyframes pulse-scale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse-animation {
    animation: pulse-scale 2s infinite;
}

/* Glow effect para elementos importantes */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 146, 70, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 146, 70, 0.6);
    }
}

.glow-green {
    animation: glow 2s infinite;
}

/* ============================================
   SMOOTH SCROLL BEHAVIOR
   ============================================ */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* ============================================
   AOS (Animate On Scroll) SETUP
   ============================================ */
[data-aos] {
    opacity: 0;
    transition-property: opacity, transform;
    transition-duration: 0.6s;
}

[data-aos].aos-animate {
    opacity: 1;
}

[data-aos="fade-up"] {
    transform: translateY(30px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-down"] {
    transform: translateY(-30px);
}

[data-aos="fade-down"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-left"] {
    transform: translateX(30px);
}

[data-aos="fade-left"].aos-animate {
    transform: translateX(0);
}

[data-aos="fade-right"] {
    transform: translateX(-30px);
}

[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

[data-aos="zoom-in"] {
    transform: scale(0.95);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

/* ============================================
   HEADER STICKY BEHAVIOR
   ============================================ */
#header {
    transition: all 0.3s ease;
}

#header.scrolled {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Evitar que el logo se corte en scroll */
#header.scrolled img {
    height: 2.75rem; /* 44px - más grande que antes */
}

@media (min-width: 768px) {
    #header.scrolled img {
        height: 3rem; /* 48px en desktop */
    }
}

/* ============================================
   BOTÓN WHATSAPP FLOTANTE
   ============================================ */
#whatsapp-float {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#whatsapp-float.show {
    opacity: 1 !important;
}

#whatsapp-float:hover {
    transform: scale(1.1) rotate(5deg);
}

/* ============================================
   EXIT POPUP
   ============================================ */
#exit-popup {
    transition: opacity 0.3s ease;
}

#exit-popup.show {
    display: flex !important;
    animation: fadeIn 0.3s ease;
}

#exit-popup-content {
    animation: slideUpBounce 0.5s ease;
}

@keyframes slideUpBounce {
    0% {
        transform: translateY(100px) scale(0.8);
        opacity: 0;
    }
    60% {
        transform: translateY(-10px) scale(1.02);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ============================================
   GALERÍA HOVER EFFECTS
   ============================================ */
.gallery-item {
    position: relative;
    overflow: hidden;
    display: block;
}

.gallery-item img {
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* ============================================
   LIGHTBOX2 CUSTOM STYLES - ARREGLADO
   ============================================ */

/* Overlay más suave */
.lb-outerContainer {
    background: transparent;
    border-radius: 8px;
}

/* Botones de navegación ARREGLADOS - Solo en los bordes */
.lb-nav {
    pointer-events: none;
}

.lb-nav a.lb-prev,
.lb-nav a.lb-next {
    pointer-events: auto;
    width: 60px !important;
    height: 120px !important;
    background: rgba(0, 146, 70, 0.8) !important;
    opacity: 1 !important;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    top: 50% !important;
    transform: translateY(-50%) !important;
    position: absolute;
}

.lb-nav a.lb-prev {
    left: 0 !important;
    border-radius: 0 8px 8px 0;
}

.lb-nav a.lb-next {
    right: 0 !important;
    border-radius: 8px 0 0 8px;
}

.lb-nav a.lb-prev:hover,
.lb-nav a.lb-next:hover {
    background: rgba(0, 146, 70, 1) !important;
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.05) !important;
}

/* Iconos de flechas más visibles */
.lb-nav a.lb-prev::before {
    content: '‹';
    font-size: 60px;
    color: white;
    font-weight: 100;
    line-height: 1;
}

.lb-nav a.lb-next::before {
    content: '›';
    font-size: 60px;
    color: white;
    font-weight: 100;
    line-height: 1;
}

/* Botón cerrar ARREGLADO con X visible */
.lb-close {
    background: rgba(206, 43, 55, 0.9) !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    opacity: 1 !important;
    transition: all 0.3s ease !important;
    top: 15px !important;
    right: 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.lb-close::before {
    content: '✕';
    font-size: 28px;
    color: white;
    font-weight: bold;
    line-height: 1;
    position: absolute;
}

.lb-close:hover {
    background: rgba(206, 43, 55, 1) !important;
    transform: scale(1.1) !important;
}

/* Ocultar el icono original del botón cerrar */
.lb-close .lb-icon {
    display: none;
}

/* Caption con estilo italiano */
.lb-caption {
    font-family: 'Lato', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: white;
    text-align: center;
    padding: 10px 0;
}

.lb-number {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    color: #009246;
    font-weight: bold;
    padding: 5px 0;
}

/* Container principal */
.lb-container {
    padding: 10px;
}

/* Imagen con sombra suave */
.lb-image {
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Loading más elegante */
.lb-loader {
    border-color: #009246;
    border-top-color: #CE2B37;
}

/* Overlay del fondo */
.lightbox {
    background-color: rgba(0, 0, 0, 0.9) !important;
}

/* Data container */
.lb-dataContainer {
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.8));
    padding: 20px 10px 10px;
    border-radius: 0 0 8px 8px;
}

/* Details */
.lb-details {
    width: 100%;
    text-align: center;
}

/* Asegurar que la imagen sea el foco */
.lb-data {
    padding: 0 10px;
}

/* Centrar todo correctamente */
.lb-outerContainer {
    margin: 0 auto;
    margin-top: 40px !important;
}

/* Prevenir que los botones cubran la imagen */
.lb-container {
    position: relative;
}

.lb-image {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    margin: 0 auto;
}

/* ============================================
   MENÚ PIZARRA EFFECT
   ============================================ */
.menu-board {
    background: linear-gradient(135deg, #2C2C2C 0%, #1a1a1a 100%);
    box-shadow: 
        inset 0 0 100px rgba(0,0,0,0.3),
        0 10px 40px rgba(0,0,0,0.5);
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--cream-white);
}

::-webkit-scrollbar-thumb {
    background: var(--italian-green);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--italian-red);
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--italian-green);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESPONSIVE IMAGE OPTIMIZATION
   ============================================ */
img {
    max-width: 100%;
    height: auto;
}

img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ============================================
   TYPOGRAPHY ENHANCEMENTS
   ============================================ */
.font-display {
    font-family: 'Playfair Display', serif;
    letter-spacing: -0.02em;
}

.font-body {
    font-family: 'Lato', sans-serif;
}

/* Text selection color */
::selection {
    background-color: var(--italian-green);
    color: white;
}

::-moz-selection {
    background-color: var(--italian-green);
    color: white;
}

/* ============================================
   MOBILE MENU ANIMATION - CORREGIDO
   ============================================ */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    opacity: 0;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease;
}

#mobile-menu.show {
    max-height: 500px !important;
    opacity: 1 !important;
    display: block !important;
}

/* ============================================
   CTA BUTTON ENHANCEMENTS
   ============================================ */
.whatsapp-btn {
    position: relative;
    overflow: hidden;
}

.whatsapp-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.whatsapp-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--italian-green);
    outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    #header,
    #whatsapp-float,
    #exit-popup,
    footer {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */
@media (max-width: 768px) {
    /* Reduce font sizes on mobile */
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    /* Stack gallery items on mobile */
    .gallery-item {
        margin-bottom: 1rem;
    }
    
    /* Adjust WhatsApp float button position */
    #whatsapp-float {
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */
/* Use hardware acceleration for animations */
.animate-fade-in,
.pulse-animation,
[data-aos],
.gallery-item img,
#whatsapp-float {
    will-change: transform, opacity;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Opcional: ajustes para dark mode si se desea */
}
