/* Speech-to-text mic button */
.stt-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.stt-wrapper textarea {
    width: 100%;
    box-sizing: border-box;
}

.stt-mic-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border, #333);
    background: var(--surface, #111);
    color: var(--text-muted, #888);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
    padding: 0;
    opacity: 0.6;
}

.stt-mic-btn:hover {
    opacity: 1;
    color: var(--accent, #4ade80);
    border-color: var(--accent, #4ade80);
}

.stt-mic-btn.stt-active {
    opacity: 1;
    color: #fff;
    background: #ef4444;
    border-color: #ef4444;
    animation: stt-pulse 1.5s ease-in-out infinite;
}

@keyframes stt-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

@media print {
    .stt-mic-btn { display: none !important; }
}

/* TTS speaker button */
.tts-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border, #333);
    background: var(--surface, #111);
    color: var(--text-muted, #888);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 5px;
    flex-shrink: 0;
    opacity: 0.6;
}
.tts-btn:hover { opacity: 1; color: var(--accent, #4ade80); border-color: var(--accent, #4ade80); }
.tts-btn svg { width: 18px; height: 18px; }
.tts-btn .tts-off-icon { display: block; }
.tts-btn .tts-on-icon { display: none; }

/* ON state — enabled, not currently playing */
.tts-btn.tts-on {
    opacity: 1;
    color: var(--accent, #4ade80);
    border-color: var(--accent, #4ade80);
}
.tts-btn.tts-on .tts-off-icon { display: none; }
.tts-btn.tts-on .tts-on-icon { display: block; }

/* PLAYING state — enabled + audio queued/playing */
.tts-btn.tts-playing {
    opacity: 1;
    color: #fff;
    background: var(--accent, #4ade80);
    border-color: var(--accent, #4ade80);
    animation: tts-play-pulse 1.2s ease-in-out infinite;
}
.tts-btn.tts-playing .tts-off-icon { display: none; }
.tts-btn.tts-playing .tts-on-icon { display: block; }

@keyframes tts-play-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
}

/* Header variant — smaller, inline next to title */
.tts-btn-header {
    width: 30px;
    height: 30px;
    padding: 4px;
    vertical-align: middle;
    display: inline-flex;
    margin-left: 6px;
}
.tts-btn-header svg { width: 16px; height: 16px; }

@media print {
    .tts-btn { display: none !important; }
    .tts-btn-header { display: none !important; }
}
