/**
 * voice-onboarding.css
 * Premium dark-themed styles for Torki Voice Onboarding experience
 */

/* ========================================
   BASE OVERLAY
======================================== */

.voice-onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000001; /* Must be higher than #voiceModal (z-index: 999999) */
    background: rgba(0, 0, 0, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.voice-onboarding-overlay.hidden {
    display: none;
    opacity: 0;
}

.voice-onboarding-overlay.fade-out {
    opacity: 0;
}

/* ========================================
   PHASE CONTAINERS
======================================== */

.onboarding-phase {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out, transform 0.4s ease-out;
}

.onboarding-phase.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ========================================
   SKIP BUTTON (All Phases)
======================================== */

.onboarding-skip-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    padding: 8px 20px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 10;
}

.onboarding-skip-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.35);
    color: rgba(255, 255, 255, 0.9);
}

/* ========================================
   PHASE 1: CINEMATIC INTRO
======================================== */

.onboarding-phase1-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

/* Logo Container */
.onboarding-logo-container {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    margin-bottom: 40px;
}

.onboarding-logo-container.animate-in {
    opacity: 1;
    transform: scale(1);
}

.onboarding-logo-container.fade-away {
    opacity: 0;
    transform: scale(0.9);
    position: absolute;
    pointer-events: none;
}

.onboarding-logo {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.15));
}

.onboarding-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-logo-text {
    font-size: 56px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Avatar Showcase */
.onboarding-avatar-showcase {
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 32px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.5s ease-out 0.2s, transform 0.5s ease-out 0.2s;
}

.onboarding-avatar-showcase.animate-in {
    opacity: 1;
    transform: scale(1);
}

.onboarding-avatar-glow {
    position: absolute;
    inset: -30px;
    background: radial-gradient(circle, var(--glow-color, rgba(255,255,255,0.4)) 0%, transparent 70%);
    opacity: 0.2;
    filter: blur(25px);
    animation: glowPulse 3s ease-in-out infinite;
    border-radius: 50%;
}

.onboarding-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Intro Text */
.onboarding-intro-text {
    text-align: center;
    margin-bottom: 32px;
}

.onboarding-title {
    font-size: 42px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.onboarding-title.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.onboarding-subtitle {
    font-size: 18px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.onboarding-subtitle.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Audio Indicator */
.onboarding-audio-indicator {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 32px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.onboarding-audio-indicator.playing {
    opacity: 1;
}

.onboarding-audio-indicator .audio-bar {
    width: 4px;
    background: linear-gradient(to top, rgba(255,255,255,0.5), rgba(255,255,255,0.9));
    border-radius: 2px;
    animation: audioBar 0.6s ease-in-out infinite;
}

.onboarding-audio-indicator .audio-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.onboarding-audio-indicator .audio-bar:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.onboarding-audio-indicator .audio-bar:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.onboarding-audio-indicator .audio-bar:nth-child(4) { height: 16px; animation-delay: 0.3s; }
.onboarding-audio-indicator .audio-bar:nth-child(5) { height: 8px; animation-delay: 0.4s; }

/* ========================================
   PHASE 2: MICROPHONE PERMISSION
======================================== */

.onboarding-phase2-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 420px;
}

.onboarding-permission-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 48px 40px;
    text-align: center;
    transform: translateY(40px);
    opacity: 0;
    animation: slideUpFade 0.5s ease-out 0.2s forwards;
}

.onboarding-mic-icon-wrap {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-mic-pulse {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: micPulse 2s ease-out infinite;
}

.onboarding-mic-icon {
    color: #fff;
    z-index: 2;
}

.onboarding-permission-title {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 16px;
    letter-spacing: -0.02em;
}

.onboarding-permission-desc {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.55);
    margin: 0 0 32px;
}

.onboarding-permission-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.onboarding-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    background: #ffffff;
    border: none;
    border-radius: 14px;
    color: #0a0a0a;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
}

.onboarding-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 255, 255, 0.25);
}

.onboarding-btn-primary:active {
    transform: translateY(0);
}

.onboarding-btn-primary.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.onboarding-btn-secondary {
    padding: 14px 32px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.onboarding-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* ========================================
   PHASE 3: VOICE CAROUSEL
======================================== */

.onboarding-voices-header {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 48px;
    letter-spacing: -0.02em;
    text-align: center;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.1s forwards;
}

.onboarding-carousel-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100%;
    max-width: 500px;
    margin-bottom: 32px;
}

