/* =============================================================================
   HERARX ONBOARDING TOUR v2
   Full-screen spotlight with 4-quadrant overlay and sliding bottom panel.
   ============================================================================= */

/* ── Spotlight quadrant overlays ────────────────────────────────────────────── */
.tour-ov {
    position: fixed;
    background: rgba(2, 6, 23, 0.76);
    z-index: 9980;
    pointer-events: all;
    transition: opacity 0.18s ease;
}
.tour-ov.hidden { opacity: 0; pointer-events: none; }

/* ── Spotlight frame (decorative ring + corner markers) ─────────────────────── */
#tour-frame {
    position: fixed;
    pointer-events: none;
    z-index: 9982;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.22s ease;
}
#tour-frame.visible { opacity: 1; }

#tour-frame::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 13px;
    border: 1.5px solid rgba(59, 130, 246, 0.5);
    animation: tour-ring-pulse 2.4s ease-in-out infinite;
}

@keyframes tour-ring-pulse {
    0%, 100% { border-color: rgba(59, 130, 246, 0.5); box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.05); }
    50%       { border-color: rgba(59, 130, 246, 0.18); box-shadow: 0 0 0 10px rgba(59, 130, 246, 0.02); }
}

/* Corner markers — four <span class="tc tc-*"> children of #tour-frame */
.tc {
    position: absolute;
    width: 20px;
    height: 20px;
}
.tc::before,
.tc::after {
    content: '';
    position: absolute;
    background: #60a5fa;
    border-radius: 2px;
}
.tc::before { width: 3px; height: 20px; }
.tc::after  { width: 20px; height: 3px; }

.tc-tl { top: -4px; left: -4px; }
.tc-tl::before { top: 0; left: 0; }
.tc-tl::after  { top: 0; left: 0; }

.tc-tr { top: -4px; right: -4px; }
.tc-tr::before { top: 0; right: 0; }
.tc-tr::after  { top: 0; right: 0; }

.tc-bl { bottom: -4px; left: -4px; }
.tc-bl::before { bottom: 0; left: 0; }
.tc-bl::after  { bottom: 0; left: 0; }

.tc-br { bottom: -4px; right: -4px; }
.tc-br::before { bottom: 0; right: 0; }
.tc-br::after  { bottom: 0; right: 0; }

/* ── Bottom panel ───────────────────────────────────────────────────────────── */
#tour-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(220px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 9990;
    background: #08101e;
    border-top: 1px solid rgba(59, 130, 246, 0.15);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.65), 0 -4px 16px rgba(0, 0, 0, 0.4);
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: all;
    font-family: var(--font-sans, 'Inter', sans-serif);
}
#tour-panel.visible { transform: translateY(0); }

.tour-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px 0;
    flex-shrink: 0;
}

.tour-panel-progress-row {
    display: flex;
    align-items: center;
    gap: 0;
}

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

