/**
 * Tour CSS - Styles for guided tour overlay
 */

/* Tour Overlay Container */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10002;
    pointer-events: none;
}

.tour-overlay > * {
    pointer-events: auto;
}

/* SVG Backdrop */
.tour-backdrop-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: auto;
}

/* Simple backdrop fallback */
.tour-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

/* Highlight ring around target element */
.tour-highlight-ring {
    position: fixed;
    border: 2px solid var(--ct-accent, #5B4FC4);
    border-radius: var(--ct-radius, 2px);
    box-shadow: 
        0 0 0 4px rgba(91, 79, 196, 0.3),
        0 0 20px rgba(91, 79, 196, 0.5);
    animation: pulseRing 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulseRing {
    0%, 100% {
        box-shadow: 
            0 0 0 4px rgba(91, 79, 196, 0.3),
            0 0 20px rgba(91, 79, 196, 0.5);
    }
    50% {
        box-shadow: 
            0 0 0 8px rgba(91, 79, 196, 0.2),
            0 0 30px rgba(91, 79, 196, 0.4);
    }
}

/* Tour Tooltip */
.tour-tooltip {
    background: linear-gradient(180deg, #2A2A2A 0%, #222222 100%);
    border: 1px solid rgba(91, 79, 196, 0.25);
    border-radius: var(--ct-radius, 2px);
    padding: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    box-shadow: 
        0 16px 64px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(91, 79, 196, 0.15);
    animation: tooltipEnter 0.3s ease-out;
    z-index: 10003;
}

.tour-tooltip-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes tooltipEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tour-tooltip-center {
    animation-name: tooltipEnterCenter;
}

@keyframes tooltipEnterCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Progress bar */
.tour-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--ct-radius, 2px) var(--ct-radius, 2px) 0 0;
    overflow: hidden;
}

.tour-progress-bar {
    height: 100%;
    background: var(--ct-accent, #5B4FC4);
    transition: width 0.3s ease-out;
}

/* Step counter */
.tour-step-counter {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

/* Title */
.tour-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px 0;
}

/* Content */
.tour-content {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin: 0 0 20px 0;
    white-space: pre-line;
}

/* Icon in warning dialogs */
.tour-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 12px;
}

.tour-icon.warning {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* External link */
.tour-external-link {
    display: inline-block;
    color: var(--ct-accent, #5B4FC4);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: rgba(91, 79, 196, 0.1);
    border-radius: var(--ct-radius, 2px);
    transition: all 0.2s ease;
}

.tour-external-link:hover {
    background: rgba(91, 79, 196, 0.2);
    color: #7B6FD4;
}

/* Buttons */
.tour-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.tour-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--ct-radius, 2px);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-btn.primary {
    background: var(--ct-accent, #5B4FC4);
    color: #fff;
    flex: 1;
    min-width: 100px;
}

.tour-btn.primary:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 16px rgba(91, 79, 196, 0.35);
}

.tour-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tour-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.tour-btn.danger {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    color: #fff;
}

.tour-btn.danger:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 16px rgba(248, 113, 113, 0.25);
}

/* Skip button */
.tour-skip-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}

.tour-skip-btn:hover {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: underline;
}

/* Position-specific arrow indicators */
.tour-position-top::after,
.tour-position-bottom::after,
.tour-position-left::after,
.tour-position-right::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 10px solid transparent;
}

.tour-position-top::after {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: #222222;
}

.tour-position-bottom::after {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: #2A2A2A;
}

.tour-position-left::after {
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: #222222;
}

.tour-position-right::after {
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: #2A2A2A;
}

/* Responsive */
@media (max-width: 480px) {
    .tour-tooltip {
        width: calc(100vw - 32px);
        padding: 20px;
        position: fixed !important;
        bottom: 16px !important;
        left: 16px !important;
        right: 16px !important;
        top: auto !important;
        transform: none !important;
    }

    .tour-title {
        font-size: 1.1rem;
    }

    .tour-content {
        font-size: 0.9rem;
    }

    .tour-buttons {
        flex-direction: column;
    }

    .tour-btn {
        width: 100%;
    }

    .tour-skip-btn {
        margin: 8px auto 0;
    }
}

