/* =========================================
   ONBOARDING — Welcome Modal & Guided Tour
   ========================================= */

/* --- Welcome Modal Overlay --- */
.welcome-modal {
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.welcome-modal.welcome-visible .welcome-modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.welcome-modal-content {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    width: 90%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(20px) scale(0.97);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Scrollbar styling for the modal */
.welcome-modal-content::-webkit-scrollbar {
    width: 6px;
}
.welcome-modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.welcome-modal-content::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

/* --- Header --- */
.welcome-header {
    text-align: center;
    padding: var(--space-8) var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(255, 183, 123, 0.06) 0%, transparent 100%);
}

.welcome-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-lg);
    background: rgba(255, 183, 123, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 183, 123, 0.2);
    box-shadow: 0 0 30px rgba(255, 183, 123, 0.1);
}

.welcome-logo img {
    width: 40px;
    height: 40px;
}

.welcome-header h1 {
    font-family: var(--font-family-display);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin: 0 0 var(--space-2);
    letter-spacing: -0.02em;
}

.welcome-subtitle {
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
    margin: 0;
    line-height: var(--line-height-normal);
}

/* --- Sections --- */
.welcome-section {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.welcome-section:last-of-type {
    border-bottom: none;
}

.welcome-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.welcome-section-header .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-primary);
}

.welcome-section-header h2 {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
    margin: 0;
}

/* --- Tour Button (CTA) --- */
.welcome-tour-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, rgba(255, 183, 123, 0.12) 0%, rgba(255, 183, 123, 0.06) 100%);
    border: 1px solid rgba(255, 183, 123, 0.25);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-text-primary);
    text-align: left;
    font-family: var(--font-family);
}

.welcome-tour-btn:hover {
    background: linear-gradient(135deg, rgba(255, 183, 123, 0.2) 0%, rgba(255, 183, 123, 0.1) 100%);
    border-color: rgba(255, 183, 123, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 183, 123, 0.15);
}

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

.welcome-tour-icon {
    font-size: 28px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.welcome-tour-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.welcome-tour-text strong {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.welcome-tour-text span {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
}

.welcome-tour-arrow {
    font-size: 20px;
    color: var(--color-primary);
    opacity: 0.6;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.welcome-tour-btn:hover .welcome-tour-arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* --- Template Cards Grid --- */
.welcome-templates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.welcome-template-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.welcome-template-card:hover,
.welcome-template-card:focus-visible {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 183, 123, 0.1);
}

.welcome-template-card:active {
    transform: translateY(0);
}

.welcome-template-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(255, 183, 123, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.welcome-template-icon .material-symbols-outlined {
    font-size: 22px;
    color: var(--color-primary);
}

.welcome-template-info {
    flex: 1;
    min-width: 0;
}

.welcome-template-info h3 {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcome-template-info p {
    font-size: 10px;
    color: var(--color-text-tertiary);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Footer --- */
.welcome-footer {
    padding: var(--space-3) var(--space-5) var(--space-4);
    text-align: center;
}

.welcome-skip-btn {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-xs);
    font-family: var(--font-family);
    cursor: pointer;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.welcome-skip-btn:hover {
    color: var(--color-text-secondary);
    background: var(--color-bg-hover);
}

/* =========================================
   Driver.js Custom Theme Overrides
   ========================================= */

.driver-popover.driverjs-theme-custom {
    background: var(--color-bg-elevated) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
    color: var(--color-text-primary) !important;
    font-family: var(--font-family) !important;
    max-width: 340px !important;
}

.driver-popover.driverjs-theme-custom .driver-popover-title {
    font-family: var(--font-family) !important;
    font-size: var(--font-size-lg) !important;
    font-weight: var(--font-weight-bold) !important;
    color: var(--color-text-primary) !important;
    line-height: var(--line-height-tight) !important;
    margin-bottom: var(--space-2) !important;
}

.driver-popover.driverjs-theme-custom .driver-popover-description {
    font-size: var(--font-size-sm) !important;
    color: var(--color-text-secondary) !important;
    line-height: var(--line-height-relaxed) !important;
}

.driver-popover.driverjs-theme-custom .driver-popover-progress-text {
    font-size: var(--font-size-xs) !important;
    color: var(--color-text-tertiary) !important;
}

.driver-popover.driverjs-theme-custom .driver-popover-prev-btn {
    background: var(--color-bg-tertiary) !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-text-primary) !important;
    border-radius: var(--radius-md) !important;
    font-family: var(--font-family) !important;
    font-size: var(--font-size-sm) !important;
    font-weight: var(--font-weight-medium) !important;
    padding: 6px 14px !important;
    cursor: pointer !important;
    text-shadow: none !important;
}

.driver-popover.driverjs-theme-custom .driver-popover-prev-btn:hover {
    background: var(--color-bg-hover) !important;
    border-color: var(--color-primary) !important;
}

.driver-popover.driverjs-theme-custom .driver-popover-next-btn,
.driver-popover.driverjs-theme-custom .driver-popover-close-btn-text {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary)) !important;
    border: none !important;
    color: white !important;
    border-radius: var(--radius-md) !important;
    font-family: var(--font-family) !important;
    font-size: var(--font-size-sm) !important;
    font-weight: var(--font-weight-semibold) !important;
    padding: 6px 14px !important;
    cursor: pointer !important;
    text-shadow: none !important;
    box-shadow: 0 2px 8px rgba(255, 183, 123, 0.2) !important;
}

.driver-popover.driverjs-theme-custom .driver-popover-next-btn:hover,
.driver-popover.driverjs-theme-custom .driver-popover-close-btn-text:hover {
    box-shadow: 0 4px 16px rgba(255, 183, 123, 0.35) !important;
}

.driver-popover.driverjs-theme-custom .driver-popover-arrow-side-left.driver-popover-arrow {
    border-left-color: var(--color-bg-elevated) !important;
}
.driver-popover.driverjs-theme-custom .driver-popover-arrow-side-right.driver-popover-arrow {
    border-right-color: var(--color-bg-elevated) !important;
}
.driver-popover.driverjs-theme-custom .driver-popover-arrow-side-top.driver-popover-arrow {
    border-top-color: var(--color-bg-elevated) !important;
}
.driver-popover.driverjs-theme-custom .driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-bottom-color: var(--color-bg-elevated) !important;
}

/* =========================================
   Light Theme Overrides
   ========================================= */

[data-theme="light"] .welcome-modal {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .welcome-modal-content {
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .welcome-header {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.04) 0%, transparent 100%);
}

[data-theme="light"] .welcome-logo {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.05);
}

[data-theme="light"] .welcome-tour-btn {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .welcome-tour-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14) 0%, rgba(59, 130, 246, 0.08) 100%);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .welcome-template-icon {
    background: rgba(59, 130, 246, 0.06);
}

[data-theme="light"] .welcome-template-card:hover,
[data-theme="light"] .welcome-template-card:focus-visible {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .driver-popover.driverjs-theme-custom {
    background: #ffffff !important;
    border-color: #E5E7EB !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .driver-popover.driverjs-theme-custom .driver-popover-next-btn,
[data-theme="light"] .driver-popover.driverjs-theme-custom .driver-popover-close-btn-text {
    background: linear-gradient(135deg, #2563EB, #3B82F6) !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2) !important;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 600px) {
    .welcome-modal-content {
        max-width: 95%;
    }

    .welcome-templates-grid {
        grid-template-columns: 1fr;
    }

    .welcome-header h1 {
        font-size: var(--font-size-xl);
    }
}
