/**
 * LeanQuest Tour Framework Styles
 *
 * Styles for the page-specific tour system including:
 * - Overlay and highlight
 * - Tooltip positioning and animations
 * - Progress indicators
 * - Help/Tour buttons
 *
 * Uses LeanQuest color scheme:
 * - Primary: #4361ee
 * - Success: #38b000
 */

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

:root {
    --lq-tour-primary: #4361ee;
    --lq-tour-primary-dark: #364dd0;
    --lq-tour-success: #38b000;
    --lq-tour-success-dark: #2e9600;
    --lq-tour-text: #1e293b;
    --lq-tour-text-muted: #475569;
    --lq-tour-border: #e2e8f0;
    --lq-tour-bg: #f8fafc;
}

/* ========================================
   OVERLAY AND HIGHLIGHT
   ======================================== */

body.lq-tour-active {
    overflow: hidden;
}

.lq-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99990;
    pointer-events: none;
}

.lq-tour-overlay-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    transition: all 0.3s ease;
}

.lq-tour-overlay.has-cutout .lq-tour-overlay-bg {
    clip-path: polygon(
        0% 0%,
        0% 100%,
        var(--cutout-left) 100%,
        var(--cutout-left) var(--cutout-top),
        calc(var(--cutout-left) + var(--cutout-width)) var(--cutout-top),
        calc(var(--cutout-left) + var(--cutout-width)) calc(var(--cutout-top) + var(--cutout-height)),
        var(--cutout-left) calc(var(--cutout-top) + var(--cutout-height)),
        var(--cutout-left) 100%,
        100% 100%,
        100% 0%
    );
}

.lq-tour-highlight {
    position: absolute;
    z-index: 99991;
    border: 3px solid var(--lq-tour-primary);
    border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3),
                0 4px 16px rgba(67, 97, 238, 0.25);
    pointer-events: none;
    transition: all 0.3s ease;
    animation: lq-tour-pulse 2s infinite;
}

@keyframes lq-tour-pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3),
                    0 4px 16px rgba(67, 97, 238, 0.25);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(67, 97, 238, 0.15),
                    0 4px 20px rgba(67, 97, 238, 0.35);
    }
}

/* ========================================
   TOOLTIP
   ======================================== */

.lq-tour-tooltip {
    position: absolute;
    z-index: 99995;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15),
                0 2px 10px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    overflow: hidden;
}

/* Arrow indicators */
.lq-tour-tooltip::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    box-shadow: -2px -2px 5px rgba(0, 0, 0, 0.03);
}

.lq-tour-tooltip.position-bottom::before {
    top: -8px;
    left: 50%;
    margin-left: -8px;
}

.lq-tour-tooltip.position-top::before {
    bottom: -8px;
    left: 50%;
    margin-left: -8px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.03);
}

.lq-tour-tooltip.position-left::before {
    right: -8px;
    top: 50%;
    margin-top: -8px;
    box-shadow: 2px -2px 5px rgba(0, 0, 0, 0.03);
}

.lq-tour-tooltip.position-right::before {
    left: -8px;
    top: 50%;
    margin-top: -8px;
}

/* Tooltip Header - LeanQuest gradient */
.lq-tour-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: linear-gradient(135deg, #4361ee 0%, #38b000 100%);
    color: white;
}

.lq-tour-step-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.95;
}

.lq-tour-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lq-tour-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Tooltip Content */
.lq-tour-tooltip-content {
    padding: 18px 20px;
}

.lq-tour-title {
    margin: 0 0 10px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--lq-tour-text);
}

.lq-tour-description {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--lq-tour-text-muted);
}

.lq-tour-description p {
    margin: 0 0 10px 0;
}

.lq-tour-description p:last-child {
    margin-bottom: 0;
}

.lq-tour-description strong {
    color: var(--lq-tour-text);
}

.lq-tour-description ul,
.lq-tour-description ol {
    margin: 8px 0;
    padding-left: 20px;
}