/* =====================================================
   INTERACTIVE TOUR STYLES - Advanced tour with animations
   ===================================================== */

.interactive-tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 10100;
    pointer-events: none;
}

.interactive-tour-overlay > * {
    pointer-events: auto;
}

/* Zoom effect on body when tour is active */
.interactive-tour-overlay.tour-anim-spotlight {
    --zoom-level: 1;
    --zoom-origin-x: 50%;
    --zoom-origin-y: 50%;
}

/* Tour Tooltip */
.interactive-tour-overlay .tour-tooltip {
    background: linear-gradient(180deg, #2E2E2E 0%, #242424 50%, #1A1A1A 100%);
    border: 1px solid rgba(91, 79, 196, 0.3);
    border-radius: var(--ct-radius, 2px);
    padding: 28px;
    box-shadow: 
        0 0 0 1px rgba(91, 79, 196, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(91, 79, 196, 0.1);
    animation: interactiveTourEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes interactiveTourEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Progress bar */
.interactive-tour-overlay .tour-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--ct-radius, 2px) var(--ct-radius, 2px) 0 0;
    overflow: hidden;
}

.interactive-tour-overlay .tour-progress-fill {
    height: 100%;
    background: var(--ct-accent, #5B4FC4);
    transition: width 0.5s ease-out;
}

/* Step counter */
.interactive-tour-overlay .tour-step-counter {
    font-size: 0.75rem;
    color: rgba(91, 79, 196, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    font-weight: 500;
}

/* Title */
.interactive-tour-overlay .tour-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 16px 0;
    line-height: 1.3;
}

/* Content */
.interactive-tour-overlay .tour-content {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
    margin-bottom: 20px;
}

.interactive-tour-overlay .tour-content p {
    margin: 0 0 8px 0;
}

.interactive-tour-overlay .tour-content p:last-child {
    margin-bottom: 0;
}

/* Hint */
.interactive-tour-overlay .tour-hint {
    background: rgba(91, 79, 196, 0.12);
    border: 1px solid rgba(91, 79, 196, 0.25);
    border-radius: var(--ct-radius, 2px);
    padding: 12px 16px;
    font-size: 0.9rem;
    color: #9B93D7;
    margin-bottom: 16px;
}

/* Completed indicator */
.interactive-tour-overlay .tour-completed {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--ct-radius, 2px);
    padding: 12px 16px;
    font-size: 0.95rem;
    color: #6EE7B7;
    margin-bottom: 16px;
    font-weight: 500;
}

/* Sample button */
.interactive-tour-overlay .tour-sample-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 16px;
    background: rgba(91, 79, 196, 0.1);
    border: 1px dashed rgba(91, 79, 196, 0.4);
    border-radius: var(--ct-radius, 2px);
    color: #9B93D7;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.interactive-tour-overlay .tour-sample-btn:hover {
    background: rgba(91, 79, 196, 0.18);
    border-color: rgba(91, 79, 196, 0.6);
}

/* Navigation */
.interactive-tour-overlay .tour-nav {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.interactive-tour-overlay .tour-nav-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--ct-radius, 2px);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.interactive-tour-overlay .tour-nav-btn.back {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.interactive-tour-overlay .tour-nav-btn.back:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.interactive-tour-overlay .tour-nav-btn.skip {
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    padding: 8px 16px;
}

.interactive-tour-overlay .tour-nav-btn.skip:hover {
    color: rgba(255, 255, 255, 0.6);
}

.interactive-tour-overlay .tour-nav-btn.primary {
    background: var(--ct-accent, #5B4FC4);
    color: #fff;
    flex: 1;
    min-width: 120px;
}

.interactive-tour-overlay .tour-nav-btn.primary:hover:not(.disabled) {
    filter: brightness(1.15);
    box-shadow: 0 4px 16px rgba(91, 79, 196, 0.35);
}

.interactive-tour-overlay .tour-nav-btn.primary.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(91, 79, 196, 0.3);
}

.interactive-tour-overlay .tour-nav-btn.finish {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.interactive-tour-overlay .tour-nav-btn.finish:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

/* Spotlight effect */
.tour-spotlight-effect {
    position: fixed;
    z-index: 10101;
    pointer-events: none;
}

.spotlight-ring {
    position: absolute;
    inset: 0;
    border-radius: var(--ct-radius, 2px);
    border: 2px solid rgba(91, 79, 196, 0.8);
}

.spotlight-ring-1 {
    animation: spotlightPulse1 2s ease-in-out infinite;
}

.spotlight-ring-2 {
    border-color: rgba(91, 79, 196, 0.5);
    animation: spotlightPulse2 2s ease-in-out infinite;
}

.spotlight-ring-3 {
    border-color: rgba(91, 79, 196, 0.2);
    animation: spotlightPulse3 2s ease-in-out infinite;
}

@keyframes spotlightPulse1 {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes spotlightPulse2 {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 0.5; }
}

@keyframes spotlightPulse3 {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.15); opacity: 0.2; }
}

