/**
 * ═══════════════════════════════════════════════════════════════
 * AKIRA AI — Voice Module Styles (voice.css)
 * ─────────────────────────────────────────────────────────────
 * NEW file. Does NOT modify style.css or any existing styles.
 * Contains:
 *   • Live Voice Call Modal (#liveVoiceUI)
 *   • Animated waveform
 *   • Glowing mic pulse
 *   • Dictate mode indicator
 *   • Chat input voice icons
 *   • Full responsive design (360px+)
 * ═══════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════
   CSS VARIABLES (scoped to voice module)
   ═══════════════════════════════════════════════════════════════ */
:root {
    --vx-bg: rgba(10, 10, 18, 0.97);
    --vx-surface: rgba(22, 22, 38, 0.85);
    --vx-accent: #6c5ce7;
    --vx-accent-light: #a29bfe;
    --vx-accent-glow: rgba(108, 92, 231, 0.4);
    --vx-green: #00cec9;
    --vx-green-glow: rgba(0, 206, 201, 0.35);
    --vx-red: #ff6b6b;
    --vx-text: #f0f0f5;
    --vx-text-muted: rgba(240, 240, 245, 0.55);
    --vx-border: rgba(255, 255, 255, 0.08);
    --vx-radius: 20px;
    --vx-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ═══════════════════════════════════════════════════════════════
   1. LIVE VOICE UI MODAL (#liveVoiceUI)
   ═══════════════════════════════════════════════════════════════ */
#liveVoiceUI {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vx-bg);
    backdrop-filter: blur(30px) saturate(1.6);
    -webkit-backdrop-filter: blur(30px) saturate(1.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--vx-font);
}

#liveVoiceUI.vx-visible {
    opacity: 1;
    visibility: visible;
}

/* ── Modal Card ── */
.vx-modal {
    position: relative;
    width: 92%;
    max-width: 420px;
    background: linear-gradient(170deg, rgba(30, 28, 55, 0.92) 0%, rgba(14, 14, 26, 0.96) 100%);
    border: 1px solid var(--vx-border);
    border-radius: var(--vx-radius);
    padding: 32px 28px 28px;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 120px var(--vx-accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow: hidden;
}

#liveVoiceUI.vx-visible .vx-modal {
    transform: scale(1) translateY(0);
}

/* Glossy top highlight */
.vx-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(108, 92, 231, 0.5) 30%,
            rgba(162, 155, 254, 0.7) 50%,
            rgba(108, 92, 231, 0.5) 70%,
            transparent 100%);
}

/* ── Header ── */
.vx-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.vx-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(108, 92, 231, 0.12);
    border: 1px solid rgba(108, 92, 231, 0.25);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: var(--vx-accent-light);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.vx-header-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--vx-green);
    box-shadow: 0 0 8px var(--vx-green-glow);
    animation: vxDotPulse 1.8s ease-in-out infinite;
}

@keyframes vxDotPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.7);
    }
}

.vx-live-tag {
    font-size: 10px;
    font-weight: 700;
    color: var(--vx-green);
    letter-spacing: 1.2px;
}

/* ── Timer ── */
.vx-timer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--vx-text-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.vx-timer-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--vx-red);
    animation: vxDotPulse 1s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════
   2. ANIMATED WAVEFORM
   ═══════════════════════════════════════════════════════════════ */
.vx-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 50px;
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
}

.vx-wave-bar {
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--vx-accent-light), var(--vx-accent));
    height: 8px;
    animation: vxWaveIdle 1.5s ease-in-out infinite;
    transform-origin: center bottom;
}

#liveVoiceUI.vx-speaking .vx-wave-bar {
    animation: vxWaveActive 0.4s ease-in-out infinite alternate;
}

.vx-wave-bar:nth-child(1) {
    animation-delay: 0s;
}

.vx-wave-bar:nth-child(2) {
    animation-delay: 0.08s;
}

.vx-wave-bar:nth-child(3) {
    animation-delay: 0.16s;
}

.vx-wave-bar:nth-child(4) {
    animation-delay: 0.24s;
}

.vx-wave-bar:nth-child(5) {
    animation-delay: 0.32s;
}

.vx-wave-bar:nth-child(6) {
    animation-delay: 0.40s;
}

.vx-wave-bar:nth-child(7) {
    animation-delay: 0.48s;
}

.vx-wave-bar:nth-child(8) {
    animation-delay: 0.40s;
}

.vx-wave-bar:nth-child(9) {
    animation-delay: 0.32s;
}

.vx-wave-bar:nth-child(10) {
    animation-delay: 0.24s;
}

.vx-wave-bar:nth-child(11) {
    animation-delay: 0.16s;
}

.vx-wave-bar:nth-child(12) {
    animation-delay: 0.08s;
}

.vx-wave-bar:nth-child(13) {
    animation-delay: 0s;
}

