/* ============================================
   Voice Situation Modal - "Exposer la situation pédagogique"
   Style ultra moderne avec transcription en direct
   ============================================ */

/* === Search Row - Input + Bouton Vocal côte à côte === */
.search-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto 24px auto;
}

.search-row .search-box {
    flex: 1;
    margin: 0;
}

/* === Bouton Inline - Style harmonisé avec l'input de recherche === */
.voice-situation-inline-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    /* Même padding vertical que l'input (16px) */
    padding: 16px 24px;
    /* Même border-radius pill que l'input (28px) */
    border-radius: 28px;
    border: none;
    /* Couleurs gradient */
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-container) 100%);
    color: white;
    font: var(--body-large);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-short4) var(--easing-standard);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    /* Même ombre que l'input */
    box-shadow: var(--shadow-2);
}

.voice-situation-inline-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.voice-situation-inline-btn:hover::before {
    left: 100%;
}

.voice-situation-inline-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-3);
}

.voice-situation-inline-btn:active {
    transform: translateY(0) scale(0.98);
}

.voice-situation-inline-btn .material-icons {
    font-size: 22px;
    animation: mic-gentle-pulse 2.5s ease-in-out infinite;
}

@keyframes mic-gentle-pulse {

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

    50% {
        transform: scale(1.08);
    }
}

/* === Mobile: bouton adapté mais même forme pill === */
@media (max-width: 768px) {
    .search-row {
        gap: 8px;
    }

    .voice-situation-inline-btn {
        /* Garder la forme pill, juste plus compact */
        padding: 14px 16px;
        border-radius: 28px;
    }

    .voice-situation-inline-btn .voice-btn-text {
        display: none;
    }

    .voice-situation-inline-btn .material-icons {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .search-row {
        gap: 8px;
    }

    .voice-situation-inline-btn {
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* === Modal Overlay === */
.voice-situation-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 4, 4, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.voice-situation-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* === Modal Content === */
.voice-situation-modal {
    background: linear-gradient(180deg,
            var(--surface) 0%,
            var(--surface-container) 100%);
    border-radius: 32px;
    width: 95%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.25),
        0 16px 32px rgba(0, 0, 0, 0.15);
    transform: scale(0.9) translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--outline-variant);
}

.voice-situation-modal-overlay.show .voice-situation-modal {
    transform: scale(1) translateY(0);
}

/* === Modal Header === */
.voice-situation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-container) 100%);
    color: white;
}

.voice-situation-header h2 {
    font: var(--headline-small);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 20px;
}

.voice-situation-header .material-icons {
    font-size: 26px;
    opacity: 0.9;
}

.voice-situation-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.voice-situation-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* === Modal Body === */
.voice-situation-body {
    padding: 28px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* === Instructions === */
.voice-situation-instructions {
    text-align: center;
    color: var(--on-surface-variant);
    font: var(--body-medium);
    line-height: 1.6;
}

.voice-situation-instructions strong {
    color: var(--primary-color);
}

/* === Mic Container (simplifié sans équaliseur) === */
.voice-mic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(180deg,
            var(--surface-container-low) 0%,
            var(--surface-container-high) 100%);
    border-radius: 24px;
    border: 1px solid var(--outline-variant);
    position: relative;
    overflow: hidden;
}

/* Effet de lueur dynamique pendant l'enregistrement */
.voice-mic-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle,
            rgba(211, 47, 47, 0.15) 0%,
            transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.voice-mic-container.active::before {
    opacity: 1;
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {

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

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* === Mic Button Central === */
.voice-mic-button {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-container) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(25, 52, 97, 0.4);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.voice-mic-button .material-icons {
    font-size: 42px;
    transition: all 0.3s ease;
}

.voice-mic-button:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(25, 52, 97, 0.5);
}

.voice-mic-button:active {
    transform: scale(0.96);
}

/* État d'enregistrement */
.voice-mic-button.recording {
    animation: recording-pulse 1.5s ease-in-out infinite;
    background: linear-gradient(135deg, #d32f2f 0%, #f44336 100%);
}

.voice-mic-button.recording .material-icons {
    animation: mic-bounce 0.5s ease-in-out infinite alternate;
}

@keyframes recording-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7),
            0 8px 32px rgba(211, 47, 47, 0.4);
    }

    50% {
        box-shadow: 0 0 0 20px rgba(211, 47, 47, 0),
            0 12px 40px rgba(211, 47, 47, 0.5);
    }
}

