/**
 * Yaguar Ofertas - Estilos Frontend V3
 * Visor flip ligero sin dependencias pesadas
 * @version 5.7.3
 */

/* =============================================
   VARIABLES
   ============================================= */
:root {
    --yaguar-primary: #8B1E3F;
    --yaguar-secondary: #1d3557;
    --yaguar-light: #f1faee;
    --yaguar-dark: #2C2C2C;
    --yaguar-text: #2C2C2C;
    --yaguar-gray: #6c757d;
    --yaguar-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --yaguar-radius: 12px;
    --yaguar-transition: 0.3s ease;
}

/* =============================================
   CONTENEDOR PRINCIPAL
   ============================================= */
.yaguar-ofertas-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.yaguar-ofertas-header {
    text-align: center;
    margin-bottom: 15px;
}

.yaguar-titulo-principal {
    font-family: 'Montserrat', sans-serif;
    font-size: 25px;
    font-weight: 600;
    color: #D81D14;
    margin: 0 0 10px 0;
}

/* =============================================
   GRID DE ESPECIALES (hasta 4 ofertas en línea)
   ============================================= */
.yaguar-ofertas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    justify-items: center;
}

/* Cuando hay exactamente 4 especiales, forzar 4 columnas */
.yaguar-ofertas-grid.grid-4 {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* =============================================
   CARRUSEL (4+ ofertas)
   ============================================= */
.yaguar-ofertas-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.yaguar-carousel-track {
    display: flex;
    gap: 25px;
    transition: transform 0.4s ease-in-out;
    padding: 10px 0;
}

.yaguar-carousel-track .yaguar-especial {
    flex: 0 0 280px;
    max-width: 280px;
}

/* Dots de navegación del carrusel */
.yaguar-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding: 10px 0;
}

.yaguar-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.yaguar-carousel-dot.active {
    background: #D81D14;
    transform: scale(1.2);
}

.yaguar-carousel-dot:hover {
    background: #999;
}

/* Especial individual - Estilo Moreno (limpio, sin bordes gruesos) */
.yaguar-especial {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    max-width: 280px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

/* En grid de 4, permitir cards más pequeñas */
.yaguar-ofertas-grid.grid-4 .yaguar-especial {
    max-width: 100%;
}

.yaguar-especial:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Header del especial - Estilo Elementor */
.yaguar-especial-header {
    background: #FFFFFF;
    padding: 10px 12px;
    text-align: center;
}

.yaguar-especial-tipo {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 20px;
    font-weight: 500;
    color: var(--yaguar-text);
    line-height: 1.3;
    margin-bottom: 5px;
}

.yaguar-especial-nombre {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--yaguar-text);
    line-height: 1.3;
}

/* Imagen principal con overlay - sin recorte */
.yaguar-especial-imagen {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.yaguar-especial-imagen img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform var(--yaguar-transition);
}

.yaguar-especial-imagen:hover img {
    transform: scale(1.05);
}

.yaguar-flip-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.yaguar-especial-imagen:hover .yaguar-flip-overlay {
    opacity: 1;
}

.yaguar-flip-text {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 25px;
}

/* Link PDF (modo solo PDF) */
.yaguar-pdf-link {
    display: block;
    text-decoration: none;
}

.yaguar-pdf-placeholder {
    width: 100%;
    height: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    color: #666;
}

.yaguar-pdf-placeholder svg {
    opacity: 0.5;
}

/* Imagen sin link (cuando está desactivada la apertura) */
.yaguar-especial-imagen.yaguar-no-link {
    cursor: default;
}

.yaguar-especial-imagen.yaguar-no-link:hover img {
    transform: none;
}

/* Footer del especial - Banda roja */
.yaguar-especial-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #D81D14;
    border-radius: 0 0 8px 8px;
}

.yaguar-footer-label {
    font-family: 'Heebo', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #FFFFFF;
}

.yaguar-footer-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.yaguar-footer-pdf:hover {
    opacity: 0.8;
}

