/* ═══════════════════════════════════════════════════════════════ */
/*  VOICE INPUT — Speech-to-Text Microphone Button Styles         */
/* ═══════════════════════════════════════════════════════════════ */

/* Wrapper around each textarea to position the mic button */
.voice-input-wrapper {
    position: relative;
    display: block;
}

/* Ensure textarea inside wrapper keeps its full width */
.voice-input-wrapper textarea {
    padding-right: 44px !important;
}

/* ── Microphone Button ────────────────────────────────────────── */
.voice-input-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border, #dcdfe4);
    border-radius: 6px;
    background: var(--card, #ffffff);
    color: var(--navy, #12275a);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
    line-height: 1;
}

.voice-input-btn:hover {
    opacity: 1;
    background: #f0f2f5;
    border-color: var(--navy, #12275a);
    box-shadow: 0 1px 4px rgba(18, 39, 90, 0.12);
}

.voice-input-btn:focus-visible {
    opacity: 1;
    outline: 2px solid var(--navy, #12275a);
    outline-offset: 2px;
}

/* ── Listening State ──────────────────────────────────────────── */
.voice-input-btn.listening {
    opacity: 1;
    color: #ffffff;
    background: #d32f2f;
    border-color: #d32f2f;
    animation: voice-pulse 1.4s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.45); }
    50%      { box-shadow: 0 0 0 8px rgba(211, 47, 47, 0); }
}

/* ── Listening Indicator Label ────────────────────────────────── */
.voice-listening-indicator {
    position: absolute;
    top: 44px;
    right: 8px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    background: #d32f2f;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    pointer-events: none;
    animation: voice-fade-in 0.2s ease;
}

.voice-listening-indicator::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    animation: voice-blink 1s step-start infinite;
}

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

@keyframes voice-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Error / Unsupported Tooltip ──────────────────────────────── */
.voice-input-error {
    position: absolute;
    top: 44px;
    right: 8px;
    z-index: 6;
    max-width: 240px;
    padding: 6px 12px;
    border-radius: 6px;
    background: #424242;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: normal;
    pointer-events: none;
    animation: voice-fade-in 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

/* ── Unsupported Browser — Disabled Button ────────────────────── */
.voice-input-btn.unsupported {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