@keyframes mic-bounce {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

/* === Status Text === */
.voice-status {
    font: var(--label-large);
    color: var(--on-surface-variant);
    text-align: center;
    padding: 10px 18px;
    border-radius: 20px;
    background: var(--surface-container);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.voice-status.recording {
    color: #d32f2f;
    background: rgba(211, 47, 47, 0.1);
}

.voice-status .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--on-surface-variant);
    transition: all 0.3s ease;
}

.voice-status.recording .status-dot {
    background: #d32f2f;
    animation: status-blink 1s ease-in-out infinite;
}

@keyframes status-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* === Transcription Container === */
.voice-transcription-container {
    background: var(--surface);
    border-radius: 20px;
    padding: 20px;
    border: 2px solid var(--outline-variant);
    min-height: 100px;
    max-height: 180px;
    overflow-y: auto;
    position: relative;
    transition: all 0.3s ease;
}

.voice-transcription-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(25, 52, 97, 0.1);
}

.voice-transcription-label {
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--surface);
    padding: 0 10px;
    font: var(--label-medium);
    color: var(--on-surface-variant);
    font-weight: 600;
}

.voice-transcription-text {
    font: var(--body-large);
    color: var(--on-surface);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 60px;
}

.voice-transcription-text:empty::before {
    content: "Votre transcription apparaîtra ici en temps réel...";
    color: var(--outline);
    font-style: italic;
}

/* Cursor clignotant pendant la transcription */
.voice-transcription-text.typing::after {
    content: '|';
    animation: cursor-blink 0.8s ease-in-out infinite;
    color: var(--primary-color);
    font-weight: bold;
}

@keyframes cursor-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Texte intermédiaire (non final) */
.voice-transcription-interim {
    color: var(--on-surface-variant);
    font-style: italic;
    opacity: 0.7;
}

/* === Actions Footer === */
.voice-situation-footer {
    padding: 0 28px 28px;
    display: flex;
    gap: 16px;
}

.voice-validate-btn {
    flex: 1;
    padding: 16px 24px;
    border-radius: 16px;
    font: var(--label-large);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-container) 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(25, 52, 97, 0.3);
}

.voice-validate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(25, 52, 97, 0.4);
}

.voice-validate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.voice-validate-btn .material-icons {
    font-size: 20px;
}

/* === Error State === */
.voice-error {
    background: var(--error-container);
    color: var(--on-error-container);
    padding: 14px 18px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    font: var(--body-medium);
    animation: shake 0.4s ease-in-out;
}

.voice-error .material-icons {
    color: var(--error);
    font-size: 22px;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* === Loading State for Validate Button === */
.voice-validate-btn.loading {
    position: relative;
    pointer-events: none;
}

.voice-validate-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Warning pour compatibilité === */
.voice-compatibility-warning {
    background: var(--warning-container);
    color: var(--on-warning-container);
    padding: 12px 16px;
    border-radius: 12px;
    font: var(--body-small);
    text-align: center;
    display: none;
}

.voice-compatibility-warning.show {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* === Responsive adjustments === */
@media (max-width: 480px) {
    .voice-situation-modal {
        border-radius: 24px 24px 0 0;
        max-height: 95vh;
        margin-top: auto;
    }

    .voice-situation-header {
        padding: 20px 24px;
    }

    .voice-situation-header h2 {
        font-size: 17px;
    }

    .voice-situation-body {
        padding: 24px 20px 20px;
    }

    .voice-mic-container {
        padding: 20px 16px;
    }

    .voice-mic-button {
        width: 76px;
        height: 76px;
    }

    .voice-mic-button .material-icons {
        font-size: 36px;
    }

    .voice-situation-footer {
        padding: 0 20px 24px;
    }
}