.yaguar-footer-pdf svg {
    width: 20px;
    height: 20px;
}

/* =============================================
   MODAL DEL VISOR FLIP
   ============================================= */
.yaguar-flip-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yaguar-flip-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}

.yaguar-flip-modal-content {
    position: relative;
    width: auto;
    max-width: 95vw;
    height: 98vh;
    max-height: 98vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header del modal - Compacto en desktop */
.yaguar-flip-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 15px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: var(--yaguar-radius) var(--yaguar-radius) 0 0;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.yaguar-flip-page-info {
    color: #fff;
    font-size: 0.95rem;
}

.yaguar-flip-modal-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.yaguar-flip-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #D81D14;
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Heebo', sans-serif;
    transition: background 0.3s ease;
}

.yaguar-flip-btn:hover {
    background: #4C4C4C;
    color: #fff;
}

.yaguar-flip-download-btn {
    display: flex !important;
}

.yaguar-flip-download-btn.hidden {
    display: none !important;
}

.yaguar-flip-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    opacity: 0.8;
    transition: opacity var(--yaguar-transition);
}

.yaguar-flip-close:hover {
    opacity: 1;
}

/* Contenedor del flipbook */
.yaguar-flip-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    min-height: 0;
    overflow: hidden;
}

/* Flipbook - Altura manda, deja espacio para header y dots */
.yaguar-flipbook {
    width: auto;
    max-width: 95vw;
    height: calc(98vh - 90px); /* Resta header (~35px) + dots (~55px) */
    min-height: 400px;
    background: #2C2C2C;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    perspective: 2000px;
    display: flex;
    overflow: hidden;
}

.yaguar-flip-pages {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
}

/* Contenedor del libro abierto */
.yaguar-flip-book {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
    transform-style: preserve-3d;
    transition: opacity 0.2s ease;
}

/* Página izquierda */
.yaguar-flip-page-left {
    width: 50%;
    height: 100%;
    background: #fff;
    position: relative;
    box-shadow: inset -5px 0 15px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yaguar-flip-page-left img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    background: #fff;
    transition: transform 0.3s ease;
}

/* Página derecha */
.yaguar-flip-page-right {
    width: 50%;
    height: 100%;
    background: #fff;
    position: relative;
    box-shadow: inset 5px 0 15px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yaguar-flip-page-right img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    background: #fff;
    transition: transform 0.3s ease;
}

/* Click en página abre lightbox (desktop) - cursor indica acción */

/* Modo 1 sola página (desktop y mobile) */
.yaguar-flipbook.single-page-mode {
    max-width: 600px; /* Más angosto para 1 página */
}

.yaguar-flipbook.single-page-mode .yaguar-flip-page-left {
    width: 100%;
}

.yaguar-flipbook.single-page-mode .yaguar-flip-page-right,
.yaguar-flipbook.single-page-mode .yaguar-flip-center-shadow {
    display: none;
}

/* Página que voltea */
.yaguar-flip-page {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: #fff;
    display: none;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
    backface-visibility: hidden;
}

.yaguar-flip-page.active {
    display: block;
    z-index: 2;
}

.yaguar-flip-page.page-left {
    left: 0;
    transform-origin: right center;
}

.yaguar-flip-page.page-right {
    left: 50%;
    transform-origin: left center;
}

/* Animación de volteo */
.yaguar-flip-page.flipping-next {
    animation: flipPageNext 0.6s ease-in-out forwards;
}

.yaguar-flip-page.flipping-prev {
    animation: flipPagePrev 0.6s ease-in-out forwards;
}

@keyframes flipPageNext {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(-180deg); }
}

@keyframes flipPagePrev {
    0% { transform: rotateY(-180deg); }
    100% { transform: rotateY(0deg); }
}

.yaguar-flip-page img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    background: #fff;
}

