/* =========================================================================
   RECORRIDO GUIADO DEL MENÚ (+58 VENEZUELA)
   -------------------------------------------------------------------------
   Solo se carga desde index.html (la carta del comensal): admin.html,
   cocina.html y bar.html no lo usan. Aquí vive el modal de primera visita,
   el botón discreto de ayuda y el tema oscuro con amarillo del popover de
   Driver.js (que llega por CDN).
   ========================================================================= */

/* ─── Modal de bienvenida (primera visita) ──────────────────────────────── */
.tour-intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background:
        radial-gradient(circle at 50% 16%, rgba(255, 242, 17, 0.14), transparent 58%),
        rgba(5, 5, 7, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: tour-intro-fondo 0.25s ease-out;
}

.tour-intro-card {
    width: 100%;
    max-width: 380px;
    padding: 28px 24px 22px;
    border-radius: 26px;
    border: 1px solid rgba(255, 242, 17, 0.32);
    background: linear-gradient(160deg, #17171a 0%, #0d0d10 62%, #121214 100%);
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 10px 40px rgba(255, 242, 17, 0.08);
    text-align: center;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    animation: tour-intro-entrada 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.tour-intro-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 242, 17, 0.14);
    border: 1px solid rgba(255, 242, 17, 0.35);
    color: #fff211;
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.tour-intro-titulo {
    margin: 16px 0 8px;
    color: #fff;
    font-size: 1.32rem;
    font-weight: 800;
    line-height: 1.25;
}

.tour-intro-texto {
    margin: 0 0 22px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.86rem;
    line-height: 1.55;
}

.tour-intro-btn {
    width: 100%;
    padding: 13px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.tour-intro-btn--si {
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff211, #ffcc00);
    color: #141400;
    box-shadow: 0 10px 26px rgba(255, 204, 0, 0.28);
}

.tour-intro-btn--si:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(255, 204, 0, 0.4);
}

.tour-intro-btn--no {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.8);
}

.tour-intro-btn--no:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.tour-intro-btn:active {
    transform: scale(0.98);
}

@keyframes tour-intro-fondo {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tour-intro-entrada {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* El recorrido NO secuestra la pantalla: el cliente toca los botones reales
   (categoría, Pedir, Ver Pedido, Siguiente) y el aviso pasa solo al siguiente
   paso. El popover y su botón de cerrar siguen siendo clicables. */
body.driver-active #driver-page-overlay {
    pointer-events: none !important;
}

/* Con el modal del nombre (o el de sabores) abierto, el aviso se aparta para
   que el cliente pueda escribir y tocar "Empezar". El modal queda por encima
   del popover; si Driver usa una capa superior, igual alcanza con ocultarlo. */
body.tour-pausado .driver-popover,
body.tour-pausado #driver-page-overlay {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.driver-active #mesa-modal,
body.driver-active #product-modal {
    z-index: 1000000001 !important;
}

/* ─── Botón de ayuda ("? AYUDA") ────────────────────────────────────────── */
/* Píldora con la palabra AYUDA siempre visible y en blanco, con un neón un
   poco más intenso que el de los nombres de las hamburguesas
   (.dish-card[data-category="hamburguesas"] h3): mismo blanco, más capas y
   más brillo, con un halo amarillo de la marca por fuera. */
.tour-ayuda-btn {
    position: fixed;
    right: 16px;
    bottom: calc(150px + env(safe-area-inset-bottom, 0px));
    z-index: 998;
    height: 36px;
    display: none;
    /* Nace escondido fuera de la pantalla, por la derecha. Al scrollear se
       asoma; a los pocos segundos sin scroll vuelve a salir. */
    visibility: hidden;
    opacity: 0;
    transform: translateX(calc(100% + 24px));
    pointer-events: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 14px 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    /* Fondo casi invisible: solo un velo mínimo + desenfoque, para que la
       carta de atrás se siga viendo a través del botón. */
    background: rgba(10, 10, 12, 0.1);
    backdrop-filter: blur(6px) saturate(140%);
    -webkit-backdrop-filter: blur(6px) saturate(140%);
    color: #ffffff;
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 1.1px;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.45),
        0 0 14px rgba(255, 255, 255, 0.18),
        0 0 28px rgba(255, 242, 17, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    text-shadow:
        0 0 4px rgba(255, 255, 255, 0.95),
        0 0 10px rgba(255, 255, 255, 0.7),
        0 0 20px rgba(255, 255, 255, 0.35),
        0 0 32px rgba(255, 242, 17, 0.4);
    transition:
        transform 0.28s cubic-bezier(0.34, 1.2, 0.5, 1),
        opacity 0.2s ease,
        visibility 0s linear 0.28s,
        background 0.2s ease,
        box-shadow 0.2s ease,
        text-shadow 0.2s ease;
    /* Levita despacio para que no se lea como algo pegado al borde. Se anima
       `translate` (no `transform`) para que el scale del toque siga vivo. */
    animation: tour-ayuda-flota 3.6s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
}

@keyframes tour-ayuda-flota {
    0%, 100% {
        translate: 0 0;
    }
    50% {
        translate: 0 -6px;
    }
}

