/* ╔══════════════════════════════════════════════════════════════╗
   ║  ANIMUS — Product Tour Stylesheet                            ║
   ║  Premium Glassmorphism · Davivienda Red & Gold · Onboarding  ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ═══════════════════════════════════════════════════════════════
   OVERLAY — Dark scrim with backdrop blur
   ═══════════════════════════════════════════════════════════════ */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 99990;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* ═══════════════════════════════════════════════════════════════
   SPOTLIGHT CANVAS — Cutout effect
   ═══════════════════════════════════════════════════════════════ */
.tour-spotlight {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 99991;
    pointer-events: none;
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   HIGHLIGHT RING — Pulsing border around active element
   ═══════════════════════════════════════════════════════════════ */
.tour-highlight {
    position: fixed;
    z-index: 99992;
    pointer-events: none;
    display: none;
    border-radius: 14px;
    border: 2px solid rgba(237, 28, 36, 0.7);
    box-shadow:
        0 0 0 4px rgba(237, 28, 36, 0.25),
        0 0 0 12px rgba(212, 168, 83, 0.10),
        0 0 30px rgba(237, 28, 36, 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   TOOLTIP — Premium Popover / Dialog
   ═══════════════════════════════════════════════════════════════ */
.tour-tooltip {
    --tour-accent: #ed1c24;
    --tour-accent-rgb: 237, 28, 36;
    --tour-gold: #d4a853;
    --tour-gold-rgb: 212, 168, 83;
    --tour-bg: rgba(13, 13, 15, 0.97);
    --tour-surface: rgba(22, 22, 26, 0.95);
    --tour-border: rgba(255, 255, 255, 0.08);
    --tour-text: #f0f2f5;
    --tour-text-secondary: #8b949e;
    --tour-text-muted: #6b7280;
    --tour-shadow:
        0 0 0 1px rgba(var(--tour-accent-rgb), 0.15),
        0 0 40px rgba(var(--tour-accent-rgb), 0.10),
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 8px 24px rgba(0, 0, 0, 0.4);
    --tour-radius: 16px;
    --tour-font: 'Manrope', 'Inter', system-ui, -apple-system, sans-serif;
    --tour-mono: 'JetBrains Mono', 'Cascadia Code', monospace;

    position: fixed;
    z-index: 99993;
    width: 400px;
    max-width: calc(100vw - 32px);
    background: var(--tour-bg);
    border: 1px solid var(--tour-border);
    border-radius: var(--tour-radius);
    box-shadow: var(--tour-shadow);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    opacity: 0;
    pointer-events: none;
    font-family: var(--tour-font);
    color: var(--tour-text);
    outline: none;
    overflow: hidden;
}

.tour-tooltip:focus-visible {
    border-color: rgba(var(--tour-accent-rgb), 0.5);
    box-shadow:
        0 0 0 1px rgba(var(--tour-accent-rgb), 0.3),
        0 0 40px rgba(var(--tour-accent-rgb), 0.15),
        0 20px 60px rgba(0, 0, 0, 0.6);
}

.tour-tooltip-inner {
    padding: 28px 28px 24px;
}

/* ── Step Badge ── */
.tour-step-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.tour-step-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(237, 28, 36, .1);
    color: var(--tour-accent);
    font-size: 14px;
    line-height: 1;
}

.tour-step-number {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--tour-gold);
    font-family: var(--tour-mono);
}

/* ── Title ── */
.tour-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin: 0 0 10px;
    line-height: 1.25;
    color: #ffffff;
}

/* ── Description ── */
.tour-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--tour-text-secondary);
    margin: 0 0 14px;
}

/* ── Tip ── */
.tour-tip {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--tour-text-muted);
    margin: 0 0 18px;
    padding: 10px 14px;
    background: rgba(var(--tour-gold-rgb), 0.06);
    border: 1px solid rgba(var(--tour-gold-rgb), 0.12);
    border-radius: 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.tour-tip-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1.4;
}