/* Sombra central del libro */
.yaguar-flip-center-shadow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 100%;
    background: linear-gradient(to right,
        rgba(0,0,0,0.15) 0%,
        rgba(0,0,0,0.05) 30%,
        rgba(0,0,0,0) 50%,
        rgba(0,0,0,0.05) 70%,
        rgba(0,0,0,0.15) 100%);
    pointer-events: none;
    z-index: 10;
}

/* Navegacion */
.yaguar-flip-nav {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 2rem;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: background var(--yaguar-transition);
    flex-shrink: 0;
}

.yaguar-flip-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.yaguar-flip-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Indicadores - Separados del flipbook */
.yaguar-flip-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0 0 var(--yaguar-radius) var(--yaguar-radius);
}

.yaguar-flip-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: background var(--yaguar-transition);
}

.yaguar-flip-indicator.active {
    background: #D81D14;
}

.yaguar-flip-indicator:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* =============================================
   CONTADOR - Estilos exactos de Mendoza/Elementor
   ============================================= */
.yaguar-contador-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #D81D14;
    padding: 5px 10px;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

.yaguar-contador-titulo {
    font-size: 14px;
    color: #FFFFFF;
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
    padding-right: 5px;
}

.yaguar-contador {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.yaguar-contador-item {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0;
    background: none;
    color: #FFFFFF;
    padding: 1px;
}

.yaguar-contador-numero {
    font-size: 14px;
    font-weight: 400;
    color: #FFFFFF;
    padding-right: 5px;
    font-family: 'Montserrat', sans-serif;
}

.yaguar-contador-label {
    font-size: 10px;
    font-weight: 400;
    color: #FFFFFF;
    font-family: 'Montserrat', sans-serif;
    padding-right: 8px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    /* Container sin márgenes laterales en mobile */
    .yaguar-ofertas-container {
        padding: 10px 0;
    }

    .yaguar-titulo-principal {
        font-size: 20px;
        padding: 0 15px;
    }

    .yaguar-especial-tipo,
    .yaguar-especial-nombre {
        font-size: 14px;
    }

    .yaguar-ofertas-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0;
    }

    /* Grid de 4: 1 columna en mobile (igual que el resto) */
    .yaguar-ofertas-grid.grid-4 {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0;
    }

    /* Especial ancho completo */
    .yaguar-especial {
        max-width: 100%;
        width: 100%;
        border-radius: 0;
    }

    .yaguar-especial-imagen {
        position: relative;
    }

    .yaguar-especial-imagen img {
        border-radius: 0;
    }

    /* Header y footer en mobile */
    .yaguar-especial-header {
        padding: 8px 10px;
    }

    .yaguar-especial-footer {
        padding: 10px 12px;
    }

    /* Botón PDF en mobile - más visible */
    .yaguar-footer-pdf {
        padding: 6px;
    }

    .yaguar-footer-pdf svg {
        width: 20px;
        height: 20px;
    }

    .yaguar-footer-label {
        font-size: 13px;
    }

    /* Modal mobile */
    .yaguar-flip-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    /* Header compacto en mobile - mínimo espacio */
    .yaguar-flip-modal-header {
        border-radius: 0;
        padding: 5px 8px;
        min-height: 0;
        background: rgba(0, 0, 0, 0.8);
    }

    .yaguar-flip-modal-header .yaguar-flip-page-info {
        font-size: 12px;
    }

    .yaguar-flip-modal-header .yaguar-flip-close {
        font-size: 1.2rem;
        padding: 2px 6px;
    }

    .yaguar-flip-modal-header .yaguar-flip-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* Flechas sobre la imagen en mobile */
    .yaguar-flip-wrapper {
        position: relative;
        padding: 0;
    }

    .yaguar-flip-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        background: rgba(0,0,0,0.4);
        color: #fff;
        border: none;
        padding: 15px 10px;
        font-size: 1.2rem;
    }

    .yaguar-flip-nav:hover {
        background: rgba(0,0,0,0.6);
    }

    .yaguar-flip-prev {
        left: 0;
        border-radius: 0 4px 4px 0;
    }

    .yaguar-flip-next {
        right: 0;
        border-radius: 4px 0 0 4px;
    }

    .yaguar-flipbook {
        width: 100vw;
        max-width: none;
        height: 85vh;
        aspect-ratio: auto;
    }

    /* Mobile: 1 página visible en lugar de 2 */
    .yaguar-flipbook.mobile-single-page .yaguar-flip-page-left {
        width: 100%;
    }

    .yaguar-flipbook.mobile-single-page .yaguar-flip-page-right {
        display: none;
    }

    .yaguar-flipbook.mobile-single-page .yaguar-flip-center-shadow {
        display: none;
    }

    /* Botón descargar compacto */
    .yaguar-flip-download-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .yaguar-flip-download-btn svg {
        width: 14px;
        height: 14px;
    }

    .yaguar-flip-download-btn span {
        display: none;
    }

    .yaguar-contador-container {
        flex-wrap: wrap;
        gap: 5px;
        padding: 8px 10px;
    }

    .yaguar-contador-titulo {
        font-size: 12px;
        width: 100%;
        text-align: center;
    }

    .yaguar-contador-item {
        margin: 0 5px;
    }

    .yaguar-contador-numero {
        font-size: 18px;
    }

    .yaguar-contador-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    /* Header en una sola línea, compacto */
    .yaguar-flip-modal-header {
        flex-direction: row;
        gap: 5px;
        padding: 4px 6px;
    }

    .yaguar-flip-page-info {
        font-size: 11px;
    }

    .yaguar-flip-modal-actions {
        gap: 8px;
    }

    .yaguar-flip-modal-header .yaguar-flip-close {
        font-size: 1rem;
        padding: 2px 5px;
    }

    /* Ocultar texto del botón descargar, solo icono */
    .yaguar-flip-download-btn span {
        display: none;
    }
}

