/**
 * ENEA Live Voice — Styles
 * Real-time voice conversation interface
 *
 * @package ScopriGaeta_Pro
 * @since   8.1.0
 */

/* ─── VOICE TOGGLE BUTTON ──────────────────────────────── */

.enea-voice-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(183, 28, 28, 0.3);
    background: rgba(183, 28, 28, 0.08);
    color: #B71C1C;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.enea-voice-toggle:hover {
    background: rgba(183, 28, 28, 0.15);
    border-color: rgba(183, 28, 28, 0.5);
    transform: scale(1.08);
}

.enea-voice-toggle.active {
    background: #B71C1C;
    border-color: #B71C1C;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(183, 28, 28, 0.2);
}

.enea-voice-toggle.active:hover {
    background: #d32f2f;
}

.enea-voice-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.enea-voice-toggle .mic-icon { display: block; }
.enea-voice-toggle .stop-icon { display: none; }
.enea-voice-toggle.active .mic-icon { display: none; }
.enea-voice-toggle.active .stop-icon { display: block; }

/* ─── VOICE OVERLAY ────────────────────────────────────── */

.enea-voice-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.96);
    backdrop-filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.enea-voice-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ─── VOICE AVATAR ─────────────────────────────────────── */

.enea-voice-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 32px;
}

.enea-voice-avatar-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #B71C1C, #d32f2f);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 40px rgba(183, 28, 28, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

.enea-voice-avatar-circle svg {
    width: 48px;
    height: 48px;
    fill: white;
}

/* Pulse ring for listening state */
.enea-voice-avatar-pulse {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(183, 28, 28, 0.4);
    animation: none;
}

[data-voice-state="listening"] .enea-voice-avatar-pulse {
    animation: voice-pulse 2s ease-in-out infinite;
}

[data-voice-state="speaking"] .enea-voice-avatar-circle {
    transform: scale(1.05);
}

[data-voice-state="processing"] .enea-voice-avatar-circle {
    animation: voice-processing 1s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.15);
        opacity: 0;
    }
}

@keyframes voice-processing {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ─── WAVEFORM VISUALIZER ──────────────────────────────── */

.enea-voice-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 48px;
    margin-bottom: 24px;
}

.enea-voice-waveform-bar {
    width: 4px;
    height: 8px;
    border-radius: 2px;
    background: rgba(183, 28, 28, 0.5);
    transition: height 0.1s ease;
}

[data-voice-state="listening"] .enea-voice-waveform-bar,
[data-voice-state="speaking"] .enea-voice-waveform-bar {
    background: #B71C1C;
    animation: waveform-idle 1.2s ease-in-out infinite;
}

.enea-voice-waveform-bar:nth-child(1) { animation-delay: 0s; }
.enea-voice-waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.enea-voice-waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.enea-voice-waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.enea-voice-waveform-bar:nth-child(5) { animation-delay: 0.4s; }
.enea-voice-waveform-bar:nth-child(6) { animation-delay: 0.3s; }
.enea-voice-waveform-bar:nth-child(7) { animation-delay: 0.2s; }
.enea-voice-waveform-bar:nth-child(8) { animation-delay: 0.1s; }
.enea-voice-waveform-bar:nth-child(9) { animation-delay: 0s; }

@keyframes waveform-idle {
    0%, 100% { height: 8px; }
    50% { height: 32px; }
}

[data-voice-state="speaking"] .enea-voice-waveform-bar {
    animation-name: waveform-speaking;
    animation-duration: 0.6s;
}

@keyframes waveform-speaking {
    0%, 100% { height: 12px; }
    25% { height: 40px; }
    50% { height: 20px; }
    75% { height: 36px; }
}

/* ─── STATUS TEXT ───────────────────────────────────────── */

.enea-voice-status {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    transition: color 0.3s ease;
    letter-spacing: 0.02em;
}

[data-voice-state="listening"] .enea-voice-status {
    color: rgba(255, 255, 255, 0.8);
}

[data-voice-state="speaking"] .enea-voice-status {
    color: #ef9a9a;
}

/* ─── TRANSCRIPT ───────────────────────────────────────── */

.enea-voice-transcript {
    max-width: 480px;
    padding: 0 24px;
    text-align: center;
    margin-bottom: 32px;
    min-height: 48px;
}

.enea-voice-transcript-text {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s ease;
}

.enea-voice-transcript-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.enea-voice-transcript-text.user {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* ─── SESSION TIMER ────────────────────────────────────── */

.enea-voice-timer {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 32px;
}

.enea-voice-timer.warning {
    color: #ff8a80;
}

/* ─── CLOSE BUTTON ─────────────────────────────────────── */

.enea-voice-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.enea-voice-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.enea-voice-close svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ─── STATE INDICATOR (INLINE IN CHAT) ─────────────────── */

.enea-voice-inline-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    background: rgba(183, 28, 28, 0.1);
    color: #B71C1C;
    font-size: 12px;
    font-weight: 500;
}

.enea-voice-inline-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #B71C1C;
    animation: dot-blink 1.5s ease-in-out infinite;
}

@keyframes dot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ─── UNSUPPORTED BROWSER MESSAGE ──────────────────────── */

.enea-voice-unsupported {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    padding: 16px;
}

/* ─── RESPONSIVE ───────────────────────────────────────── */

@media (max-width: 600px) {
    .enea-voice-avatar {
        width: 96px;
        height: 96px;
    }

    .enea-voice-avatar-circle svg {
        width: 36px;
        height: 36px;
    }

    .enea-voice-transcript {
        padding: 0 16px;
    }

    .enea-voice-transcript-text {
        font-size: 15px;
    }
}
