/* Voice Agent Widget — Retirement Planner */

/* Voice FAB — positioned left of chat FAB (24px right + 56px width + 8px gap = 88px) */
.voice-fab {
    position: fixed;
    bottom: 80px;
    right: 88px;
    width: 56px;
    height: 56px;
    padding: 0;
    box-sizing: border-box;
    border-radius: 50%;
    background: var(--accent, #c45d3e);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='2' width='6' height='12' rx='3'/%3E%3Cpath d='M5 10a7 7 0 0 0 14 0'/%3E%3Cline x1='12' y1='19' x2='12' y2='22'/%3E%3Cline x1='8' y1='22' x2='16' y2='22'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.voice-fab:hover {
    transform: scale(1.08);
}

.voice-fab.recording {
    animation: voicePulse 1.2s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(196, 93, 62, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(196, 93, 62, 0.8), 0 0 0 8px rgba(196, 93, 62, 0.2); }
}

/* Voice Panel */
.voice-panel {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 400px;
    height: 460px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--sans, 'Outfit', sans-serif);
}

.voice-panel.open {
    display: flex;
}

/* Panel Header */
.voice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--accent, #c45d3e);
    color: #fff;
    flex-shrink: 0;
}

.voice-header-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.voice-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--sans, 'Outfit', sans-serif);
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

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

/* Messages Area */
.voice-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.voice-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-wrap: break-word;
}

.voice-message.user {
    align-self: flex-end;
    background: var(--accent, #c45d3e);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.voice-message.assistant {
    align-self: flex-start;
    background: #f0f0ec;
    color: var(--ink, #1a1a1a);
    border-bottom-left-radius: 4px;
}

.voice-message.error {
    align-self: center;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.85rem;
    text-align: center;
    max-width: 90%;
}

/* Processing indicator — dots reuse chatBounce from chat-widget.css */
.voice-typing {
    align-self: flex-start;
    padding: 10px 18px;
    background: #f0f0ec;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: none;
}

.voice-typing.visible {
    display: flex;
    gap: 5px;
    align-items: center;
}

.voice-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted, #8a8478);
    animation: chatBounce 1.2s infinite ease-in-out;
}

.voice-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.voice-typing-dot:nth-child(3) { animation-delay: 0.3s; }

/* Controls Area (mic button + status) */
.voice-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 16px;
    border-top: 1px solid var(--divider, rgba(26, 26, 26, 0.08));
    gap: 8px;
    flex-shrink: 0;
}

.voice-mic-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent, #c45d3e);
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(196, 93, 62, 0.3);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='2' width='6' height='12' rx='3'/%3E%3Cpath d='M5 10a7 7 0 0 0 14 0'/%3E%3Cline x1='12' y1='19' x2='12' y2='22'/%3E%3Cline x1='8' y1='22' x2='16' y2='22'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
}

.voice-mic-btn:hover:not(:disabled) {
    transform: scale(1.06);
}

.voice-mic-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-mic-btn.listening {
    animation: voicePulse 1.2s ease-in-out infinite;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Crect x='5' y='5' width='14' height='14' rx='2'/%3E%3C/svg%3E");
}

.voice-mic-btn.speaking {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'/%3E%3C/svg%3E");
}

.voice-status-text {
    font-size: 0.82rem;
    color: var(--muted, #8a8478);
    text-align: center;
}

/* Text fallback (Firefox + mic-denied) */
.voice-text-fallback {
    display: none;
    flex-direction: row;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--divider, rgba(26, 26, 26, 0.08));
    align-items: flex-end;
    flex-shrink: 0;
}

.voice-text-fallback.visible {
    display: flex;
}

.voice-text-input {
    flex: 1 1 0%;
    min-width: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: var(--sans, 'Outfit', sans-serif);
    resize: none;
    outline: none;
    max-height: 80px;
    line-height: 1.4;
    box-sizing: border-box;
}

.voice-text-input:focus {
    border-color: var(--accent, #c45d3e);
}

.voice-text-send {
    flex: 0 0 auto;
    background: var(--accent, #c45d3e);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--sans, 'Outfit', sans-serif);
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.voice-text-send:hover {
    opacity: 0.88;
}

.voice-text-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 768px) {
    .voice-panel {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: -webkit-fill-available;
        border-radius: 0;
        box-shadow: none;
    }

    /* Stack voice FAB above chat FAB (chat FAB is bottom:24px + 56px height + 8px gap = 88px) */
    .voice-fab {
        bottom: 88px;
        right: 16px;
    }

    .voice-text-input {
        font-size: 16px;
    }
}