.lq-tour-description li {
    margin-bottom: 4px;
}

/* Tip callout box */
.lq-tour-description .tip {
    display: block;
    margin-top: 14px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.08) 0%, rgba(56, 176, 0, 0.08) 100%);
    border-left: 3px solid var(--lq-tour-primary);
    border-radius: 0 8px 8px 0;
    font-size: 0.875rem;
    color: var(--lq-tour-primary-dark);
}

.lq-tour-description .tip::before {
    content: '\f0eb';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 8px;
    color: var(--lq-tour-success);
}

/* Tooltip Footer */
.lq-tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-top: 1px solid var(--lq-tour-border);
    background: var(--lq-tour-bg);
}

/* Progress Dots */
.lq-tour-progress {
    display: flex;
    gap: 6px;
}

.lq-tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}

.lq-tour-dot:hover {
    background: #94a3b8;
    transform: scale(1.2);
}

.lq-tour-dot.active {
    background: var(--lq-tour-primary);
    transform: scale(1.3);
}

.lq-tour-dot.completed {
    background: var(--lq-tour-success);
}

/* Navigation Buttons */
.lq-tour-buttons {
    display: flex;
    gap: 8px;
}

.lq-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
}

.lq-tour-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.lq-tour-btn-primary {
    background: linear-gradient(135deg, #4361ee 0%, #38b000 100%);
    border: none;
    color: white;
}

.lq-tour-btn-primary:hover {
    background: linear-gradient(135deg, #364dd0 0%, #2e9600 100%);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.35);
    transform: translateY(-1px);
}

.lq-tour-btn i {
    font-size: 0.75rem;
}

/* ========================================
   HELP/TOUR BUTTON
   ======================================== */

.leanquest-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    background: white;
    color: var(--lq-tour-primary);
    border: 1px solid var(--lq-tour-border);
    cursor: pointer;
    transition: all 0.2s;
}

.leanquest-tour-btn:hover {
    background: rgba(67, 97, 238, 0.08);
    border-color: var(--lq-tour-primary);
    transform: translateY(-1px);
}

.leanquest-tour-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.leanquest-tour-btn i {
    color: var(--lq-tour-primary);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes lq-tour-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lq-tour-tooltip {
    animation: lq-tour-fade-in 0.3s ease forwards;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .lq-tour-tooltip {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0;
        transform: none !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    }

    .lq-tour-tooltip::before {
        display: none;
    }

    .lq-tour-tooltip-header {
        padding: 14px 20px;
        border-radius: 20px 20px 0 0;
    }

    .lq-tour-tooltip-content {
        padding: 20px;
        max-height: 45vh;
        overflow-y: auto;
    }

    .lq-tour-tooltip-footer {
        padding: 16px 20px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        flex-wrap: wrap;
        gap: 12px;
    }

    .lq-tour-progress {
        order: 2;
        width: 100%;
        justify-content: center;
    }

    .lq-tour-buttons {
        order: 1;
        width: 100%;
        justify-content: space-between;
    }

    .lq-tour-btn {
        flex: 1;
        justify-content: center;
        padding: 12px 16px;
    }

    .leanquest-tour-btn span {
        display: none;
    }

    .leanquest-tour-btn {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .lq-tour-title {
        font-size: 1rem;
    }

    .lq-tour-description {
        font-size: 0.875rem;
    }

    .lq-tour-btn {
        padding: 10px 12px;
        font-size: 0.8125rem;
    }

    .lq-tour-tooltip-content {
        max-height: 40vh;
    }
}

/* ========================================
   HIGH CONTRAST / REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .lq-tour-tooltip,
    .lq-tour-highlight,
    .lq-tour-btn {
        animation: none;
        transition: none;
    }
}

@media (prefers-contrast: high) {
    .lq-tour-highlight {
        border-width: 4px;
    }

    .lq-tour-tooltip {
        border: 2px solid var(--lq-tour-primary);
    }
}
