/**
 * AIGOS Tour Styling
 * Custom luxury theme for Driver.js tours
 */

/* Tour Overlay - lighter so content is readable */
.driver-overlay {
    background: rgba(10, 14, 39, 0.4) !important;
    backdrop-filter: none;
}

/* Highlighted Element Stage */
.driver-active-element {
    box-shadow: 0 0 0 4px rgba(123, 104, 238, 0.5),
                0 0 30px rgba(123, 104, 238, 0.3) !important;
    border-radius: 8px;
}

/* Popover Container */
.driver-popover {
    background: rgba(15, 23, 42, 0.98) !important;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(123, 104, 238, 0.3) !important;
    border-radius: 16px !important;
    box-shadow: 0 0 0 1px rgba(123, 104, 238, 0.1),
                0 20px 50px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(123, 104, 238, 0.15) !important;
    max-width: 380px !important;
    padding: 0 !important;
    overflow: hidden;
}

/* Custom class for AIGOS tours */
.aigos-tour-popover {
    animation: tourPopoverEnter 0.3s ease-out;
}

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

/* Popover Arrow */
.driver-popover-arrow {
    border-color: rgba(15, 23, 42, 0.98) !important;
}

.driver-popover-arrow-side-left {
    border-left-color: rgba(15, 23, 42, 0.98) !important;
}

.driver-popover-arrow-side-right {
    border-right-color: rgba(15, 23, 42, 0.98) !important;
}

.driver-popover-arrow-side-top {
    border-top-color: rgba(15, 23, 42, 0.98) !important;
}

.driver-popover-arrow-side-bottom {
    border-bottom-color: rgba(15, 23, 42, 0.98) !important;
}

/* Title Section */
.driver-popover-title {
    background: linear-gradient(135deg, rgba(123, 104, 238, 0.15) 0%, rgba(255, 107, 53, 0.1) 100%);
    padding: 18px 20px 12px !important;
    margin: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    background-clip: padding-box;
    -webkit-background-clip: padding-box;
    color: #fff !important;
    letter-spacing: -0.01em;
}

/* Gradient text for title */
.driver-popover-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: linear-gradient(135deg, #7B68EE 0%, #FF6B35 100%);
    border-radius: 2px;
    margin-right: 10px;
    vertical-align: middle;
}

/* Description */
.driver-popover-description {
    padding: 16px 20px !important;
    color: #9CA3AF !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    margin: 0 !important;
}

/* Progress Indicator */
.driver-popover-progress-text {
    color: #6B7280 !important;
    font-size: 0.8rem !important;
    padding: 0 20px 12px !important;
    font-weight: 500;
}

/* Footer with Buttons */
.driver-popover-footer {
    padding: 12px 20px 16px !important;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Navigation Buttons */
.driver-popover-prev-btn,
.driver-popover-next-btn {
    padding: 10px 20px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    border: none !important;
}

/* Previous Button */
.driver-popover-prev-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #9CA3AF !important;
}

.driver-popover-prev-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    transform: translateX(-2px);
}

/* Next Button */
.driver-popover-next-btn {
    background: linear-gradient(135deg, #7B68EE 0%, #6B5BCD 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(123, 104, 238, 0.3) !important;
}

.driver-popover-next-btn:hover {
    background: linear-gradient(135deg, #8B7BF0 0%, #7B68EE 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 104, 238, 0.4) !important;
}

/* Close Button */
.driver-popover-close-btn {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    border-radius: 8px !important;
    color: #9CA3AF !important;
    font-size: 18px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.driver-popover-close-btn:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #EF4444 !important;
    transform: rotate(90deg);
}

/* Progress Bar (if using) */
.driver-popover-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 20px 12px;
    overflow: hidden;
}

.driver-popover-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7B68EE 0%, #FF6B35 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Tour Start Button (for pages) */
.tour-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(123, 104, 238, 0.2) 0%, rgba(255, 107, 53, 0.15) 100%);
    border: 1px solid rgba(123, 104, 238, 0.3);
    border-radius: 10px;
    color: #E0E0E0;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tour-start-btn:hover {
    background: linear-gradient(135deg, rgba(123, 104, 238, 0.3) 0%, rgba(255, 107, 53, 0.2) 100%);
    border-color: rgba(123, 104, 238, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(123, 104, 238, 0.2);
    color: #fff;
}

.tour-start-btn i,
.tour-start-btn .icon {
    font-size: 1.1em;
}

/* Pulsing indicator for tour trigger */
.tour-indicator {
    position: relative;
}

.tour-indicator::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #7B68EE;
    border-radius: 50%;
    animation: tourPulse 2s ease-in-out infinite;
}

@keyframes tourPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* Welcome Modal Styles */
.welcome-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 39, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.welcome-modal {
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(123, 104, 238, 0.3);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 0 1px rgba(123, 104, 238, 0.1),
                0 30px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.4s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.welcome-modal-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #7B68EE 0%, #FF6B35 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 24px;
    box-shadow: 0 8px 30px rgba(123, 104, 238, 0.3);
}

