* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 40px;
    max-width: 700px;
    width: 100%;
    text-align: center;
}

.logo {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1em;
}

/* Mode Selection */
.mode-selection {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.mode-card {
    flex: 1;
    padding: 30px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

.mode-card:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-5px);
}

.mode-card.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.mode-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.mode-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.mode-description {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Session Info */
.session-info {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
}

.session-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.code-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.code-title {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.code-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    letter-spacing: 2px;
}

/* Status indicators */
.connection-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dc3545;
}

.status-dot.connected {
    background: #28a745;
}

.status-dot.loading {
    background: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-dot.playing {
    background: #4ECDC4;
    animation: pulse 1.5s infinite;
}

/* Audio controls */
.audio-controls {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
}

.microphone-section {
    margin-bottom: 25px;
}

.mic-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    font-size: 2.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 auto 15px;
    display: block;
    position: relative;
}

.mic-button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
}

.mic-button.listening {
    background: linear-gradient(135deg, #28a745, #20c997);
    animation: pulse 1.5s infinite;
}

.mic-button.processing {
    background: linear-gradient(135deg, #ffc107, #e0a800);
}

.mic-status {
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

/* Real-time display */
.realtime-display {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    min-height: 200px;
    text-align: left;
}

.transcription-section {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.transcription-label {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.transcription-text {
    font-size: 16px;
    color: #333;
    line-height: 1.4;
    min-height: 24px;
}

.transcription-text.interim {
    color: #666;
    font-style: italic;
}

.translation-section {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.translation-label {
    font-size: 12px;
    font-weight: 600;
    color: #28a745;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.translation-text {
    font-size: 16px;
    color: #333;
    line-height: 1.4;
    min-height: 24px;
}

/* Translation history */
.translation-history {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 20px;
}

.translation-item {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* 🆕 Styles pour différencier messages reçus et envoyés */
.translation-item.received {
    border-left-color: #28a745;
    background: #f8fff9;
}

.translation-item.sent {
    border-left-color: #667eea;
    background: #f0f4ff;
}

.translation-item.received .original-text {
    color: #28a745;
}

.translation-item.sent .original-text {
    color: #667eea;
}

.translation-item.received .translated-text {
    color: #28a745;
}

.translation-item.sent .translated-text {
    color: #667eea;
}

.translation-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.original-text {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.translated-text {
    color: #667eea;
    font-size: 1.1em;
}

/* Volume control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.volume-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

/* Participants */
.participants-list {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    text-align: left;
}

.participant {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.participant:last-child {
    border-bottom: none;
}

.participant-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.participant-avatar {
    width: 32px;
    height: 32px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

/* Messages */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    display: none;
    border: 1px solid #f5c6cb;
}

.error-message.show {
    display: block;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    display: none;
    border: 1px solid #c3e6cb;
}

.success-message.show {
    display: block;
}

.loading {
    display: none;
    color: #667eea;
    font-weight: 600;
    margin: 10px 0;
}

.loading.show {
    display: block;
}

.hidden {
    display: none !important;
}

/* 🔧 Styles pour les statistiques (toujours visibles) */
#detailedStats {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* 🔧 Animation d'apparition des statistiques */
#detailedStats {
    transition: all 0.3s ease;
    transform-origin: top center;
}

/* 🔧 Styles spécifiques pour les statistiques */
.queue-stats {
    position: relative;
    z-index: 10;
}

#detailedStats {
    position: relative;
    z-index: 11;
    overflow: hidden;
}



.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }

    .mode-selection {
        flex-direction: column;
        gap: 15px;
    }

    .session-codes {
        grid-template-columns: 1fr;
    }

    .mic-button {
        width: 80px;
        height: 80px;
        font-size: 2em;
    }

    .connection-status {
        flex-direction: column;
        gap: 10px;
    }
}

language-option {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: left;
}

.language-option:hover {
    border-color: #4ECDC4;
    background: #f0f8ff;
    transform: translateY(-2px);
}

.language-option.selected {
    border-color: #00B4A6;
    background: linear-gradient(135deg, #4ECDC4, #00B4A6);
    color: white;
}

.language-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.language-control-panel {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-dropdown {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .language-options {
        grid-template-columns: 1fr !important;
    }

    .current-language-display {
        flex-direction: column !important;
        gap: 10px;
    }
}

.tts-queue-control-panel {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.queue-indicator .status-dot {
    animation: none;
}

.queue-indicator .status-dot.processing {
    background: #ffc107;
    animation: pulse 1s infinite;
}

.queue-indicator .status-dot.idle {
    background: #6c757d;
}

/* Style pour les boutons de contrôle */
.tts-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tts-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Animation pour l'indicateur flottant */
#audioFloatingIndicator {
    transition: all 0.3s ease;
}

#audioFloatingIndicator.show {
    display: block !important;
}

/* Responsive pour contrôles */
@media (max-width: 768px) {
    .tts-controls {
        flex-direction: column;
    }

    .queue-config>div {
        grid-template-columns: 1fr !important;
    }
}

.help-text {
    display: block;
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    line-height: 1.4;
    padding: 8px 12px;
    background: #f8f9fa;
    border-left: 3px solid #667eea;
    border-radius: 4px;
}

/* Amélioration du groupe speaker language */
#speakerLanguageGroup {
    border: 2px solid #e3f2fd;
    border-radius: 12px;
    padding: 20px;
    background: linear-gradient(145deg, #f8f9ff 0%, #f0f4ff 100%);
    margin-bottom: 20px;
}

#speakerLanguageGroup label {
    color: #1976d2;
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 12px;
}

#speakerLanguageGroup select {
    border-color: #667eea;
    font-size: 16px;
    padding: 18px;
}

#speakerLanguageGroup select:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* Animation pour l'affichage du groupe speaker */
#speakerLanguageGroup.showing {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.arabic-text {
    direction: rtl;
    text-align: right;
    font-family: 'Arial Unicode MS', sans-serif;
}

.language-selector .arabic-option {
    font-family: 'Arial Unicode MS', sans-serif;
}