/* ── Progress Bar ── */
.tour-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.tour-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--tour-accent) 0%, var(--tour-gold) 100%);
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.tour-progress-text {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--tour-text-muted);
    font-family: var(--tour-mono);
    margin-bottom: 18px;
}

/* ── Action Buttons ── */
.tour-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.tour-actions-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tour-btn-prev {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--tour-text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--tour-font);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-btn-prev:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--tour-text);
    border-color: rgba(255, 255, 255, 0.15);
}

.tour-btn-prev:focus-visible {
    outline: 2px solid var(--tour-accent);
    outline-offset: 2px;
}

.tour-btn-skip {
    padding: 9px 14px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--tour-text-muted);
    font-size: 12.5px;
    font-weight: 500;
    font-family: var(--tour-font);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-btn-skip:hover {
    color: var(--tour-text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.tour-btn-skip:focus-visible {
    outline: 2px solid var(--tour-accent);
    outline-offset: 2px;
}

.tour-btn-next,
.tour-btn-finish {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 10px;
    background: var(--tour-accent);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--tour-font);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(var(--tour-accent-rgb), 0.3);
}

.tour-btn-next:hover,
.tour-btn-finish:hover {
    background: #ff3b44;
    box-shadow: 0 6px 20px rgba(var(--tour-accent-rgb), 0.45);
    transform: translateY(-1px);
}

.tour-btn-next:active,
.tour-btn-finish:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(var(--tour-accent-rgb), 0.2);
}

.tour-btn-next:focus-visible,
.tour-btn-finish:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 3px;
}

/* ═══════════════════════════════════════════════════════════════
   TOOLTIP PLACEMENT ARROWS
   ═══════════════════════════════════════════════════════════════ */
.tour-tooltip[data-placement="top"]::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: calc(50% - 8px);
    width: 0; height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid rgba(13, 13, 15, 0.97);
}

.tour-tooltip[data-placement="bottom"]::after {
    content: '';
    position: absolute;
    top: -8px;
    left: calc(50% - 8px);
    width: 0; height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 9px solid rgba(13, 13, 15, 0.97);
}

.tour-tooltip[data-placement="left"]::after {
    content: '';
    position: absolute;
    right: -8px;
    top: calc(50% - 8px);
    width: 0; height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 9px solid rgba(13, 13, 15, 0.97);
}

