/* Voice Input — microphone button + recording states (desktop + base styles).
   Mobile overrides (larger touch targets, banner sizing) live in mobile.css. */

.voice-field-wrap {
    position: relative;
    display: inline-block;
}
.voice-field-wrap.voice-block {
    display: block;
    width: 100%;
}

/* Leave room for the mic so transcribed/typed text doesn't slide under it. */
.voice-has-mic {
    padding-right: 38px !important;
}

.voice-mic-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #6c757d;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: background-color .15s ease, color .15s ease;
}
.voice-mic-btn:hover {
    background: rgba(0, 0, 0, .06);
    color: #1F3864;
}
.voice-mic-icon {
    display: block;
    width: 16px;
    height: 16px;
}

/* Textareas: pin the mic to the top-right corner instead of centered. */
.voice-field-wrap.voice-textarea .voice-mic-btn {
    top: 8px;
    transform: none;
}

/* Recording — red pulsing stop button. */
.voice-mic-btn.is-recording {
    color: #fff;
    background: #e74c3c;
    animation: voicePulse 1.2s ease-in-out infinite;
}
@keyframes voicePulse {
    0%   { box-shadow: 0 0 0 0 rgba(231, 76, 60, .55); }
    70%  { box-shadow: 0 0 0 7px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Paused (Job Walk capture) — solid amber, not pulsing. Tap to resume. */
.voice-mic-btn.is-paused {
    color: #fff;
    background: #f39c12;
}

/* "✓ Done" button shown beside the mic after the first Job Walk pause. */
.voice-done-btn {
    margin-left: 6px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: #2e8b57;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    vertical-align: middle;
}
.voice-done-btn:hover { background: #277a4b; }

/* Error — red mic with tooltip (title attr). */
.voice-mic-btn.has-error {
    color: #e74c3c;
}

/* Transcribing spinner. */
.voice-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(31, 56, 100, .25);
    border-top-color: #1F3864;
    border-radius: 50%;
    animation: voiceSpin .7s linear infinite;
}
@keyframes voiceSpin {
    to { transform: rotate(360deg); }
}

/* Floating "Recording…" banner (top of screen, tap to stop). */
#voiceRecordingBanner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: #e74c3c;
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
#voiceRecordingBanner.show {
    display: flex;
}
#voiceRecordingBanner .vrb-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #fff;
    animation: voicePulse 1.2s ease-in-out infinite;
}

/* Visible transcription-failure toast (Fix 3) */
#voiceErrorToast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%) translateY(12px);
    z-index: 10001;
    max-width: 92vw;
    display: none;
    opacity: 0;
    padding: 11px 16px;
    background: #e74c3c;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    text-align: center;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
#voiceErrorToast.show {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Transcription progress toast (Fix 1) */
#voiceProgressToast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%) translateY(12px);
    z-index: 10001;
    max-width: 92vw;
    display: none;
    align-items: center;
    gap: 9px;
    opacity: 0;
    padding: 11px 16px;
    background: #1f2d3d;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    text-align: center;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
#voiceProgressToast.show {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#voiceProgressToast .voice-spinner {
    width: 15px;
    height: 15px;
    border-width: 2px;
}

/* ---- warming-up toast (model cold-start, with timed retry) ----------------
   Distinct from the error toast: this is an expected transient state after a
   deploy, not a failure. */
#voiceWarmingToast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%) translateY(12px);
    z-index: 10002;
    max-width: 92vw;
    display: none;
    align-items: center;
    gap: 12px;
    opacity: 0;
    padding: 11px 16px;
    background: #8a5a00;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    text-align: left;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
    transition: opacity .2s ease, transform .2s ease;
}
#voiceWarmingToast.show {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#voiceWarmingToast .vwt-retry {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .7);
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    padding: 5px 12px;
    border-radius: 7px;
    cursor: pointer;
}
#voiceWarmingToast .vwt-retry:hover {
    background: rgba(255, 255, 255, .25);
}
