/**
 * Onboarding Styles
 *
 * Styles for the onboarding overlay, tooltips, and highlight effects.
 * Uses CSS variables from main.css for consistency with Fintech Light Theme.
 */

/* ============================================ */
/* Overlay */
/* ============================================ */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.onboarding-overlay.active {
    opacity: 1;
}

/* Interactive mode: overlay passes clicks through to highlighted elements */
.onboarding-overlay.interactive-mode {
    pointer-events: none;
}

/* Raise modal z-index when it contains highlighted element */
body.onboarding-active [id$="-modal"]:not(.hidden) {
    z-index: 10001 !important;
}

/* ============================================ */
/* Highlighted Element */
/* ============================================ */

.onboarding-highlight {
    position: relative;
    z-index: 9999 !important;
    box-shadow:
        0 0 0 4px var(--accent-blue),
        0 0 20px rgba(37, 99, 235, 0.4),
        0 0 40px rgba(37, 99, 235, 0.2);
    border-radius: 8px;
    transition: box-shadow 0.3s ease;
    /* Allow clicks on highlighted elements during interactive mode */
    pointer-events: auto;
    cursor: pointer;
}

/* ============================================ */
/* Modal (Welcome, Mode Select, Complete) */
/* ============================================ */

.onboarding-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 10000;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: calc(100% - 32px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.3s ease;
}

.onboarding-modal.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.onboarding-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    background: var(--bg-accent);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-modal-icon svg {
    width: 32px;
    height: 32px;
    color: var(--accent-blue);
}

.onboarding-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 12px;
}

.onboarding-modal-description {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 32px;
}

.onboarding-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.onboarding-modal-actions .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    font-size: 15px;
}

.onboarding-modal-actions .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    font-size: 15px;
}

.onboarding-skip-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease;
}

.onboarding-skip-link:hover {
    color: var(--text-secondary);
}

/* ============================================ */
/* Mode Selection Cards */
/* ============================================ */

.onboarding-mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.onboarding-mode-card {
    padding: 24px 20px;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.onboarding-mode-card:hover {
    border-color: var(--accent-blue);
    background: var(--bg-accent);
}

.onboarding-mode-card.selected {
    border-color: var(--accent-blue);
    background: var(--bg-accent);
}

.onboarding-mode-card-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: var(--bg-white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
}

.onboarding-mode-card-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

.onboarding-mode-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.onboarding-mode-card-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ============================================ */
/* Tooltip */
/* ============================================ */

.onboarding-tooltip {
    position: fixed;
    z-index: 10002;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    max-width: 320px;
    width: max-content;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    /* Ensure tooltip is clickable during interactive mode */
    pointer-events: auto;
}

.onboarding-tooltip.active {
    opacity: 1;
    transform: translateY(0);
}

.onboarding-tooltip-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.onboarding-tooltip-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.onboarding-tooltip-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.onboarding-tooltip-actions .btn-primary,
.onboarding-tooltip-actions .btn-secondary {
    padding: 8px 16px;
    font-size: 13px;
}

/* Tooltip Arrow */
.onboarding-tooltip::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    transform: rotate(45deg);
}

.onboarding-tooltip.position-top::before {
    bottom: -7px;
    left: 50%;
    margin-left: -6px;
    border-top: none;
    border-left: none;
}

.onboarding-tooltip.position-bottom::before {
    top: -7px;
    left: 50%;
    margin-left: -6px;
    border-bottom: none;
    border-right: none;
}

.onboarding-tooltip.position-left::before {
    right: -7px;
    top: 50%;
    margin-top: -6px;
    border-bottom: none;
    border-left: none;
}

.onboarding-tooltip.position-right::before {
    left: -7px;
    top: 50%;
    margin-top: -6px;
    border-top: none;
    border-right: none;
}

/* ============================================ */
/* Step Progress Indicator */
/* ============================================ */

.onboarding-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.onboarding-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-medium);
    transition: all 0.2s ease;
}

.onboarding-progress-dot.active {
    background: var(--accent-blue);
    transform: scale(1.25);
}

.onboarding-progress-dot.completed {
    background: var(--accent-green);
}

/* ============================================ */
/* Animations */
/* ============================================ */

@keyframes onboardingFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes onboardingPulse {
    0%, 100% {
        box-shadow:
            0 0 0 4px var(--accent-blue),
            0 0 20px rgba(37, 99, 235, 0.4);
    }
    50% {
        box-shadow:
            0 0 0 6px var(--accent-blue),
            0 0 30px rgba(37, 99, 235, 0.6);
    }
}

.onboarding-highlight {
    animation: onboardingPulse 2s ease-in-out infinite;
}

/* ============================================ */
/* Complete Screen Specific */
/* ============================================ */

.onboarding-complete-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--accent-green-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-complete-icon svg {
    width: 40px;
    height: 40px;
    color: var(--accent-green);
}

/* ============================================ */
/* Responsive Styles */
/* ============================================ */

@media (max-width: 640px) {
    .onboarding-modal {
        padding: 24px 20px;
        border-radius: 12px;
        max-width: 100%;
        width: calc(100% - 24px);
    }

    .onboarding-modal-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 20px;
    }

    .onboarding-modal-icon svg {
        width: 28px;
        height: 28px;
    }

    .onboarding-modal-title {
        font-size: 20px;
    }

    .onboarding-modal-description {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .onboarding-mode-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .onboarding-mode-card {
        padding: 20px 16px;
    }

    .onboarding-mode-card-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 12px;
    }

    .onboarding-mode-card-icon svg {
        width: 20px;
        height: 20px;
    }

    .onboarding-tooltip {
        max-width: calc(100vw - 32px);
        padding: 16px;
    }

    .onboarding-tooltip-title {
        font-size: 15px;
    }

    .onboarding-tooltip-description {
        font-size: 13px;
    }

    .onboarding-complete-icon {
        width: 64px;
        height: 64px;
    }

    .onboarding-complete-icon svg {
        width: 32px;
        height: 32px;
    }
}

/* ============================================ */
/* Accessibility - Focus States */
/* ============================================ */

.onboarding-mode-card:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.onboarding-modal-actions .btn-primary:focus,
.onboarding-modal-actions .btn-secondary:focus,
.onboarding-tooltip-actions .btn-primary:focus,
.onboarding-tooltip-actions .btn-secondary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.onboarding-skip-link:focus {
    outline: none;
    text-decoration: underline;
    color: var(--text-secondary);
}

/* ============================================ */
/* Help Icons */
/* ============================================ */

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 50%;
    flex-shrink: 0;
}

.help-icon:hover {
    color: var(--accent-blue);
    background: var(--bg-accent);
}

.help-icon.active {
    color: var(--accent-blue);
    background: var(--bg-accent);
}

.help-icon:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-accent);
}

.help-icon svg {
    width: 16px;
    height: 16px;
}

/* ============================================ */
/* Help Tooltip */
/* ============================================ */

.help-tooltip {
    position: fixed;
    z-index: 10001;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px;
    max-width: 300px;
    width: max-content;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.2s ease;
}

.help-tooltip.active {
    opacity: 1;
    transform: translateY(0);
}

.help-tooltip-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.help-tooltip-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Responsive Help Icons */
@media (max-width: 640px) {
    .help-tooltip {
        max-width: calc(100vw - 24px);
        padding: 14px;
    }

    .help-tooltip-title {
        font-size: 13px;
    }

    .help-tooltip-description {
        font-size: 12px;
    }
}