/* Feature grid */
.interactive-tour-overlay .tour-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.interactive-tour-overlay .tour-feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--ct-radius, 2px);
    animation: featureSlideIn 0.4s ease-out backwards;
}

@keyframes featureSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.interactive-tour-overlay .tour-feature-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.interactive-tour-overlay .tour-feature-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.interactive-tour-overlay .tour-feature-text strong {
    color: #fff;
    font-size: 0.9rem;
}

.interactive-tour-overlay .tour-feature-text span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

/* Choices */
.interactive-tour-overlay .tour-choices {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.interactive-tour-overlay .tour-choice-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--ct-radius, 2px);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.interactive-tour-overlay .tour-choice-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.interactive-tour-overlay .tour-choice-btn.primary {
    background: var(--ct-accent, #5B4FC4);
    color: #fff;
    border: none;
}

.interactive-tour-overlay .tour-choice-btn.primary:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 16px rgba(91, 79, 196, 0.35);
}

/* Confetti */
.interactive-tour-overlay .tour-confetti {
    position: absolute;
    inset: -100px;
    overflow: hidden;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        top: -10%;
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        top: 110%;
        transform: rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

/* Waiting spinner */
.interactive-tour-overlay .tour-waiting {
    text-align: center;
    padding: 40px;
    background: rgba(42, 42, 42, 0.97);
    border-radius: var(--ct-radius, 2px);
    border: 1px solid rgba(91, 79, 196, 0.25);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.interactive-tour-overlay .tour-waiting-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(91, 79, 196, 0.2);
    border-top-color: var(--ct-accent, #5B4FC4);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.interactive-tour-overlay .tour-waiting-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.interactive-tour-overlay .tour-waiting-subtext {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin: 0;
}

/* Complete tooltip styling */
.interactive-tour-overlay .tour-tooltip.complete {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 
        0 0 0 1px rgba(16, 185, 129, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(16, 185, 129, 0.1);
}

/* Animation classes */
.tour-transitioning .tour-tooltip {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95) !important;
}

.tour-anim-fade-zoom .tour-tooltip {
    animation: fadeZoomIn 0.4s ease-out;
}

@keyframes fadeZoomIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.tour-anim-slide-in .tour-tooltip {
    animation: slideInFromRight 0.4s ease-out;
}

@keyframes slideInFromRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.tour-anim-bounce .tour-spotlight-effect .spotlight-ring {
    animation: bounceRing 0.6s ease-out;
}

@keyframes bounceRing {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.tour-anim-celebrate .tour-tooltip {
    animation: celebrate 0.5s ease-out;
}

@keyframes celebrate {
    0% { transform: translate(-50%, -50%) scale(0.8) rotate(-3deg); }
    50% { transform: translate(-50%, -50%) scale(1.05) rotate(2deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
}

/* Responsive for interactive tour */
@media (max-width: 640px) {
    .interactive-tour-overlay .tour-tooltip {
        max-width: calc(100vw - 24px);
        padding: 20px;
    }

    .interactive-tour-overlay .tour-title {
        font-size: 1.25rem;
    }

    .interactive-tour-overlay .tour-feature-grid {
        grid-template-columns: 1fr;
    }

    .interactive-tour-overlay .tour-nav {
        flex-direction: column;
    }

    .interactive-tour-overlay .tour-nav-btn {
        width: 100%;
    }

    .interactive-tour-overlay .tour-choices {
        flex-direction: column;
    }
}
