/**
 * ============================================================================
 * CROAKET STUDIO - TOUR INTERACTIVO DE BIENVENIDA (ONBOARDING WALKTHROUGH)
 * ============================================================================
 * Estilos puros en Vanilla CSS para el Spotlight, Overlay y Tarjeta Flotante (Popover).
 * Diseño limpio, moderno, alineado a la paleta de Croaket Studio (#D3AFF5 / #7C3AED).
 */

/* --- 1. OVERLAY DE OSCURECIMIENTO Y SPOTLIGHT --- */
.croaket-tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    pointer-events: auto;
    overflow: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.croaket-tour-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 12, 25, 0.65);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.croaket-tour-spotlight {
    position: absolute;
    border-radius: 14px;
    /* El box-shadow gigante recortado crea el túnel de luz transparente sobre el elemento objetivo */
    box-shadow: 0 0 0 9999px rgba(15, 12, 25, 0.65),
                0 0 0 2.5px #D3AFF5,
                0 0 24px rgba(211, 175, 245, 0.5),
                inset 0 0 12px rgba(211, 175, 245, 0.2);
    pointer-events: none;
    transition: top 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease;
    animation: croaketTourPulse 3s infinite ease-in-out;
}

@keyframes croaketTourPulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(15, 12, 25, 0.65),
                    0 0 0 2.5px #D3AFF5,
                    0 0 24px rgba(211, 175, 245, 0.45);
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(15, 12, 25, 0.65),
                    0 0 0 3px #AB77DC,
                    0 0 32px rgba(171, 119, 220, 0.7);
    }
}

/* --- 2. TARJETA FLOTANTE (POPOVER) --- */
.croaket-tour-popover {
    position: fixed;
    z-index: 99999;
    width: 390px;
    max-width: calc(100vw - 32px);
    background: #FFFFFF;
    border: 1px solid rgba(211, 175, 245, 0.55);
    border-radius: 20px;
    box-shadow: 0 24px 60px -12px rgba(91, 33, 182, 0.26),
                0 0 0 1px rgba(211, 175, 245, 0.3);
    padding: 22px 24px;
    color: #18181B;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: top 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.25s ease,
                opacity 0.25s ease;
    animation: croaketTourCardEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

@keyframes croaketTourCardEnter {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Si está centrado en el viewport (Paso 1) */
.croaket-tour-popover[data-placement="center"] {
    animation: croaketTourCenterEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes croaketTourCenterEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* --- 3. CABECERA DEL POPOVER --- */
.tour-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tour-badge-group {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(211, 175, 245, 0.22);
    border: 1px solid rgba(211, 175, 245, 0.45);
    padding: 4px 10px;
    border-radius: 9999px;
}

.tour-badge-icon {
    display: flex;
    align-items: center;
    color: #7C3AED;
}

.tour-step-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #6B21A8;
}

.tour-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #71717A;
    transition: all 0.15s ease;
}

.tour-close-btn:hover {
    background: rgba(211, 175, 245, 0.22);
    color: #18181B;
    transform: scale(1.05);
}

/* --- 4. CONTENIDO (TÍTULO Y TEXTO) --- */
.tour-popover-body {
    margin-bottom: 16px;
}

.tour-popover-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 16.5px;
    font-weight: 700;
    line-height: 1.35;
    color: #18181B;
    margin: 0 0 8px 0;
}

.tour-popover-desc {
    font-size: 13.5px;
    line-height: 1.6;
    color: #52525B;
    margin: 0;
}

/* --- 5. INDICADOR DE PROGRESO (DOTS) --- */
.tour-dots-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 14px 0 16px 0;
}

.tour-dot {
    width: 7px;
    height: 7px;
    border-radius: 9999px;
    background: #E4E4E7;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tour-dot.active {
    width: 22px;
    background: #7C3AED;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

/* --- 6. FOOTER Y BOTONES DE ACCIÓN --- */
.tour-popover-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
}

.tour-btn-skip {
    background: transparent;
    border: none;
    color: #71717A;
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    padding: 6px 4px;
    transition: color 0.15s ease;
}

.tour-btn-skip:hover {
    color: #18181B;
}

.tour-nav-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tour-btn {
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    outline: none;
}

.tour-btn:focus-visible {
    box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #7C3AED;
}

.tour-btn-prev {
    background: #F4F1FA;
    color: #581C87;
    border: 1px solid rgba(211, 175, 245, 0.6);
}

.tour-btn-prev:hover {
    background: #EADEF7;
    color: #4C1D95;
    transform: translateY(-1px);
}

