/**
 * Guided Tour Component Styles
 * Mimecast-style modal popups with spotlight, progress indicators, and help button
 */

/* ============================================================================
   VARIABLES
   ============================================================================ */

:root {
    /* Guided tour specific */
    --tour-modal-width: 480px;
    --tour-icon-size: 64px;
    --tour-icon-bg: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
    --tour-z-index: 10000;
    --tour-backdrop-z: 9999;
    --tour-spotlight-z: 9998;
    --tour-help-btn-z: 9000;
}

/* ============================================================================
   GUIDED TOUR MODAL
   ============================================================================ */

.guided-tour-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--tour-z-index);
    display: none;
    font-family: var(--font-family, 'Inter', sans-serif);
}

.guided-tour-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Backdrop */
.guided-tour-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    animation: tourFadeIn var(--drilldown-transition-normal, 0.25s) ease;
    z-index: var(--tour-backdrop-z);
    display: none;
}

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

/* Content Container - Mimecast-style */
.guided-tour-modal__content {
    position: relative;
    background: var(--bg-secondary, #1e293b);
    border-radius: var(--border-radius-lg, 16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: var(--tour-modal-width);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: calc(var(--tour-backdrop-z) + 1);
    animation: tourScaleIn var(--drilldown-transition-normal, 0.25s) ease;
    overflow: hidden;
}

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

/* Header with Icon */
.guided-tour-modal__header {
    padding: 2rem 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.guided-tour-modal__icon {
    width: var(--tour-icon-size);
    height: var(--tour-icon-size);
    background: var(--tour-icon-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: white;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

.guided-tour-modal__icon svg {
    width: 32px;
    height: 32px;
    stroke-width: 2;
}

.guided-tour-modal__title {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.guided-tour-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.guided-tour-modal__close:hover {
    background: var(--bg-tertiary, #334155);
    color: var(--text-primary, #e2e8f0);
}

.guided-tour-modal__close:focus-visible {
    outline: 2px solid var(--accent-primary, #6366f1);
    outline-offset: 2px;
}

.guided-tour-modal__close svg {
    width: 18px;
    height: 18px;
}

/* Body */
.guided-tour-modal__body {
    padding: 0 2rem 1.5rem;
    text-align: center;
}

.guided-tour-modal__description {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-secondary, #94a3b8);
}

/* Footer */
.guided-tour-modal__footer {
    padding: 1.25rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-top: 1px solid var(--border-color, #334155);
    background: var(--bg-tertiary, #334155);
}

/* Progress Indicator */
.guided-tour-modal__progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.guided-tour-progress__text {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.guided-tour-progress__dots {
    display: flex;
    gap: 0.375rem;
}

.guided-tour-progress__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color, #334155);
    transition: all 0.2s ease;
}

.guided-tour-progress__dot.active {
    background: var(--accent-primary, #6366f1);
    transform: scale(1.25);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.guided-tour-progress__dot.completed {
    background: var(--accent-primary, #6366f1);
    opacity: 0.5;
}

/* Action Buttons */
.guided-tour-modal__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.guided-tour-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    min-width: 140px;
    font-family: inherit;
}

.guided-tour-btn--primary {
    background: var(--accent-primary, #6366f1);
    color: #fff;
}

.guided-tour-btn--primary:hover {
    background: var(--accent-primary-hover, #4f46e5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

.guided-tour-btn--secondary {
    background: transparent;
    color: var(--text-secondary, #94a3b8);
    border: 1px solid var(--border-color, #334155);
}

.guided-tour-btn--secondary:hover {
    background: var(--bg-secondary, #1e293b);
    color: var(--text-primary, #e2e8f0);
    border-color: var(--text-secondary, #94a3b8);
}

/* Dismiss Checkboxes */
.guided-tour-modal__dismiss-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.guided-tour-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-muted, #64748b);
    transition: color 0.15s ease;
}

.guided-tour-checkbox:hover {
    color: var(--text-secondary, #94a3b8);
}

.guided-tour-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary, #6366f1);
    cursor: pointer;
}

.guided-tour-checkbox__label {
    user-select: none;
}

/* Hide progress for single popups */
.guided-tour-modal--single .guided-tour-modal__progress {
    display: none;
}

/* Hide per-tour dismiss for single popups */
.guided-tour-modal--single .guided-tour-dismiss--per-tour {
    display: none;
}

/* ============================================================================
   SPOTLIGHT OVERLAY (for targeting elements)
   ============================================================================ */

.guided-tour-spotlight {
    position: fixed;
    inset: 0;
    z-index: var(--tour-spotlight-z);
    pointer-events: none;
}

.guided-tour-spotlight__highlight {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    transition: all 0.3s ease;
    pointer-events: auto;
    border: 2px solid var(--accent-primary, #6366f1);
    display: none;
}

.guided-tour-spotlight__highlight::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 10px;
    border: 2px dashed rgba(99, 102, 241, 0.5);
    animation: tourPulse 2s ease-in-out infinite;
}

@keyframes tourPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* ============================================================================
   FLOATING HELP BUTTON
   ============================================================================ */

.guided-tour-help-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--tour-help-btn-z);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-primary, #6366f1);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
    font-family: inherit;
}

.guided-tour-help-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.guided-tour-help-btn:active {
    transform: scale(1.05);
}

.guided-tour-help-btn svg {
    width: 24px;
    height: 24px;
}

/* Help button hidden state */
.guided-tour-help-btn.hidden {
    display: none;
}

/* ============================================================================
   HELP MENU POPUP
   ============================================================================ */

.guided-tour-help-menu {
    position: fixed;
    bottom: 84px;
    right: 24px;
    z-index: var(--tour-help-btn-z);
    background: var(--bg-secondary, #1e293b);
    border-radius: var(--border-radius, 12px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    min-width: 240px;
    overflow: hidden;
    display: none;
    animation: tourSlideUp 0.2s ease;
}

.guided-tour-help-menu.active {
    display: block;
}

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

.guided-tour-help-menu__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #334155);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary, #e2e8f0);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.guided-tour-help-menu__header svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary, #6366f1);
}

.guided-tour-help-menu__items {
    padding: 0.5rem 0;
}

.guided-tour-help-menu__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.875rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.guided-tour-help-menu__item:hover {
    background: var(--bg-tertiary, #334155);
    color: var(--text-primary, #e2e8f0);
}

.guided-tour-help-menu__item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.guided-tour-help-menu__divider {
    height: 1px;
    background: var(--border-color, #334155);
    margin: 0.5rem 0;
}

.guided-tour-help-menu__toggle {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-muted, #64748b);
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
}

.guided-tour-help-menu__toggle:hover {
    background: var(--bg-tertiary, #334155);
    color: var(--text-secondary, #94a3b8);
}

.guided-tour-help-menu__toggle input {
    accent-color: var(--accent-primary, #6366f1);
}

/* ============================================================================
   POSITIONED MODAL (for targeted popups)
   ============================================================================ */

.guided-tour-modal--positioned .guided-tour-modal__content {
    position: absolute;
}

.guided-tour-modal--positioned.position-top .guided-tour-modal__content {
    margin-bottom: 1rem;
}

.guided-tour-modal--positioned.position-bottom .guided-tour-modal__content {
    margin-top: 1rem;
}

.guided-tour-modal--positioned.position-left .guided-tour-modal__content {
    margin-right: 1rem;
}

.guided-tour-modal--positioned.position-right .guided-tour-modal__content {
    margin-left: 1rem;
}

/* Arrow pointer */
.guided-tour-modal__arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--bg-secondary, #1e293b);
    transform: rotate(45deg);
    border: 1px solid var(--border-color, #334155);
}

.guided-tour-modal--positioned.position-top .guided-tour-modal__arrow {
    bottom: -8px;
    left: 50%;
    margin-left: -8px;
    border-top: none;
    border-left: none;
}

.guided-tour-modal--positioned.position-bottom .guided-tour-modal__arrow {
    top: -8px;
    left: 50%;
    margin-left: -8px;
    border-bottom: none;
    border-right: none;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .guided-tour-modal__content {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 85vh;
        border-radius: var(--border-radius-lg, 16px) var(--border-radius-lg, 16px) 0 0;
        position: absolute;
        bottom: 0;
        animation: tourSlideUp 0.3s ease;
    }

    .guided-tour-modal__actions {
        flex-direction: column;
    }

    .guided-tour-btn {
        width: 100%;
    }

    .guided-tour-help-btn {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }

    .guided-tour-help-menu {
        bottom: 72px;
        right: 16px;
        left: 16px;
        min-width: auto;
    }

    /* Add drag handle for mobile bottom sheet */
    .guided-tour-modal__content::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--text-muted, #64748b);
        border-radius: 2px;
        margin: 0.75rem auto 0;
        opacity: 0.5;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

.guided-tour-modal:focus-visible,
.guided-tour-help-btn:focus-visible,
.guided-tour-help-menu__item:focus-visible {
    outline: 2px solid var(--accent-primary, #6366f1);
    outline-offset: 2px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .guided-tour-modal__content,
    .guided-tour-modal__backdrop,
    .guided-tour-help-menu,
    .guided-tour-spotlight__highlight {
        animation: none;
    }

    .guided-tour-spotlight__highlight::before {
        animation: none;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .guided-tour-modal,
    .guided-tour-help-btn,
    .guided-tour-help-menu,
    .guided-tour-spotlight {
        display: none !important;
    }
}
