/* Voice input: mic button, full-screen recording overlay, and status line */

.mic-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target);
    height: 100%;
    min-height: var(--touch-target);
    padding: 0;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    color: var(--accent-secondary);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.1s;
}

.mic-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-secondary);
    color: var(--accent);
}

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

.mic-btn--listening {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
    animation: mic-btn-glow 2s ease-in-out infinite;
}

@keyframes mic-btn-glow {
    0%,
    100% {
        box-shadow: 0 0 12px 2px var(--accent-glow);
    }
    50% {
        box-shadow: 0 0 22px 6px var(--accent-glow);
    }
}

@media (prefers-reduced-motion: reduce) {
    .mic-btn--listening {
        animation: none;
        box-shadow: 0 0 16px 2px var(--accent-glow);
    }
}

/* Full-screen recording overlay */

.voice-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--overlay-backdrop);
    backdrop-filter: blur(4px);
}

.voice-overlay[hidden] {
    display: none;
}

.voice-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    width: 100%;
    max-width: min(420px, calc(100vw - 48px));
    text-align: center;
}

.voice-overlay-mic {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.voice-overlay-mic::before,
.voice-overlay-mic::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0.55;
    animation: voice-overlay-ring 1.8s ease-out infinite;
}

.voice-overlay-mic::after {
    animation-delay: 0.6s;
}

@keyframes voice-overlay-ring {
    0% {
        transform: scale(0.85);
        opacity: 0.55;
    }
    100% {
        transform: scale(1.45);
        opacity: 0;
    }
}

.voice-overlay-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 34px;
}

.voice-overlay-wave span {
    display: block;
    width: 5px;
    height: 8px;
    border-radius: 3px;
    background: var(--accent);
    animation: voice-wave-bounce 1s ease-in-out infinite;
}

.voice-overlay-wave span:nth-child(1) {
    animation-delay: 0s;
}
.voice-overlay-wave span:nth-child(2) {
    animation-delay: 0.1s;
}
.voice-overlay-wave span:nth-child(3) {
    animation-delay: 0.2s;
}
.voice-overlay-wave span:nth-child(4) {
    animation-delay: 0.3s;
}
.voice-overlay-wave span:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes voice-wave-bounce {
    0%,
    100% {
        height: 8px;
    }
    50% {
        height: 32px;
    }
}

.voice-overlay-instructions {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.voice-overlay-transcript {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
}

.voice-overlay-timer {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.voice-overlay-stop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-target);
    padding: 12px 32px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--danger);
    color: var(--on-accent);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: filter 0.2s, transform 0.1s;
}

.voice-overlay-stop:hover {
    filter: brightness(1.08);
}

.voice-overlay-stop:disabled {
    opacity: 0.7;
    cursor: wait;
}

@media (prefers-reduced-motion: reduce) {
    .voice-overlay-mic::before,
    .voice-overlay-mic::after {
        animation: none;
        opacity: 0;
    }
    .voice-overlay-wave span {
        animation: none;
        height: 18px;
    }
}

/* Live transcript word chips (shared by the overlay) */

.voice-word-chip {
    display: inline-block;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    line-height: 1.3;
    background: var(--bg-hover);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}

.voice-word-chip--interim {
    color: var(--text-secondary);
    border-style: dashed;
    opacity: 0.75;
}

.voice-live-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* Persistent status line below the submit/mic row (shows final "Heard: ..." summary) */

.voice-status {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-secondary);
    background: var(--bg-hover);
    border: 1px solid var(--border-strong);
}

.voice-status[hidden] {
    display: none;
}

.voice-status--listening {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}