.vx-wave-bar:nth-child(14) {
    animation-delay: 0.08s;
}

.vx-wave-bar:nth-child(15) {
    animation-delay: 0.16s;
}

@keyframes vxWaveIdle {

    0%,
    100% {
        height: 6px;
        opacity: 0.4;
    }

    50% {
        height: 14px;
        opacity: 0.7;
    }
}

@keyframes vxWaveActive {
    0% {
        height: 8px;
    }

    100% {
        height: 42px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   3. MIC BUTTON WITH GLOW PULSE
   ═══════════════════════════════════════════════════════════════ */
.vx-mic-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
}

/* Glow rings */
.vx-mic-glow {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px solid rgba(108, 92, 231, 0.15);
    opacity: 0;
    transition: opacity 0.4s ease;
}

#liveVoiceUI.vx-speaking .vx-mic-glow {
    opacity: 1;
    animation: vxMicGlow 1.6s ease-out infinite;
}

.vx-mic-glow:nth-child(2) {
    inset: -24px;
    animation-delay: 0.4s !important;
    border-color: rgba(108, 92, 231, 0.08);
}

@keyframes vxMicGlow {
    0% {
        transform: scale(0.85);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Main mic button */
.vx-mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--vx-accent) 0%, #8b5cf6 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 24px var(--vx-accent-glow),
        0 0 0 4px rgba(108, 92, 231, 0.12);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    z-index: 2;
}

.vx-mic-btn:hover {
    transform: scale(1.05);
    box-shadow:
        0 6px 32px var(--vx-accent-glow),
        0 0 0 6px rgba(108, 92, 231, 0.18);
}

.vx-mic-btn:active {
    transform: scale(0.95);
}

.vx-mic-btn svg {
    width: 32px;
    height: 32px;
}

/* When speaking — green glow */
#liveVoiceUI.vx-speaking .vx-mic-btn {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    box-shadow:
        0 4px 30px var(--vx-green-glow),
        0 0 0 4px rgba(0, 206, 201, 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   4. SUBTITLE AREA
   ═══════════════════════════════════════════════════════════════ */
.vx-subtitle-area {
    width: 100%;
    min-height: 42px;
    text-align: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--vx-border);
}

.vx-subtitle-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--vx-text-muted);
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: color 0.3s ease;
}

#liveVoiceUI.vx-speaking .vx-subtitle-text {
    color: var(--vx-text);
}

/* ═══════════════════════════════════════════════════════════════
   5. END CALL BUTTON
   ═══════════════════════════════════════════════════════════════ */
.vx-end-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 100px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--vx-font);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.vx-end-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 28px rgba(231, 76, 60, 0.45);
}

.vx-end-btn:active {
    transform: scale(0.96);
}

.vx-end-btn svg {
    width: 16px;
    height: 16px;
}

/* Timer limit note */
.vx-limit-note {
    font-size: 11px;
    color: var(--vx-text-muted);
    letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════════
   6. VOICE STOPPED POPUP
   ═══════════════════════════════════════════════════════════════ */
#voiceStoppedPopup {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid var(--vx-border);
    border-radius: 14px;
    padding: 12px 24px;
    font-family: var(--vx-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--vx-text);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 8px;
}

#voiceStoppedPopup.vx-popup-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   7. CHAT INPUT VOICE ICONS
   ═══════════════════════════════════════════════════════════════ */
#vxInputIcons {
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
}

.vx-input-icon-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--vx-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.vx-input-icon-btn:hover {
    background: rgba(108, 92, 231, 0.12);
    color: var(--vx-accent-light);
}

.vx-input-icon-btn:active {
    transform: scale(0.9);
}

.vx-input-icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Voice call icon pulse */
.vx-call-icon-btn {
    position: relative;
}

.vx-call-icon-btn::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid var(--vx-accent);
    opacity: 0;
    animation: vxCallPulse 2s ease-in-out infinite;
}

@keyframes vxCallPulse {

    0%,
    100% {
        opacity: 0;
        transform: scale(0.8);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.15);
    }
}

/* [PATCH] Temporarily hide live call button without removing DOM element */
.vx-call-hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   8. DICTATE MODE INDICATOR
   ═══════════════════════════════════════════════════════════════ */
#vxDictateIndicator {
    position: absolute;
    top: -32px;
    left: 0;
    right: 0;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 5px 14px;
    background: rgba(108, 92, 231, 0.12);
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 10px 10px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--vx-accent-light);
    font-family: var(--vx-font);
    letter-spacing: 0.3px;
    z-index: 4;
}

#vxDictateIndicator.vx-dictating {
    display: flex;
}

.vx-dictate-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--vx-red);
    animation: vxDotPulse 0.9s ease-in-out infinite;
}

