/* Styles pour la boîte de dialogue vocale - Version Compacte & Thème Sombre */
.speech-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6); /* Fond très sombre semi-transparent */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Alignement haut pour ne pas masquer le contenu important */
    padding-top: 80px; /* Décalage depuis le haut */
    z-index: 9999;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.speech-dialog:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.speech-dialog-content {
    background: var(--bg-card, #2D3748);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    width: 400px; /* Largeur fixe et compacte */
    max-width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
    color: var(--text-main, #F7FAFC);
}

.speech-dialog:not(.hidden) .speech-dialog-content {
    transform: translateY(0);
}

/* En-tête compact */
.speech-dialog-header {
    background: var(--bg-darker, #1E293B);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.05));
}

.speech-dialog-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main, #fff);
    display: flex;
    align-items: center;
    gap: 8px;
}

.speech-close-btn {
    background: none;
    border: none;
    color: var(--text-muted, #A0AEC0);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.speech-close-btn:hover {
    color: #fff;
}

/* Corps compact */
.speech-dialog-body {
    padding: 16px;
}

/* Contrôles sur une ligne */
.speech-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.speech-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

.speech-btn-primary {
    background: var(--bg-darker, #1E293B);
    color: var(--text-main, #fff);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
}

.speech-btn-primary:hover:not(:disabled) {
    background: #374151;
}

.speech-btn-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.speech-btn-success:hover:not(:disabled) {
    background: rgba(16, 185, 129, 0.3);
}

.speech-btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.speech-btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.3);
}

/* Stats ultra-compactes */
.speech-stats {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
}

.stat-item {
    display: flex;
    gap: 6px;
}

.stat-value {
    color: var(--text-main, #fff);
    font-weight: 600;
}

/* Zone de texte sombre */
.speech-text-area {
    position: relative;
}

textarea.speech-text-final {
    background: var(--bg-darker, #0f172a);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: 6px;
    padding: 10px;
    min-height: 80px;
    width: 100%;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-main, #e2e8f0);
    box-sizing: border-box;
}

textarea.speech-text-final:focus {
    outline: none;
    border-color: var(--primary, #7C3AED);
}

/* Indicateurs de statut */
.speech-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted, #64748b);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    transition: all 0.3s;
}

.status-indicator.active {
    background: #34d399;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Animation du bouton Header */
#btnSpeechToggle.listening {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    animation: pulse-button 2s infinite;
    border-color: transparent;
}

@keyframes pulse-button {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Bouton de dictée contextuel */
.btn-dictate {
    background: transparent;
    color: var(--text-muted, #A0AEC0);
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    margin-left: 8px;
    transition: all 0.2s;
    border-radius: 4px;
    font-size: 12px;
    width: 24px; /* Taille fixe pour éviter le saut quand l'icône change */
    text-align: center;
}

.btn-dictate:hover {
    color: var(--primary, #7C3AED);
    background: rgba(124, 58, 237, 0.1);
    transform: scale(1.1);
}

.btn-dictate:active {
    transform: scale(0.95);
}

/* État actif (listening) du bouton de dictée */
.btn-dictate.listening {
    color: #10b981 !important; /* Vert pour Listening */
    background: rgba(16, 185, 129, 0.1) !important;
    animation: pulse-dictate 1.5s infinite;
}

@keyframes pulse-dictate {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
