/**
 * AnalystMarkets Product Tour Styles
 * Professional onboarding tour overlay and tooltips
 */

/* Content blur when tour is active */
body.tour-active .main-content,
body.tour-active .about-container,
body.tour-active .news-container {
    filter: blur(8px) brightness(0.7);
    transition: filter 0.3s ease;
    pointer-events: none;
}

/* Ensure tour elements stay sharp above the blur */
body.tour-active .tour-overlay,
body.tour-active .tour-tooltip,
body.tour-active .tour-highlight,
body.tour-active .tour-completion-message,
body.tour-active .tour-skip-modal {
    filter: none;
    pointer-events: auto;
}

/* Tour Overlay - Improved Blur Quality */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: var(--z-modal-backdrop);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: tourFadeIn 0.3s ease;
    pointer-events: auto;
}

[data-theme="light"] .tour-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Reduce blur on mobile for performance */
@media (max-width: 768px) {
    .tour-overlay {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        background: rgba(0, 0, 0, 0.6);
    }
}

@keyframes tourFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Tour Highlight - Enhanced Visibility */
.tour-highlight {
    position: fixed;
    border: 3px solid #667eea;
    border-radius: 12px;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.55),
        0 0 0 4px rgba(102, 126, 234, 0.6),
        0 0 0 8px rgba(102, 126, 234, 0.2),
        0 8px 32px rgba(102, 126, 234, 0.5);
    z-index: var(--z-modal);
    pointer-events: none;
    animation: tourPulse 2s ease-in-out infinite;
    /* Ensure charts/iframes remain visible */
    mix-blend-mode: normal;
}

[data-theme="light"] .tour-highlight {
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.5),
        0 0 0 4px rgba(102, 126, 234, 0.7),
        0 0 0 8px rgba(102, 126, 234, 0.3),
        0 8px 32px rgba(102, 126, 234, 0.6);
}

@keyframes tourPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 9999px rgba(0, 0, 0, 0.75),
            0 0 0 4px rgba(102, 126, 234, 0.5),
            0 8px 32px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 
            0 0 0 9999px rgba(0, 0, 0, 0.75),
            0 0 0 6px rgba(102, 126, 234, 0.7),
            0 12px 40px rgba(102, 126, 234, 0.6);
    }
}

/* Tour Tooltip */
.tour-tooltip {
    position: fixed;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: var(--z-popover);
    animation: tourSlideIn 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] .tour-tooltip {
    background: var(--card-bg, #1f2937);
    border-color: var(--border-color, #374151);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

@keyframes tourSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Tooltip Header */
.tour-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.tour-step-indicator {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

[data-theme="dark"] .tour-step-indicator {
    color: var(--text-primary, #f9fafb);
}

.tour-step-number {
    font-size: 1.25rem;
    color: #667eea;
}

.tour-step-total {
    font-size: 0.875rem;
    color: var(--text-secondary, #6b7280);
}

.tour-close {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
}

.tour-close:hover {
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text-primary, #111827);
}

[data-theme="dark"] .tour-close:hover {
    background: var(--bg-secondary, #374151);
    color: var(--text-primary, #f9fafb);
}

.tour-close:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Tooltip Body */
.tour-tooltip-body {
    padding: 1.25rem;
}

.tour-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
}

[data-theme="dark"] .tour-title {
    color: var(--text-primary, #f9fafb);
}

.tour-text {
    font-size: 0.9375rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
    line-height: 1.6;
}

[data-theme="dark"] .tour-text {
    color: var(--text-secondary, #9ca3af);
}

/* Tooltip Footer */
.tour-tooltip-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.tour-progress {
    margin-bottom: 1rem;
}

.tour-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 2px;
    overflow: hidden;
}

[data-theme="dark"] .tour-progress-bar {
    background: var(--bg-secondary, #374151);
}

.tour-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.tour-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.tour-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.tour-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.tour-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tour-btn-primary:active {
    transform: translateY(0);
}

.tour-btn-primary:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.tour-btn-secondary {
    background: var(--card-bg, #ffffff);
    color: var(--text-primary, #111827);
    border: 1px solid var(--border-color, #e5e7eb);
}

[data-theme="dark"] .tour-btn-secondary {
    background: var(--card-bg, #1f2937);
    color: var(--text-primary, #f9fafb);
    border-color: var(--border-color, #374151);
}

.tour-btn-secondary:hover {
    background: var(--bg-secondary, #f3f4f6);
    border-color: #667eea;
}

[data-theme="dark"] .tour-btn-secondary:hover {
    background: var(--bg-secondary, #374151);
}

.tour-btn-secondary:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Completion Message */
.tour-completion-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-tooltip);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tour-completion-message.show {
    opacity: 1;
}

.tour-completion-content {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-width: 300px;
}

[data-theme="dark"] .tour-completion-content {
    background: var(--card-bg, #1f2937);
    border-color: var(--border-color, #374151);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.tour-completion-content i {
    width: 48px;
    height: 48px;
    color: #10b981;
    margin-bottom: 1rem;
}

.tour-completion-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0 0 0.5rem 0;
}

[data-theme="dark"] .tour-completion-content h3 {
    color: var(--text-primary, #f9fafb);
}

.tour-completion-content p {
    font-size: 0.9375rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
}

[data-theme="dark"] .tour-completion-content p {
    color: var(--text-secondary, #9ca3af);
}

/* Responsive Design */
@media (max-width: 768px) {
    .tour-tooltip {
        width: calc(100vw - 32px);
        max-width: 320px;
    }

    .tour-tooltip-header,
    .tour-tooltip-body,
    .tour-tooltip-footer {
        padding: 1rem;
    }

    .tour-actions {
        flex-direction: column;
    }

    .tour-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .tour-overlay,
    .tour-tooltip,
    .tour-highlight,
    .tour-completion-message {
        animation: none;
    }

    .tour-highlight {
        animation: none;
    }
}

/* Skip Modal - Custom Modal to Replace Native Alerts */
.tour-skip-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-tooltip);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: tourFadeIn 0.2s ease;
}

.tour-skip-modal-content {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 400px;
    width: 100%;
    animation: tourSlideIn 0.3s ease;
}

[data-theme="dark"] .tour-skip-modal-content {
    background: var(--card-bg, #1f2937);
    border-color: var(--border-color, #374151);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.tour-skip-modal-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.tour-skip-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0;
    line-height: 1.4;
}

[data-theme="dark"] .tour-skip-title {
    color: var(--text-primary, #f9fafb);
}

.tour-skip-modal-body {
    padding: 1rem 1.5rem;
}

.tour-skip-text {
    font-size: 0.9375rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
    line-height: 1.6;
}

[data-theme="dark"] .tour-skip-text {
    color: var(--text-secondary, #9ca3af);
}

.tour-skip-modal-footer {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .tour-skip-modal-content {
        max-width: calc(100vw - 32px);
    }
    
    .tour-skip-modal-footer {
        flex-direction: column-reverse;
    }
    
    .tour-skip-modal-footer .tour-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Print styles */
@media print {
    .tour-overlay,
    .tour-tooltip,
    .tour-highlight,
    .tour-completion-message,
    .tour-skip-modal {
        display: none !important;
    }
}