/* =============================================
   ANIMACIONES
   ============================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.yaguar-flip-modal {
    animation: fadeIn 0.3s ease;
}

/* Loading state */
.yaguar-flipbook.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.yaguar-flipbook.loading::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--yaguar-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================
   LIGHTBOX PÁGINA COMPLETA (Desktop)
   ============================================= */
.yaguar-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.yaguar-lightbox-container {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yaguar-lightbox-content {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.yaguar-lightbox-image {
    max-width: 85vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: zoom-in;
    transition: all 0.3s ease;
}

/* Zoom horizontal - ocupa todo el ancho */
.yaguar-lightbox-image.zoomed-horizontal {
    max-width: none;
    max-height: none;
    width: 95vw;
    height: auto;
    cursor: zoom-out;
}

/* Cuando está en zoom horizontal, el container permite scroll */
.yaguar-lightbox-container:has(.zoomed-horizontal) {
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: flex-start;
}

.yaguar-lightbox-content:has(.zoomed-horizontal) {
    align-items: flex-start;
}

/* Botón cerrar */
.yaguar-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 36px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 10;
}

.yaguar-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Flechas navegación */
.yaguar-lightbox-prev,
.yaguar-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 50px;
    height: 80px;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 10;
}

.yaguar-lightbox-prev {
    left: 15px;
    border-radius: 0 8px 8px 0;
}

.yaguar-lightbox-next {
    right: 15px;
    border-radius: 8px 0 0 8px;
}

.yaguar-lightbox-prev:hover,
.yaguar-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.yaguar-lightbox-prev:disabled,
.yaguar-lightbox-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Contador de página */
.yaguar-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
}

/* Cursor en páginas del spread (indica que son clickeables) */
@media (min-width: 769px) {
    .yaguar-flip-page-left,
    .yaguar-flip-page-right {
        cursor: pointer;
    }

    .yaguar-flip-page-left:hover,
    .yaguar-flip-page-right:hover {
        box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.15);
    }
}

/* =============================================
   PRINT
   ============================================= */
@media print {
    .yaguar-flip-modal,
    .yaguar-lightbox-overlay {
        display: none !important;
    }
}
