/**
 * Voice Overlay CSS — Light Glassmorphism Panel
 * Uses project CSS variables for consistent theming
 */

/* ═══════════════════════════════════════
   FLOATING MIC TOGGLE BUTTON
   ═══════════════════════════════════════ */

.voice-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--chat-button-bg, #da002d);
    color: var(--chat-button-color, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.voice-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--chat-button-bg-hover, #959da6);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.voice-toggle-btn:active {
    transform: scale(0.95);
}

.voice-toggle-btn.active {
    background: var(--chat-button-bg, #da002d);
    box-shadow: 0 4px 20px rgba(218, 0, 45, 0.3);
    animation: voicePulse 1.5s infinite;
}

@keyframes voicePulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); }
    50% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 12px rgba(218, 0, 45, 0.08); }
}

/* ═══════════════════════════════════════
   OVERLAY CONTAINER
   ═══════════════════════════════════════ */

.voice-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.voice-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.voice-overlay.active .voice-overlay-backdrop {
    opacity: 1;
}

/* ═══════════════════════════════════════
   OVERLAY PANEL — Light Glassmorphism
   ═══════════════════════════════════════ */

.voice-overlay-panel {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(32px) saturate(1.6);
    -webkit-backdrop-filter: blur(32px) saturate(1.6);
    border-radius: 20px 20px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-bottom: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.1), 0 -2px 16px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.voice-overlay.active .voice-overlay-panel {
    transform: translateY(0);
}

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */

.voice-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: none;
    background: var(--bg-welcome, #3e4e61);
    border-radius: 20px 20px 0 0;
}

.voice-overlay-title {
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-welcome, #ffffff);
    display: flex;
    align-items: center;
    gap: 8px;
}


.voice-overlay-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-overlay-voice-select {
    height: 36px;
    padding: 0 22px 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-welcome, #fff);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='white'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    box-sizing: border-box;
}

.voice-overlay-voice-select:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.voice-overlay-voice-select option {
    background: var(--bg-welcome, #3e4e61);
    color: #fff;
}

.voice-overlay-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-welcome, #ffffff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-overlay-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* ═══════════════════════════════════════
   CHAT LOG (inside overlay)
   ═══════════════════════════════════════ */

.voice-overlay-chat {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    max-height: 55vh;
    scroll-behavior: smooth;
}

.voice-overlay-chat .vc-message {
    display: flex;
    animation: voSlideIn 0.3s ease-out;
}

.voice-overlay-chat .vc-bot { justify-content: flex-start; }
.voice-overlay-chat .vc-user { justify-content: flex-end; }

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

.voice-overlay-chat .vc-msg-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Bot bubbles: solid for readability */
.voice-overlay-chat .vc-bot .vc-msg-bubble {
    background: var(--bg-user-message, #f5f7fa);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 4px;
    color: #1e293b;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* User bubbles: solid accent color */
.voice-overlay-chat .vc-user .vc-msg-bubble {
    background: var(--bg-welcome, #3e4e61);
    border-bottom-right-radius: 4px;
    color: var(--color-welcome, #fff);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Streaming indicators */
.voice-overlay-chat .vc-bot-streaming .vc-msg-bubble {
    border-left: 3px solid var(--chat-button-bg, #da002d);
    background: var(--bg-user-message, #f5f7fa);
}

.voice-overlay-chat .vc-user-streaming .vc-msg-bubble {
    opacity: 0.7;
    font-style: italic;
}

/* ═══════════════════════════════════════
   CONTROLS (bottom of overlay)
   ═══════════════════════════════════════ */

.voice-overlay-controls {
    padding: 12px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.voice-overlay-waveform {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
}

.voice-overlay-status {
    font-family: inherit;
    font-size: 13px;
    color: var(--gruen, #2c3d52);
    text-align: center;
    opacity: 0.7;
}

.voice-overlay-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.voice-overlay-mute,
.voice-overlay-stop {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.3);
    color: var(--gruen, #2c3d52);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.voice-overlay-mute:hover,
.voice-overlay-stop:hover {
    background: rgba(255, 255, 255, 0.5);
}

.voice-overlay-mute.muted {
    background: rgba(218, 0, 45, 0.08);
    border-color: rgba(218, 0, 45, 0.2);
    color: var(--rot, #da002d);
}

.voice-overlay-stop {
    background: rgba(218, 0, 45, 0.06);
    border-color: rgba(218, 0, 45, 0.12);
    color: var(--rot, #da002d);
}

.voice-overlay-stop:hover {
    background: rgba(218, 0, 45, 0.12);
}

/* ═══════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════ */

.voice-overlay-chat::-webkit-scrollbar { width: 5px; }
.voice-overlay-chat::-webkit-scrollbar-track { background: transparent; }
.voice-overlay-chat::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb-bg, rgba(0, 0, 0, 0.15));
    border-radius: 3px;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 600px) {
    .voice-overlay-panel {
        max-width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
    }

    .voice-toggle-btn {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
}

/* Loading dots animation */
.vc-loading-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px !important;
    min-height: auto !important;
}

.vc-loading-dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #6b7280;
    opacity: 0.4;
    animation: vc-dot-pulse 1.2s ease-in-out infinite;
}

.vc-loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.vc-loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes vc-dot-pulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1.1); }
}