.vx-dictate-stop-btn {
    margin-left: 8px;
    padding: 2px 10px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 6px;
    background: rgba(255, 107, 107, 0.1);
    color: var(--vx-red);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--vx-font);
    transition: background 0.2s ease;
}

.vx-dictate-stop-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   9. CLOSE BUTTON (top-right of modal)
   ═══════════════════════════════════════════════════════════════ */
.vx-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--vx-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
    z-index: 10;
}

.vx-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--vx-text);
}

.vx-close-btn svg {
    width: 16px;
    height: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   10. DECORATIVE AMBIENT PARTICLES
   ═══════════════════════════════════════════════════════════════ */
.vx-ambient {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.vx-ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
}

.vx-ambient-orb:nth-child(1) {
    width: 200px;
    height: 200px;
    background: var(--vx-accent);
    top: -60px;
    left: -40px;
    animation: vxOrbFloat 8s ease-in-out infinite;
}

.vx-ambient-orb:nth-child(2) {
    width: 150px;
    height: 150px;
    background: var(--vx-green);
    bottom: -40px;
    right: -30px;
    animation: vxOrbFloat 10s ease-in-out infinite reverse;
}

.vx-ambient-orb:nth-child(3) {
    width: 100px;
    height: 100px;
    background: #e17055;
    top: 50%;
    right: 10%;
    animation: vxOrbFloat 12s ease-in-out infinite 2s;
}

@keyframes vxOrbFloat {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(20px, -15px);
    }

    50% {
        transform: translate(-10px, 20px);
    }

    75% {
        transform: translate(15px, 10px);
    }
}

/* ═══════════════════════════════════════════════════════════════
   11. LIGHT MODE OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
[data-theme="light"] #liveVoiceUI,
:root:not([data-theme="dark"]) #liveVoiceUI {
    /* Keep dark for voice UI always — it's a modal overlay */
    background: var(--vx-bg);
}

[data-theme="light"] #vxInputIcons .vx-input-icon-btn,
[data-theme="light"] #vxDictateIndicator {
    color: #555;
}

[data-theme="light"] #vxInputIcons .vx-input-icon-btn:hover {
    background: rgba(108, 92, 231, 0.08);
    color: var(--vx-accent);
}

[data-theme="light"] #vxDictateIndicator {
    background: rgba(108, 92, 231, 0.06);
    border-color: rgba(108, 92, 231, 0.12);
    color: var(--vx-accent);
}

/* ═══════════════════════════════════════════════════════════════
   12. MOBILE RESPONSIVE (360px+)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .vx-modal {
        width: 96%;
        max-width: none;
        padding: 24px 18px 22px;
        border-radius: 16px;
        gap: 16px;
    }

    .vx-mic-container {
        width: 88px;
        height: 88px;
    }

    .vx-mic-btn {
        width: 72px;
        height: 72px;
    }

    .vx-mic-btn svg {
        width: 28px;
        height: 28px;
    }

    .vx-waveform {
        max-width: 220px;
        height: 40px;
    }

    .vx-wave-bar {
        width: 3px;
    }

    @keyframes vxWaveActive {
        0% {
            height: 6px;
        }

        100% {
            height: 32px;
        }
    }

    .vx-header-badge {
        font-size: 11px;
        padding: 5px 12px;
    }

    .vx-subtitle-text {
        font-size: 13px;
    }

    .vx-end-btn {
        padding: 10px 22px;
        font-size: 13px;
    }

    #vxInputIcons {
        right: 46px;
        gap: 2px;
    }

    .vx-input-icon-btn {
        width: 30px;
        height: 30px;
    }

    .vx-input-icon-btn svg {
        width: 16px;
        height: 16px;
    }

    #vxDictateIndicator {
        font-size: 11px;
        padding: 4px 10px;
        top: -28px;
    }

    #voiceStoppedPopup {
        bottom: 80px;
        font-size: 13px;
        padding: 10px 18px;
    }
}

@media (max-width: 360px) {
    .vx-modal {
        width: 98%;
        padding: 20px 14px 18px;
        gap: 14px;
    }

    .vx-mic-container {
        width: 78px;
        height: 78px;
    }

    .vx-mic-btn {
        width: 64px;
        height: 64px;
    }

    .vx-mic-btn svg {
        width: 24px;
        height: 24px;
    }

    .vx-waveform {
        max-width: 180px;
        height: 34px;
        gap: 2px;
    }

    .vx-wave-bar {
        width: 2.5px;
    }

    .vx-header-badge {
        font-size: 10px;
        padding: 4px 10px;
        gap: 6px;
    }

    .vx-subtitle-area {
        padding: 6px 8px;
    }

    .vx-subtitle-text {
        font-size: 12px;
    }

    #vxInputIcons {
        right: 42px;
    }

    .vx-input-icon-btn {
        width: 28px;
        height: 28px;
    }
}