.tour-tooltip[data-placement="right"]::after {
    content: '';
    position: absolute;
    left: -8px;
    top: calc(50% - 8px);
    width: 0; height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-right: 9px solid rgba(13, 13, 15, 0.97);
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE
   ═══════════════════════════════════════════════════════════════ */
html:not(.dark) .tour-tooltip {
    --tour-bg: rgba(255, 255, 255, 0.97);
    --tour-surface: rgba(248, 249, 250, 0.95);
    --tour-border: rgba(0, 0, 0, 0.08);
    --tour-text: #2c3e50;
    --tour-text-secondary: #596673;
    --tour-text-muted: #7d8c9b;
    --tour-shadow:
        0 0 0 1px rgba(var(--tour-accent-rgb), 0.12),
        0 0 30px rgba(var(--tour-accent-rgb), 0.06),
        0 16px 48px rgba(0, 0, 0, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.08);
}

html:not(.dark) .tour-title {
    color: #1a1a2e;
}

html:not(.dark) .tour-tip {
    background: rgba(var(--tour-gold-rgb), 0.08);
    border-color: rgba(var(--tour-gold-rgb), 0.18);
}

html:not(.dark) .tour-btn-prev {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #596673;
}

html:not(.dark) .tour-btn-prev:hover {
    background: rgba(0, 0, 0, 0.07);
    color: #2c3e50;
}

html:not(.dark) .tour-btn-skip {
    color: #7d8c9b;
}

html:not(.dark) .tour-btn-skip:hover {
    color: #596673;
    background: rgba(0, 0, 0, 0.04);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤600px)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .tour-tooltip {
        width: calc(100vw - 24px);
        left: 12px !important;
        right: 12px !important;
        max-width: none;
        border-radius: 14px;
    }

    .tour-tooltip-inner {
        padding: 20px 20px 18px;
    }

    .tour-title {
        font-size: 17px;
    }

    .tour-description {
        font-size: 13px;
    }

    .tour-tip {
        font-size: 11.5px;
        padding: 8px 12px;
    }

    .tour-actions {
        flex-wrap: wrap;
    }

    .tour-btn-prev {
        padding: 8px 12px;
        font-size: 12px;
    }

    .tour-btn-next,
    .tour-btn-finish {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR — Tour force-open override
   Replica los estilos de hover/focus-within sin requerir
   interacción del cursor, para que el buscador, favoritos,
   categorías y resto de elementos sean visibles en cada paso
   que ilumina la barra lateral.
   ═══════════════════════════════════════════════════════════════ */

/* Ancho expandido al ancho completo en todos los breakpoints */
.sidebar-menu.tour-force-open {
    width: var(--sb-expanded);
    box-shadow: var(--sb-shadow), 0 0 40px rgba(255,255,255,0.05);
}

html:not(.dark) .sidebar-menu.tour-force-open {
    box-shadow: 4px 0 24px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
}

/* Mobile: fuerza expansión ignorando hover y respetando mobile toggle */
@media (max-width: 1024px) {
    .sidebar-menu.tour-force-open {
        width: var(--sb-expanded);
        box-shadow: var(--sb-shadow);
        z-index: 1000;
    }
}

/* Corner glow marker (::after) más visible */
.sidebar-menu.tour-force-open::after {
    opacity: 0.8;
}

/* Logo: el underline angular se extiende */
.sidebar-menu.tour-force-open .sidebar-logo::after {
    width: 36px;
}

/* Buscador: input visible, icono colapsado oculto */
.sidebar-menu.tour-force-open .sidebar-search-collapsed-icon {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}
.sidebar-menu.tour-force-open .sidebar-search-input {
    opacity: 1;
    pointer-events: auto;
}

/* Favorites toggle: ancho completo con label visible */
.sidebar-menu.tour-force-open .sidebar-fav-toggle {
    width: 100%;
    padding: 6px 10px;
    justify-content: flex-start;
}
.sidebar-menu.tour-force-open .sidebar-fav-toggle span {
    display: inline;
    opacity: 1;
}

/* Divider visible */
.sidebar-menu.tour-force-open .sidebar-divider {
    opacity: 1;
}

/* Categorías (parent) label, icono y chevron */
.sidebar-menu.tour-force-open .sidebar-parent-label,
.sidebar-menu.tour-force-open .sidebar-parent-chevron {
    opacity: 1;
}
.sidebar-menu.tour-force-open .sidebar-parent-icon {
    opacity: 1;
}

/* Children/sub-children líneas verticales */
.sidebar-menu.tour-force-open .sidebar-children::before,
.sidebar-menu.tour-force-open .sidebar-sub-children::before {
    opacity: 1;
}

/* Sub-parent labels y chevrons */
.sidebar-menu.tour-force-open .sidebar-sub-parent-label,
.sidebar-menu.tour-force-open .sidebar-sub-parent-chevron,
.sidebar-menu.tour-force-open .sidebar-sub-parent-icon {
    color: var(--sb-white-dim);
}
.sidebar-menu.tour-force-open .sidebar-sub-parent-label {
    opacity: 1;
}
.sidebar-menu.tour-force-open .sidebar-sub-parent-chevron {
    opacity: 1;
}

/* Leaf items */
.sidebar-menu.tour-force-open .sidebar-leaf-label {
    opacity: 1;
}
.sidebar-menu.tour-force-open .sidebar-leaf::before {
    opacity: 0.5;
}

/* Empty / error visibles en forma expandida */
.sidebar-menu.tour-force-open .sidebar-empty {
    opacity: 0.6;
}
.sidebar-menu.tour-force-open .sidebar-error {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .tour-tooltip,
    .tour-overlay,
    .tour-highlight,
    .tour-progress-fill,
    .sidebar-menu.tour-force-open {
        transition-duration: 0s !important;
        animation-duration: 0s !important;
    }
}