.welcome-modal h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #7B68EE 0%, #FF6B35 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-modal p {
    color: #9CA3AF;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

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

.welcome-modal-btn {
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.welcome-modal-btn.primary {
    background: linear-gradient(135deg, #7B68EE 0%, #6B5BCD 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(123, 104, 238, 0.3);
}

.welcome-modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(123, 104, 238, 0.4);
}

.welcome-modal-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #9CA3AF;
}

.welcome-modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

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

/* Tablet breakpoint (768px) */
@media (max-width: 768px) {
    /* Viewport-aware popover */
    .driver-popover {
        max-width: calc(100vw - 32px) !important;
        margin: 16px !important;
    }

    /* Larger close button for touch (44px minimum) */
    .driver-popover-close-btn {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
        top: 8px !important;
        right: 8px !important;
    }

    /* Touch-friendly navigation buttons (48px height) */
    .driver-popover-prev-btn,
    .driver-popover-next-btn {
        min-height: 48px !important;
        padding: 14px 24px !important;
        font-size: 1rem !important;
    }

    /* More space for footer buttons */
    .driver-popover-footer {
        padding: 14px 20px 18px !important;
        flex-wrap: wrap;
    }

    /* Title adjustments for touch */
    .driver-popover-title {
        padding-right: 52px !important; /* Room for close button */
    }

    /* Tour start button - larger touch target */
    .tour-start-btn {
        padding: 14px 20px;
        min-height: 48px;
    }

    /* Welcome modal - larger touch targets */
    .welcome-modal-btn {
        min-height: 52px;
        padding: 16px 24px;
    }
}

/* Small phone breakpoint (480px) */
@media (max-width: 480px) {
    /* Full-width popover on small screens */
    .driver-popover {
        max-width: calc(100vw - 24px) !important;
        margin: 12px !important;
        border-radius: 12px !important;
    }

    /* Smaller title on mobile */
    .driver-popover-title {
        font-size: 1rem !important;
        padding: 14px 16px 10px !important;
        padding-right: 52px !important;
    }

    /* Title indicator smaller */
    .driver-popover-title::before {
        width: 3px;
        height: 14px;
        margin-right: 8px;
    }

    /* Compact description */
    .driver-popover-description {
        font-size: 0.9rem !important;
        padding: 12px 16px !important;
        line-height: 1.5 !important;
    }

    /* Compact progress text */
    .driver-popover-progress-text {
        font-size: 0.75rem !important;
        padding: 0 16px 10px !important;
    }

    /* Footer - buttons side by side */
    .driver-popover-footer {
        padding: 12px 16px 16px !important;
        gap: 8px;
    }

    /* Buttons - equal width on mobile */
    .driver-popover-prev-btn,
    .driver-popover-next-btn {
        flex: 1;
        justify-content: center;
        text-align: center;
        padding: 12px 16px !important;
    }

    /* Welcome modal - bottom sheet style */
    .welcome-modal-overlay {
        align-items: flex-end;
    }

    .welcome-modal {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 32px 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        margin: 0;
        animation: modalSlideUpMobile 0.4s ease;
    }

    @keyframes modalSlideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .welcome-modal-icon {
        width: 64px;
        height: 64px;
        font-size: 2rem;
        margin-bottom: 20px;
    }

    .welcome-modal h2 {
        font-size: 1.4rem;
    }

    .welcome-modal p {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }

    .welcome-modal-actions {
        gap: 10px;
    }

    .welcome-modal-btn {
        width: 100%;
        min-height: 52px;
    }

    /* Tour start buttons - full width on small screens */
    .tour-start-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Extra small phones (320px) */
@media (max-width: 360px) {
    .driver-popover {
        max-width: calc(100vw - 16px) !important;
        margin: 8px !important;
    }

    .driver-popover-title {
        font-size: 0.95rem !important;
    }

    .driver-popover-description {
        font-size: 0.85rem !important;
    }

    .driver-popover-prev-btn,
    .driver-popover-next-btn {
        padding: 10px 12px !important;
        font-size: 0.9rem !important;
    }
}

/* Safe area support for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .driver-popover {
            padding-bottom: env(safe-area-inset-bottom, 0px);
        }

        .welcome-modal {
            padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        }
    }
}

/* Landscape orientation on mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .driver-popover {
        max-width: 50vw !important;
    }

    .welcome-modal {
        max-height: 90vh;
        overflow-y: auto;
    }

    .welcome-modal-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
        margin-bottom: 12px;
    }

    .welcome-modal h2 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .welcome-modal p {
        font-size: 0.9rem;
        margin-bottom: 16px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .aigos-tour-popover,
    .welcome-modal,
    .tour-indicator::after {
        animation: none !important;
    }

    .driver-popover-prev-btn:hover,
    .driver-popover-next-btn:hover,
    .driver-popover-close-btn:hover,
    .tour-start-btn:hover,
    .welcome-modal-btn:hover {
        transform: none !important;
    }
}