.tour-btn-prev:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.tour-btn-next {
    background: linear-gradient(135deg, #A855F7 0%, #7C3AED 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

.tour-btn-next:hover {
    background: linear-gradient(135deg, #B566F8 0%, #6D28D9 100%);
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.45);
    transform: translateY(-1px);
}

.tour-btn-next.btn-tour-finish {
    background: linear-gradient(135deg, #9333EA 0%, #581C87 100%);
    box-shadow: 0 4px 16px rgba(88, 28, 135, 0.4);
    padding: 8px 18px;
}

.tour-btn-next.btn-tour-finish:hover {
    box-shadow: 0 6px 20px rgba(88, 28, 135, 0.5);
}

/* --- 7. ATAJOS DE TECLADO (HINT) --- */
.tour-keyboard-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #F4F4F5;
    font-size: 11px;
    color: #A1A1AA;
}

.tour-keyboard-hint kbd {
    background: #F4F4F5;
    border: 1px solid #E4E4E7;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    color: #71717A;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* --- 8. BOTÓN DE AYUDA EN EL HEADER (#app-header) --- */
.btn-header-help {
    background: rgba(211, 175, 245, 0.2);
    border: 1px solid rgba(211, 175, 245, 0.55);
    color: #6B21A8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 9999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.btn-header-help:hover {
    background: rgba(211, 175, 245, 0.38);
    border-color: #AB77DC;
    color: #581C87;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(107, 33, 168, 0.18);
}

.btn-header-help svg {
    color: #7C3AED;
}

/* Link secundario en el footer */
.footer-tour-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #71717A;
    transition: color 0.15s ease;
}

.footer-tour-link:hover {
    color: #7C3AED;
}

/* --- 9. MODO OSCURO (DARK MODE) --- */
body.theme-dark .croaket-tour-popover,
body.dark .croaket-tour-popover {
    background: #1A1625;
    border-color: rgba(211, 175, 245, 0.32);
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.7),
                0 0 0 1px rgba(211, 175, 245, 0.2);
    color: #F4F4F5;
}

body.theme-dark .tour-popover-title,
body.dark .tour-popover-title {
    color: #FAFAFA;
}

body.theme-dark .tour-popover-desc,
body.dark .tour-popover-desc {
    color: #A1A1AA;
}

body.theme-dark .tour-badge-group,
body.dark .tour-badge-group {
    background: rgba(211, 175, 245, 0.12);
    border-color: rgba(211, 175, 245, 0.28);
}

body.theme-dark .tour-step-badge,
body.dark .tour-step-badge {
    color: #D3AFF5;
}

body.theme-dark .tour-badge-icon,
body.dark .tour-badge-icon {
    color: #D3AFF5;
}

body.theme-dark .tour-close-btn,
body.dark .tour-close-btn {
    color: #A1A1AA;
}

body.theme-dark .tour-close-btn:hover,
body.dark .tour-close-btn:hover {
    background: rgba(211, 175, 245, 0.15);
    color: #FFFFFF;
}

body.theme-dark .tour-dot,
body.dark .tour-dot {
    background: #3F3F46;
}

body.theme-dark .tour-dot.active,
body.dark .tour-dot.active {
    background: #A855F7;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.45);
}

body.theme-dark .tour-btn-skip,
body.dark .tour-btn-skip {
    color: #A1A1AA;
}

body.theme-dark .tour-btn-skip:hover,
body.dark .tour-btn-skip:hover {
    color: #F4F4F5;
}

body.theme-dark .tour-btn-prev,
body.dark .tour-btn-prev {
    background: #272138;
    color: #D3AFF5;
    border-color: rgba(211, 175, 245, 0.3);
}

body.theme-dark .tour-btn-prev:hover,
body.dark .tour-btn-prev:hover {
    background: #352B4D;
    color: #FFFFFF;
}

body.theme-dark .tour-keyboard-hint,
body.dark .tour-keyboard-hint {
    border-color: #272138;
    color: #71717A;
}

body.theme-dark .tour-keyboard-hint kbd,
body.dark .tour-keyboard-hint kbd {
    background: #272138;
    border-color: #3F3F46;
    color: #A1A1AA;
}

body.theme-dark .btn-header-help,
body.dark .btn-header-help {
    background: rgba(211, 175, 245, 0.12);
    border-color: rgba(211, 175, 245, 0.3);
    color: #D3AFF5;
}

body.theme-dark .btn-header-help:hover,
body.dark .btn-header-help:hover {
    background: rgba(211, 175, 245, 0.25);
    border-color: #D3AFF5;
    color: #FFFFFF;
}

body.theme-dark .footer-tour-link,
body.dark .footer-tour-link {
    color: #A1A1AA;
}

body.theme-dark .footer-tour-link:hover,
body.dark .footer-tour-link:hover {
    color: #D3AFF5;
}

/* --- 10. RESPONSIVE (MÓVIL Y TABLET) --- */
@media (max-width: 640px) {
    .croaket-tour-popover {
        width: calc(100vw - 24px);
        padding: 18px 18px;
        border-radius: 16px;
    }
    .tour-popover-title {
        font-size: 15px;
    }
    .tour-popover-desc {
        font-size: 12.5px;
    }
    .btn-header-help span {
        display: none;
    }
    .btn-header-help {
        padding: 5px 8px;
    }
}
