/* Definición de variables y fuentes */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg-dark: #121212;
    --bg-gradient-center: #2a2a35;
    --accent: #6b8cce;
    --text-main: #f0f0f0;
    --glass-bg: rgba(30, 30, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --book-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: 'Inter', sans-serif;
    /* Dark mode sofisticado radial */
    background: radial-gradient(circle at center, var(--bg-gradient-center) 0%, var(--bg-dark) 100%);
    color: var(--text-main);
    overflow: hidden;
    /* Evita scrolls no deseados del body */
    min-height: 100vh;
}

/* -------------------------------------
   PANTALLA DE CARGA (SPINNER)
-------------------------------------- */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 1rem;
}

.loader-container p {
    font-size: 0.9rem;
    color: #aaa;
    letter-spacing: 1px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* -------------------------------------
   CONTENEDOR PRINCIPAL
-------------------------------------- */
.app-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* -------------------------------------
   FLIPBOOK & PÁGINAS (PDF.js + StPageFlip)
-------------------------------------- */
.flipbook-wrapper {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    /* Espacio para respirar top/bottom */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: transform 0.3s ease;
    /* Para el Zoom */
}

/* Transición suave para el centrado de la portada / contraportada */
#flipbook {
    transition: transform 0.5s ease-in-out;
}

/* Efecto 3D en el libro */
.stf__wrapper {
    box-shadow: var(--book-shadow);
    border-radius: 4px;
    /* Ligero borde redondeado simula tapas */
}

.page {
    background-color: #FAFAFA;
    /* Sombra interna sutil para simular curvatura del papel en el lomo */
    box-shadow: inset -1px 0 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    /* Necesario para los hotspots absolutos */
}

.page-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Lomo central (cuando es spread) */
.page.--left {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset -10px 0 20px rgba(0, 0, 0, 0.05);
}

.page.--right {
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 10px 0 20px rgba(0, 0, 0, 0.05);
}

/* -------------------------------------
   HOTSPOTS (ENLACES SUPERPUESTOS)
-------------------------------------- */
.hotspot {
    position: absolute;
    background-color: rgba(66, 135, 245, 0.0);
    z-index: 20;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}

.hotspot:hover {
    background-color: rgba(66, 135, 245, 0.2);
    box-shadow: 0 0 10px rgba(66, 135, 245, 0.4);
}

/* Icono sutil indicando enlace al hacer hover (opcional) */
.hotspot::after {
    content: "🔗";
    opacity: 0;
    font-size: 1.2rem;
    transition: opacity 0.2s;
}

.hotspot:hover::after {
    opacity: 1;
}

/* -------------------------------------
   BOTONES FLOTANTES LATERALES
-------------------------------------- */
.floating-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 50;
    transition: all 0.2s ease;
}

.floating-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.left-btn {
    left: 4%;
}

.right-btn {
    right: 4%;
}

/* -------------------------------------
   BARRA CONTROLES (GLASSMORPHISM)
-------------------------------------- */
.glass-controls {
    position: absolute;
    top: 20px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-soft);
    z-index: 50;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--accent);
}

.page-indicator {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    min-width: 60px;
    justify-content: center;
}

.divider {
    margin: 0 4px;
    opacity: 0.5;
}

.separator {
    width: 1px;
    height: 24px;
    background: var(--glass-border);
}

/* -------------------------------------
   RESPONSIVE DESIGN COMPATIBILITY
-------------------------------------- */
@media (max-width: 768px) {
    .floating-btn {
        display: none;
        /* Ocultar flechas laterales en móviles */
    }

    .glass-controls {
        top: 15px;
        bottom: auto;
        padding: 8px 16px;
        width: 90%;
        /* Ajustar la barra para móviles */
        justify-content: space-between;
    }

    .flipbook-wrapper {
        width: 100%;
        height: 85vh;
    }
}

/* -------------------------------------
   MENÚ DE NAVEGACIÓN RÁPIDA (QUICK NAV)
-------------------------------------- */
.quick-nav {
    position: absolute;
    bottom: 30px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 15px;
    z-index: 60;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
}