/* Carousel Arrows */
.onboarding-carousel-arrow {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.onboarding-carousel-arrow:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
    transform: scale(1.05);
}

.onboarding-carousel-arrow:active {
    transform: scale(0.98);
}

/* Character Card */
.onboarding-character-card {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px 32px 36px;
    text-align: center;
    min-width: 280px;
    max-width: 320px;
    flex: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.onboarding-character-card.card-transitioning {
    opacity: 0.3;
    transform: scale(0.98);
}

/* Card Glow */
.onboarding-card-glow {
    position: absolute;
    inset: -40px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
    transition: background 0.4s ease;
}

/* Card Avatar */
.onboarding-card-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    z-index: 1;
}

.onboarding-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Speaking Ring */
.onboarding-speaking-ring {
    position: absolute;
    inset: -8px;
    border: 3px solid transparent;
    border-radius: 50%;
    opacity: 0;
    transform: scale(1);
    transition: opacity 0.3s ease, border-color 0.3s ease;
}

.onboarding-speaking-ring.active {
    opacity: 1;
    animation: speakingPulse 1.2s ease-out infinite;
}

/* Card Speaker Icon */
.onboarding-card-speaker {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.onboarding-card-speaker.active {
    opacity: 1;
    transform: scale(1);
}

/* Card Text */
.onboarding-card-name {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 1;
}

.onboarding-card-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.65);
    margin: 0 0 8px;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

.onboarding-card-specialty {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    font-style: italic;
    position: relative;
    z-index: 1;
}

/* Dot Pagination */
.onboarding-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.onboarding-dot:hover {
    background: rgba(255, 255, 255, 0.45);
}

.onboarding-dot.active {
    width: 10px;
    height: 10px;
    background: #fff;
}

/* Let's Go Button */
.onboarding-btn-start {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 48px;
    background: #ffffff;
    border: none;
    border-radius: 9999px;
    color: #0a0a0a;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 28px rgba(255, 255, 255, 0.2);
}

.onboarding-btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 40px rgba(255, 255, 255, 0.3);
}

.onboarding-btn-start:active {
    transform: scale(1.02);
}

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

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.25;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.08);
    }
}

@keyframes audioBar {
    0%, 100% {
        transform: scaleY(0.4);
    }
    50% {
        transform: scaleY(1);
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes micPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes speakingPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.12);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

@media (max-width: 640px) {
    .onboarding-phase {
        padding: 16px;
    }

    .onboarding-skip-btn {
        top: 16px;
        right: 16px;
        padding: 6px 16px;
        font-size: 13px;
    }

    /* Phase 1 Mobile */
    .onboarding-logo {
        width: 140px;
    }

    .onboarding-logo-text {
        font-size: 42px;
    }

    .onboarding-avatar-showcase {
        width: 120px;
        height: 120px;
        margin-bottom: 24px;
    }

    .onboarding-title {
        font-size: 32px;
    }

    .onboarding-subtitle {
        font-size: 16px;
    }

    /* Phase 2 Mobile */
    .onboarding-permission-card {
        padding: 36px 24px;
        border-radius: 20px;
    }

    .onboarding-mic-icon-wrap {
        width: 80px;
        height: 80px;
        margin-bottom: 24px;
    }

    .onboarding-mic-icon {
        width: 40px;
        height: 40px;
    }

    .onboarding-permission-title {
        font-size: 22px;
    }

    .onboarding-permission-desc {
        font-size: 14px;
    }

    /* Phase 3 Mobile */
    .onboarding-voices-header {
        font-size: 26px;
        margin-bottom: 32px;
    }

    .onboarding-carousel-area {
        gap: 12px;
    }

    .onboarding-carousel-arrow {
        width: 40px;
        height: 40px;
    }

    .onboarding-carousel-arrow svg {
        width: 20px;
        height: 20px;
    }

    .onboarding-character-card {
        padding: 32px 24px 28px;
        min-width: 240px;
        max-width: 280px;
        border-radius: 20px;
    }

    .onboarding-card-avatar {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }

    .onboarding-card-name {
        font-size: 20px;
    }

    .onboarding-card-desc {
        font-size: 14px;
    }

    .onboarding-card-specialty {
        font-size: 12px;
    }

    .onboarding-dots {
        margin-bottom: 32px;
    }

    .onboarding-btn-start {
        padding: 16px 40px;
        font-size: 16px;
    }
}

@media (max-width: 380px) {
    .onboarding-carousel-arrow {
        display: none;
    }

    .onboarding-character-card {
        min-width: 100%;
        max-width: 100%;
    }
}
