/**
 * styles/walkthrough.css — PharmAssist Interactive Walkthrough
 *
 * Full-screen overlay walkthrough with What's New + Feature Showcase.
 * Uses only existing CSS custom properties. Dark/light theme compatible.
 */

/* ============================================================
   OVERLAY & CONTAINER
   ============================================================ */

#walkthrough-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overscroll-behavior: contain;
}

#walkthrough-overlay.wt-active {
    display: flex;
    animation: wt-fade-in 0.35s ease forwards;
}

@keyframes wt-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#walkthrough-overlay.wt-closing {
    animation: wt-fade-out 0.25s ease forwards;
}

@keyframes wt-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ============================================================
   MODAL WINDOW
   ============================================================ */

.wt-modal {
    position: relative;
    width: min(860px, 95vw);
    max-height: 92vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), var(--shadow-glow);
}

/* Animated gradient top border */
.wt-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 2px;
    background: var(--accent-gradient);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   HEADER
   ============================================================ */

.wt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-tertiary);
    gap: 12px;
}

.wt-logo {
    font-size: 22px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    flex-shrink: 0;
}

.wt-step-counter {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.wt-close-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.wt-close-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */

.wt-progress-bar-track {
    height: 4px;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.wt-progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    transition: width 0.4s ease;
    border-radius: 0 2px 2px 0;
}

/* ============================================================
   BODY LAYOUT (sidebar TOC + slide content)
   ============================================================ */

.wt-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Sidebar / TOC ── */

.wt-toc {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 12px 0;
    background: var(--bg-card);
}

.wt-toc-section {
    padding: 6px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.wt-toc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 16px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    text-align: left;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wt-toc-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.wt-toc-item.wt-toc-active {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.06);
    font-weight: 600;
}

.wt-toc-icon {
    font-size: 15px;
    flex-shrink: 0;
}

/* ── Slide area ── */

.wt-slides-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.wt-slide-viewport {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* ============================================================
   SLIDES
   ============================================================ */

.wt-slide {
    display: none;
    padding: 32px 36px;
    animation: wt-slide-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    min-height: 100%;
}

.wt-slide.wt-slide-visible {
    display: block;
}

.wt-slide.wt-slide-back {
    animation: wt-slide-in-back 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes wt-slide-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes wt-slide-in-back {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .wt-slide,
    .wt-slide.wt-slide-back {
        animation: none;
    }
    .wt-progress-bar-fill {
        transition: none;
    }
}

/* ── Intro / splash slide ── */

.wt-intro-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 380px;
    padding: 48px 36px;
    position: relative;
    overflow: visible;
}

/* Restore flex layout when the intro slide is made visible */
.wt-slide.wt-slide-visible.wt-intro-slide {
    display: flex;
}

.wt-intro-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 55% at 50% 50%, rgba(0, 212, 255, 0.12) 0%, transparent 70%),
                radial-gradient(ellipse 60% 45% at 50% 100%, rgba(124, 58, 237, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.wt-intro-emoji {
    font-size: 64px;
    margin-bottom: 16px;
    display: block;
    animation: wt-bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

@keyframes wt-bounce-in {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

.wt-intro-title {
    font-size: 32px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    line-height: 1.15;
}

.wt-intro-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.wt-intro-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── What's New section slide ── */

.wt-section-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.wt-slide-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.25;
}

.wt-slide-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* What's New cards grid */
.wt-whats-new-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}

.wt-new-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.wt-new-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 14px 14px 0 0;
}

.wt-new-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.wt-new-card-icon {
    font-size: 28px;
    line-height: 1;
}

.wt-new-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.wt-new-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.wt-new-card-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
    margin-top: 4px;
    transition: gap 0.2s;
}

.wt-new-card-link:hover {
    gap: 8px;
}

/* NEW badge pill */
.wt-new-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--accent-gradient);
    color: #fff;
    padding: 2px 7px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 6px;
}

/* ── Feature slide ── */

.wt-feature-hero {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.wt-feature-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    flex-shrink: 0;
}

.wt-feature-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.2;
}

.wt-feature-tagline {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.wt-feature-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.wt-feature-how-to,
.wt-feature-benefit {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
}

.wt-feature-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wt-feature-how-to .wt-feature-section-label {
    color: var(--accent-primary);
}

.wt-feature-benefit .wt-feature-section-label {
    color: var(--success);
}

.wt-how-to-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wt-how-to-steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.wt-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.wt-benefit-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.wt-benefit-text strong {
    color: var(--text-primary);
}

.wt-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    padding: 10px 20px;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.wt-open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.35);
}

/* ── Completion / finale slide ── */

.wt-finale-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 360px;
    padding: 48px 36px;
    position: relative;
    overflow: hidden;
}

.wt-finale-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.wt-finale-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 20px;
    animation: wt-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    color: var(--success);
}

@keyframes wt-pop-in {
    from { opacity: 0; transform: scale(0.3); }
    to   { opacity: 1; transform: scale(1); }
}

.wt-finale-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.wt-finale-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 440px;
    line-height: 1.6;
    margin-bottom: 28px;
}

.wt-finale-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.wt-finale-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.wt-finale-link:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

/* ── Confetti ── */

.wt-confetti-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 24px;
}

/* ============================================================
   FOOTER NAVIGATION
   ============================================================ */

.wt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-tertiary);
    gap: 12px;
}

.wt-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.wt-nav-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-secondary);
}

.wt-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.wt-nav-btn.wt-btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
}

.wt-nav-btn.wt-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 212, 255, 0.35);
}

.wt-skip-link {
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 4px 0;
    transition: color 0.2s;
}

.wt-skip-link:hover {
    color: var(--text-secondary);
}

/* ============================================================
   TILE "NEW" NOTIFICATION DOT
   ============================================================ */

.wt-tile-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 20px;
    animation: wt-badge-pulse 2s ease-in-out infinite;
}

.wt-nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: wt-badge-pulse 2s ease-in-out infinite;
}

@keyframes wt-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.5); }
    50%       { box-shadow: 0 0 0 6px rgba(0, 212, 255, 0); }
}

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

@media (max-width: 680px) {
    .wt-modal {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .wt-toc {
        display: none;
    }

    .wt-slide {
        padding: 20px 18px;
    }

    .wt-intro-slide,
    .wt-finale-slide {
        padding: 32px 18px;
        min-height: 280px;
    }

    .wt-intro-title {
        font-size: 24px;
    }

    .wt-feature-body {
        grid-template-columns: 1fr;
    }

    .wt-feature-hero {
        flex-direction: column;
        gap: 12px;
    }

    .wt-whats-new-grid {
        grid-template-columns: 1fr;
    }

    .wt-footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wt-nav-btn {
        padding: 9px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .wt-header {
        padding: 12px 16px 10px;
    }

    .wt-logo {
        font-size: 18px;
    }

    .wt-intro-emoji {
        font-size: 48px;
    }

    .wt-intro-actions {
        flex-direction: column;
        width: 100%;
    }

    .wt-intro-actions .wt-nav-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   LIGHT MODE OVERRIDES
   ============================================================ */

body.light-mode .wt-modal {
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.2), 0 0 40px rgba(0, 212, 255, 0.08);
}

body.light-mode .wt-new-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body.light-mode .wt-close-btn:hover {
    background: var(--bg-secondary);
}