.tour-ayuda-btn-icono {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0;
    color: #fff211;
    text-shadow:
        0 0 6px rgba(255, 242, 17, 0.85),
        0 0 16px rgba(255, 242, 17, 0.5);
}

.tour-ayuda-btn-texto {
    color: #ffffff;
    white-space: nowrap;
}

.tour-ayuda-btn--visible {
    display: inline-flex;
}

/* El asomo del scroll: entra desde la derecha y se queda unos segundos. */
.tour-ayuda-btn--asomando {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    transition:
        transform 0.28s cubic-bezier(0.34, 1.2, 0.5, 1),
        opacity 0.2s ease,
        visibility 0s,
        background 0.2s ease,
        box-shadow 0.2s ease,
        text-shadow 0.2s ease;
}

.tour-ayuda-btn:hover {
    background: rgba(30, 30, 34, 0.24);
    box-shadow:
        0 10px 26px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3),
        0 0 38px rgba(255, 242, 17, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.24);
    text-shadow:
        0 0 5px rgba(255, 255, 255, 1),
        0 0 14px rgba(255, 255, 255, 0.85),
        0 0 26px rgba(255, 255, 255, 0.45),
        0 0 40px rgba(255, 242, 17, 0.5);
}

.tour-ayuda-btn:active {
    transform: scale(0.94);
}

/* Quien pidió menos movimiento en su teléfono ve el botón quieto. */
@media (prefers-reduced-motion: reduce) {
    .tour-ayuda-btn {
        animation: none;
        transition: none;
    }
}

/* En pantallas muy bajas sube junto con "Tus Pedidos" para no montarse
   sobre la barra del pedido. */
@media (max-height: 620px) {
    .tour-ayuda-btn {
        bottom: calc(138px + env(safe-area-inset-bottom, 0px));
    }
}

/* En tema claro la píldora sigue oscura: así la palabra AYUDA se lee en
   blanco también ahí, como en el resto de las pantallas. */
body.light-theme .tour-ayuda-btn {
    background: rgba(10, 10, 12, 0.14);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.55);
}

body.light-theme .tour-ayuda-btn-texto {
    color: #ffffff;
}

/* En la pasarela el botón va arriba a la derecha: abajo está el botón de
   confirmar, que ocupa todo el ancho. */
body.tour-pagina-checkout .tour-ayuda-btn {
    top: calc(74px + env(safe-area-inset-top, 0px));
    right: 14px;
    bottom: auto;
}

/* ─── Vista previa de la barra del pedido durante el recorrido ──────────── */
/* La barra real nace oculta mientras no haya productos; en el paso final del
   tour la asomamos solo para mostrarla, sin tocar el estado del pedido. */
.status-bar-pildora.hidden-bar.tour-barra-visible {
    transform: translateY(0);
    opacity: 1;
}

/* ─── Tema del popover de Driver.js ─────────────────────────────────────── */
.driver-popover.plus58-tour-popover {
    max-width: 300px;
    background: #141417;
    color: #f2f2f4;
    border: 1px solid rgba(255, 242, 17, 0.38);
    border-radius: 18px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

.driver-popover.plus58-tour-popover .driver-popover-title {
    color: #fff211;
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.3;
}

.driver-popover.plus58-tour-popover .driver-popover-description {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.82rem;
    line-height: 1.5;
}

.driver-popover.plus58-tour-popover .driver-popover-description b {
    color: #fff;
}

.driver-popover.plus58-tour-popover .driver-popover-progress-text {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
}

/* El pie del tour: el texto del botón no se parte en dos líneas ni se sale de
   la píldora. Si no cabe junto al progreso, el pie baja a una segunda fila. */
.driver-popover.plus58-tour-popover .driver-popover-footer {
    flex-wrap: wrap;
    gap: 8px;
}

.driver-popover.plus58-tour-popover .driver-popover-navigation-btns {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
}

.driver-popover.plus58-tour-popover .driver-popover-footer button {
    flex: 0 0 auto;
    padding: 7px 14px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    text-shadow: none;
}

@media (max-width: 380px) {
    .driver-popover.plus58-tour-popover .driver-popover-footer button {
        padding: 6px 10px;
        font-size: 0.72rem;
    }
}

.driver-popover.plus58-tour-popover .driver-popover-next-btn {
    background: #fff211;
    color: #141400;
    border: 1px solid #fff211;
}

.driver-popover.plus58-tour-popover .driver-popover-prev-btn {
    background: transparent;
    color: #fff211;
    border: 1px solid rgba(255, 242, 17, 0.5);
}

.driver-popover.plus58-tour-popover .driver-popover-close-btn {
    color: rgba(255, 255, 255, 0.6);
}

.driver-popover.plus58-tour-popover .driver-popover-close-btn:hover {
    color: #fff;
}

.driver-popover.plus58-tour-popover .driver-popover-arrow-side-left.driver-popover-arrow {
    border-left-color: #141417;
}

.driver-popover.plus58-tour-popover .driver-popover-arrow-side-right.driver-popover-arrow {
    border-right-color: #141417;
}

.driver-popover.plus58-tour-popover .driver-popover-arrow-side-top.driver-popover-arrow {
    border-top-color: #141417;
}

.driver-popover.plus58-tour-popover .driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-bottom-color: #141417;
}
