/* ============================================================================
   Speech Voice Styles
   - Mic button for dictation
   - Voice mode button
   - Voice overlay (full-screen ChatGPT-style)
   - Orb animations
   ============================================================================ */

/* ---- Mic Button (Dictation) ---- */

.btn-mic {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: #fff;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    padding: 0;
}

.btn-mic:hover {
    background: #f8fafc;
    color: #dc3545;
    border-color: #fecaca;
}

.btn-mic.recording {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
    animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
}

/* ---- Voice Mode Button ---- */

.btn-voice-mode {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: #fff;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    padding: 0;
}

.btn-voice-mode:hover {
    background: #f8fafc;
    color: #dc3545;
    border-color: #fecaca;
}

/* ---- Voice Mode Overlay ---- */

.voice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: rgba(18, 18, 30, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.voice-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ---- Orb ---- */

.voice-orb-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 32px;
}

.voice-orb {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #e8434d, #dc3545, #a71d2a);
    box-shadow: 0 0 60px rgba(220, 53, 69, 0.3), 0 0 120px rgba(220, 53, 69, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Listening state -- gentle pulse */
.voice-overlay.state-listening .voice-orb {
    animation: orb-listen 2s ease-in-out infinite;
}

@keyframes orb-listen {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 60px rgba(220, 53, 69, 0.3), 0 0 120px rgba(220, 53, 69, 0.1);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 80px rgba(220, 53, 69, 0.5), 0 0 160px rgba(220, 53, 69, 0.2);
    }
}

/* Processing state -- rotating ring */
.voice-overlay.state-processing .voice-orb {
    animation: orb-process 1.2s linear infinite;
    box-shadow: 0 0 40px rgba(220, 53, 69, 0.4), 0 0 80px rgba(220, 53, 69, 0.2);
}

@keyframes orb-process {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.02); }
    100% { transform: scale(0.95); }
}

.voice-orb-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(220, 53, 69, 0.6);
    border-right-color: rgba(220, 53, 69, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.voice-overlay.state-processing .voice-orb-ring {
    opacity: 1;
    animation: orb-ring-spin 1s linear infinite;
}

@keyframes orb-ring-spin {
    to { transform: rotate(360deg); }
}

/* Speaking state -- expands with audio */
.voice-overlay.state-speaking .voice-orb {
    animation: orb-speak 0.8s ease-in-out infinite alternate;
    box-shadow: 0 0 80px rgba(220, 53, 69, 0.5), 0 0 160px rgba(220, 53, 69, 0.2);
}

@keyframes orb-speak {
    0% { transform: scale(1); }
    100% { transform: scale(1.12); }
}

/* ---- Overlay Text ---- */

.voice-status {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
    min-height: 1.4em;
}

.voice-transcript {
    color: #adb5bd;
    font-size: 0.95rem;
    font-style: italic;
    max-width: 500px;
    text-align: center;
    min-height: 1.4em;
    margin-bottom: 40px;
    line-height: 1.5;
    padding: 0 20px;
    word-wrap: break-word;
}

/* ---- End Button ---- */

.voice-end-btn {
    padding: 10px 32px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50px;
    background: transparent;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.voice-end-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
}

/* ---- Speaker Icon on Messages ---- */

.btn-speak-message {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.btn-speak-message:hover {
    color: #dc3545;
}

.btn-speak-message.speaking {
    color: #dc3545;
    animation: speaker-pulse 1s ease-in-out infinite;
}

@keyframes speaker-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---- Chatbot panel specific sizing ---- */

.chatbot-input-wrapper .btn-mic,
.chatbot-input-wrapper .btn-voice-mode {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
}