.tour-step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #1e2d42;
    transition: all 0.25s ease;
}
.tour-step-dot.done   { background: #2563eb; }
.tour-step-dot.active { background: #3b82f6; width: 22px; border-radius: 4px; }

.tour-step-label {
    font-size: 11px;
    font-weight: 600;
    color: #344a66;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-left: 14px;
}

.tour-panel-skip {
    background: none;
    border: none;
    font-size: 12px;
    color: #2a3d52;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: inherit;
    transition: color 0.15s;
}
.tour-panel-skip:hover { color: #4a6a8a; }

.tour-panel-body {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 14px 32px 0;
    overflow: hidden;
    min-height: 0;
}

.tour-panel-icon {
    font-size: 30px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.tour-panel-text { flex: 1; min-width: 0; }

.tour-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: #d8e8f8;
    margin: 0 0 6px;
    line-height: 1.3;
}

.tour-panel-desc {
    font-size: 13px;
    color: #4a6a8a;
    line-height: 1.65;
    margin: 0;
}

.tour-panel-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 32px 18px;
    flex-shrink: 0;
}

.tour-btn-back {
    padding: 9px 16px;
    background: transparent;
    color: #344a66;
    border: 1px solid #1a2a3d;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.tour-btn-back:hover { background: #0f1e30; color: #5a7a9a; }

.tour-btn-next {
    padding: 9px 22px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    white-space: nowrap;
}
.tour-btn-next:hover { background: #2563eb; }

/* ── Welcome / Finale modal overlay ─────────────────────────────────────────── */
#tour-modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 9995;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(1, 4, 14, 0.88);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
#tour-modal-wrap.visible {
    opacity: 1;
    pointer-events: all;
}

.tour-modal {
    background: #08101e;
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 22px;
    padding: 48px 52px 44px;
    max-width: 500px;
    width: 92%;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.8), 0 8px 32px rgba(0, 0, 0, 0.5);
    font-family: var(--font-sans, 'Inter', sans-serif);
    text-align: center;
    transform: scale(0.94) translateY(14px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#tour-modal-wrap.visible .tour-modal {
    transform: scale(1) translateY(0);
}

.tour-modal-icon {
    font-size: 52px;
    display: block;
    margin-bottom: 20px;
    line-height: 1;
}
.tour-modal-title {
    font-size: 23px;
    font-weight: 800;
    color: #d8e8f8;
    margin: 0 0 12px;
    line-height: 1.2;
}
.tour-modal-body {
    font-size: 14px;
    color: #4a6a8a;
    line-height: 1.75;
    margin: 0 0 30px;
}

/* Feature grid (finale) */
.tour-features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 30px;
    text-align: left;
}
.tour-feature-item {
    background: #0d1829;
    border: 1px solid #1a2a3d;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.tour-feature-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(59, 130, 246, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #60a5fa;
    font-size: 11px;
}
.tour-feature-name {
    font-size: 12px;
    font-weight: 700;
    color: #a8c0d8;
    margin-bottom: 2px;
}
.tour-feature-desc {
    font-size: 11px;
    color: #344a66;
    line-height: 1.4;
}

.tour-modal-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.tour-modal-cta {
    width: 100%;
    padding: 13px 24px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.tour-modal-cta:hover { background: #2563eb; }

.tour-modal-cta-secondary {
    background: none;
    border: none;
    font-size: 13px;
    color: #344a66;
    cursor: pointer;
    padding: 6px 10px;
    font-family: inherit;
    transition: color 0.15s;
}
.tour-modal-cta-secondary:hover { color: #5a7a9a; }

/* ── Restart button (sidebar footer) ─────────────────────────────────────────── */
#tour-restart-btn {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    width: 100%;
    font-family: var(--font-sans, 'Inter', sans-serif);
    transition: color 0.15s, background 0.15s;
}
#tour-restart-btn:hover {
    color: var(--brand-500, #3b82f6);
    background: var(--surface-2, rgba(255,255,255,0.06));
}
#tour-restart-btn.show { display: flex; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    /* Panel — keep 220px content height; safe-area already handled in base rule */
    .tour-panel-head {
        padding: 10px 16px 0;
    }
    .tour-step-label {
        font-size: 10px;
        margin-left: 10px;
    }
    .tour-panel-skip {
        font-size: 11px;
        padding: 6px 6px;
    }
    .tour-panel-body {
        padding: 8px 16px 0;
        gap: 12px;
    }
    .tour-panel-icon {
        font-size: 24px;
    }
    .tour-panel-title {
        font-size: 14px;
        margin-bottom: 4px;
    }
    .tour-panel-desc {
        font-size: 12px;
        line-height: 1.5;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .tour-panel-actions {
        padding: 8px 16px 12px;
        gap: 8px;
    }
    /* 44 px minimum tap targets */
    .tour-btn-back {
        padding: 0 14px;
        min-height: 44px;
        font-size: 12px;
        touch-action: manipulation;
    }
    .tour-btn-next {
        flex: 1;
        padding: 0 16px;
        min-height: 44px;
        font-size: 13px;
        touch-action: manipulation;
    }
    .tour-btn-next:active { transform: scale(0.97); }
    .tour-btn-back:active  { transform: scale(0.97); }

    /* Modal — bottom sheet on mobile */
    #tour-modal-wrap {
        align-items: flex-end;
    }
    .tour-modal {
        width: 100%;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 8px 22px calc(32px + env(safe-area-inset-bottom, 0px));
        max-height: calc(92dvh - env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        transform: translateY(48px);
        transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    }
    /* Drag-handle indicator */
    .tour-modal::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 2px;
        margin: 0 auto 20px;
    }
    #tour-modal-wrap.visible .tour-modal {
        transform: translateY(0);
    }
    .tour-modal-icon {
        font-size: 42px;
        margin-bottom: 14px;
    }
    .tour-modal-title {
        font-size: 20px;
        margin-bottom: 10px;
    }
    .tour-modal-body {
        font-size: 13px;
        margin-bottom: 22px;
    }
    .tour-features-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 20px;
    }
    .tour-modal-cta {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 50px;
        touch-action: manipulation;
    }
    .tour-modal-cta-secondary {
        min-height: 40px;
        padding: 8px 10px;
        touch-action: manipulation;
    }
    .tour-panel-skip {
        touch-action: manipulation;
    }
}

/* Reduce motion — keep opacity-only transitions, drop all transforms */
@media (prefers-reduced-motion: reduce) {
    #tour-panel {
        transition: opacity 0.2s ease;
    }
    #tour-panel.visible { transform: translateY(0); }
    .tour-modal {
        transition: opacity 0.2s ease;
        transform: none !important;
    }
    #tour-modal-wrap {
        transition: opacity 0.2s ease;
    }
    #tour-frame { transition: none; }
    .tour-ov    { transition: none; }
}