.nav-pill {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: transparent;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Tooltip on hover */
.nav-pill::before {
    content: attr(title);
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.nav-pill:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.nav-pill:hover {
    transform: scale(1.2);
    border-color: #fff;
}

/* Colors for lines */
.nav-dolor {
    background-color: #1ba1e2;
}

.nav-dolor:hover {
    box-shadow: 0 0 12px #1ba1e2;
}

.nav-gastro {
    background-color: #a62116;
}

.nav-gastro:hover {
    box-shadow: 0 0 12px #a62116;
}

.nav-cardio {
    background-color: #3eb49a;
}

.nav-cardio:hover {
    box-shadow: 0 0 12px #3eb49a;
}

.nav-ellas {
    background-color: #f176b6;
}

.nav-ellas:hover {
    box-shadow: 0 0 12px #f176b6;
}

.nav-nutri {
    background-color: #e34316;
}

.nav-nutri:hover {
    box-shadow: 0 0 12px #e34316;
}

.nav-adelg {
    background-color: #0d3a73;
}

.nav-adelg:hover {
    box-shadow: 0 0 12px #0d3a73;
}

@media (max-width: 768px) {
    .quick-nav {
        top: 15px;
        padding: 8px 12px;
        gap: 10px;
    }

    .nav-pill {
        width: 18px;
        height: 18px;
    }

    .nav-pill::before {
        display: none;
        /* Hide tooltips on mobile */
    }
}

/* -------------------------------------
   JOTFORM LIVE CHAT BUBBLE
-------------------------------------- */
.live-chat-bubble {
    position: fixed;
    bottom: 97px;
    right: 16px;
    background: #fff;
    color: #333;
    padding: 10px 14px;
    border-radius: 20px 20px 0 20px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 100;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.live-chat-bubble.show {
    opacity: 1;
    display: inline-flex;
    transform: translateY(0);
}

.live-chat-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 0px;
    border-width: 10px 10px 0 0;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

.live-pulse {
    color: #ff3333;
    font-weight: 700;
    display: inline-block;
    animation: livePulsing 1.5s infinite;
}

@keyframes livePulsing {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* -------------------------------------
   MENÚ MACRO MÓVIL (DESPLEGABLE)
-------------------------------------- */
.mobile-macro-nav {
    display: none;
    /* Oculto en desktop */
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
}

@media (max-width: 768px) {

    /* Ocultar la navegación rápida original */
    .quick-nav {
        display: none !important;
    }

    /* Mostrar botón macro */
    .mobile-macro-nav {
        display: flex;
        flex-direction: column-reverse;
        /* Cambiado a dropup */
        position: absolute;
        bottom: 20px;
        top: auto;
        left: 20px;
        z-index: 110;
    }

    .macro-btn {
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--glass-border);
        color: #fff;
        padding: 10px 16px;
        border-radius: 20px;
        font-family: inherit;
        font-size: 0.9rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 8px;
        box-shadow: var(--shadow-soft);
        transition: all 0.3s ease;
    }

    .macro-btn:active {
        transform: scale(0.95);
    }

    .macro-dropdown {
        list-style: none;
        background: rgba(40, 40, 50, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid var(--glass-border);
        border-radius: 15px;
        margin-bottom: 10px;
        /* Margen corregido para dropup */
        margin-top: 0;
        padding: 5px 0;
        display: none;
        /* Oculto por defecto, se maneja con JS (.active) */
        flex-direction: column;
        box-shadow: var(--shadow-soft);
        overflow: hidden;
    }

    .macro-dropdown.active {
        display: flex;
        animation: fadeInDown 0.3s ease;
    }

    .macro-dropdown li {
        padding: 12px 20px;
        font-size: 0.95rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: background 0.2s;
    }

    .macro-dropdown li:last-child {
        border-bottom: none;
    }

    .macro-dropdown li:active {
        background: rgba(255, 255, 255, 0.1);
    }

    @keyframes fadeInDown {
        from {
            opacity: 0;
            transform: translateY(10px);
            /* Para el dropup (de abajo hacia arriba) */
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* REPOSICIONAMIENTO DEL CHATBOT JOTFORM AL BOTTOM-RIGHT */
    iframe[id*="JotformAgent"],
    div[id*="JotformAgent"],
    div[class*="jf-agent-"] {
        bottom: 20px !important;
        right: 20px !important;
        top: auto !important;
        left: auto !important;
    }

    .live-chat-bubble {
        bottom: 97px !important;
        /* Arriba del icono de Jotform */
        top: auto !important;
        right: 12px !important;
        border-radius: 20px 20px 0 20px !important;
        transform: translateY(10px);
    }

    .live-chat-bubble.show {
        transform: translateY(0);
    }

    .live-chat-bubble::after {
        bottom: -10px !important;
        top: auto !important;
        right: 0px !important;
        border-width: 10px 10px 0 0 !important;
        border-color: #fff transparent transparent transparent !important;
    }
}
/* -------------------------------------
   BOTON FLOTANTE AGENDAR VISITA
-------------------------------------- */
.schedule-visit-btn {
    position: fixed;
    right: 16px;
    top: 66%;
    transform: translateY(-50%);
    z-index: 110;
    background: linear-gradient(135deg, #18a7dc, #0d78b2);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.86rem;
    line-height: 1.1;
    padding: 10px 12px;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 108px;
    gap: 2px;
    text-align: center;
}

.schedule-visit-btn:hover {
    transform: translateY(-50%) scale(1.03);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
    filter: brightness(1.06);
}

@media (max-width: 768px) {
    .schedule-visit-btn {
        top: auto;
        right: 12px;
        bottom: 165px;
        transform: none;
        font-size: 0.8rem;
        padding: 9px 11px;
        min-width: 98px;
    }

    .schedule-visit-btn:hover {
        transform: none;
    }
}
