/**
 * TCF Canada — Simulateurs EE & EO
 */

.tcf-simulator {
    max-width: none;
    margin: 0;
    background: var(--tcf-bg);
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.tcf-simulator__header {
    padding: 1.5rem 1.75rem;
    background: var(--tcf-gradient-header);
    color: #fff;
}

.tcf-simulator__title {
    margin: 0 0 0.75rem;
    font-size: clamp(1.125rem, 2.5vw, 1.375rem);
    font-weight: 800;
}

.tcf-simulator__subtitle {
    margin: 0;
    opacity: 0.92;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.tcf-simulator__controls {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.tcf-simulator__timer-label,
.tcf-simulator__wordcount-label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tcf-simulator__timer-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tcf-simulator__timer-value--warning {
    color: #fde047;
}

.tcf-simulator__wordcount-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.tcf-simulator__wordcount-range {
    font-size: 0.875rem;
    opacity: 0.85;
    margin-left: 0.25rem;
}

.tcf-simulator__wordcount--ok .tcf-simulator__wordcount-value { color: #4ade80; }
.tcf-simulator__wordcount--warn .tcf-simulator__wordcount-value { color: #fde047; }
.tcf-simulator__wordcount--over .tcf-simulator__wordcount-value { color: #f87171; }

/* Jauge mots */
.tcf-simulator__word-gauge {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.tcf-simulator__word-gauge-fill {
    height: 100%;
    width: 0;
    background: #4ade80;
    border-radius: 999px;
    transition: width 0.2s;
}

/* Carrousel combinaisons */
.tcf-simulator__combo-carousel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--tcf-border);
}

.tcf-simulator__carousel-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--tcf-border);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    color: var(--tcf-primary-dark);
}

.tcf-simulator__combo-track-wrap {
    flex: 1;
    overflow: hidden;
}

.tcf-simulator__combo-track {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 0.25rem 0;
}

.tcf-simulator__combo-track::-webkit-scrollbar { display: none; }

.tcf-simulator__combo-btn {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    color: var(--tcf-text);
    transition: all 0.15s;
}

.tcf-simulator__combo-btn--active {
    background: var(--tcf-cyan);
    color: #fff;
    border-color: var(--tcf-cyan);
}

.tcf-simulator__combo-btn--locked {
    opacity: 0.55;
    cursor: not-allowed;
    border-style: dashed;
}

.tcf-simulator__combo-btn:hover:not(.tcf-simulator__combo-btn--active):not(.tcf-simulator__combo-btn--locked) {
    border-color: var(--tcf-cyan);
    color: var(--tcf-cyan-dark);
}

/* Navigation tâches */
.tcf-simulator__task-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--tcf-border);
}

.tcf-simulator__task-tab {
    flex: 1;
    padding: 0.875rem 1rem;
    border: none;
    background: #f8fafc;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--tcf-text-light);
    border-bottom: 3px solid transparent;
    transition: all 0.15s;
}

.tcf-simulator__task-tab--active {
    color: var(--tcf-cyan-dark);
    background: #fff;
    border-bottom-color: var(--tcf-cyan);
}

.tcf-simulator__task-tab:hover:not(.tcf-simulator__task-tab--active) {
    background: #ecfeff;
}

/* Consigne highlight */
.tcf-simulator__consigne {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--tcf-border);
}

.tcf-simulator__consigne--highlight {
    background: linear-gradient(135deg, var(--tcf-cyan-light) 0%, var(--tcf-blue-light) 100%);
    border-left: 4px solid var(--tcf-cyan);
}

.tcf-simulator__consigne h3 {
    margin: 0 0 0.5rem;
    font-size: 0.9375rem;
    color: var(--tcf-cyan-dark);
}

.tcf-simulator__consigne p {
    margin: 0;
    line-height: 1.65;
    color: var(--tcf-text);
}

/* Clavier caractères spéciaux */
.tcf-simulator__keyboard {
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--tcf-border);
}

.tcf-simulator__keyboard-label {
    display: block;
    font-size: 0.75rem;
    color: var(--tcf-text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tcf-simulator__keyboard-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tcf-simulator__key {
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}

.tcf-simulator__key:hover {
    background: #ecfeff;
    border-color: #0891b2;
    color: #0891b2;
}

.tcf-simulator__key:active {
    transform: scale(0.95);
}

/* Zone rédaction */
.tcf-simulator__workspace {
    padding: 1.5rem;
}

.tcf-simulator__textarea {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    font-family: var(--tcf-font);
    font-size: 1rem;
    line-height: 1.7;
    border: 2px solid #e2e8f0;
    border-radius: var(--tcf-radius);
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.tcf-simulator__textarea:focus {
    outline: none;
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.tcf-simulator__textarea[readonly] {
    background: #f8fafc;
}

/* Footer */
.tcf-simulator__footer {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--tcf-border);
    background: #f8fafc;
}

.tcf-btn--record {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.tcf-btn--record:hover:not(:disabled) {
    background: #dc2626;
}

/* Toast */
.tcf-simulator__toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    background: #1e293b;
    color: #fff;
    border-radius: var(--tcf-radius);
    font-size: 0.875rem;
    z-index: 9999;
}

/* Exercice terminé */
.tcf-simulator__finished {
    padding: 1.5rem;
    background: #dcfce7;
    border-top: 1px solid #86efac;
    text-align: center;
}

.tcf-simulator__finished h3 {
    margin: 0 0 0.5rem;
    color: #166534;
}

.tcf-simulator__correction {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(22, 101, 52, 0.15);
    text-align: left;
}

.tcf-simulator__correction-head h4 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    color: #312e81;
}

.tcf-simulator__correction-head p {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--tcf-text-light);
    line-height: 1.55;
}

.tcf-simulator__correction-tasks {
    display: grid;
    gap: 0.75rem;
}

.tcf-simulator__correction-task {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.tcf-simulator__correction-task h5 {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--tcf-dark);
}

.tcf-simulator__correction-task p {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: var(--tcf-text-light);
}

.tcf-simulator__correction-result {
    margin-top: 1rem;
    padding: 1rem 1.125rem;
    border-radius: 14px;
    background: #f5f3ff;
    border: 1px solid rgba(124, 58, 237, 0.18);
}

.tcf-simulator__correction-result h5 {
    margin: 0 0 0.75rem;
    color: #5b21b6;
}

.tcf-simulator__correction-score {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #ede9fe;
    color: #6d28d9;
    font-size: 0.8125rem;
    font-weight: 700;
}

.tcf-simulator__correction-list {
    margin: 0 0 0.75rem;
    padding-left: 1.1rem;
    font-size: 0.875rem;
    line-height: 1.55;
}

.tcf-simulator__correction-list li + li {
    margin-top: 0.35rem;
}

.tcf-simulator__correction-errors {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tcf-simulator__correction-error {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e9d5ff;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.tcf-simulator__correction-loading {
    font-size: 0.875rem;
    color: #6d28d9;
    font-weight: 600;
}

.tcf-simulator__correction-locked {
    font-size: 0.8125rem;
    color: var(--tcf-text-light);
}

/* Phases orales */
.tcf-simulator__phases {
    padding: 1.5rem;
}

.tcf-simulator__phase {
    text-align: center;
}

.tcf-simulator__phase h4 {
    margin: 0 0 1rem;
    color: var(--tcf-text);
}

.tcf-simulator__phase-timer {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--tcf-primary-dark);
    margin-bottom: 1.5rem;
    font-variant-numeric: tabular-nums;
}

/* Visualiseur audio */
.tcf-simulator__visualizer {
    margin-bottom: 1rem;
    border-radius: var(--tcf-radius);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.tcf-simulator__visualizer canvas {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.tcf-simulator__recorder {
    max-width: 440px;
    margin: 0 auto;
}

.tcf-simulator__recorder-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tcf-simulator__recorder-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #cbd5e1;
}

.tcf-simulator__recorder-dot--active {
    background: #ef4444;
    animation: tcf-rec-blink 0.8s infinite;
}

@keyframes tcf-rec-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.tcf-simulator__recorder-status {
    font-weight: 600;
    font-size: 0.9375rem;
}

.tcf-simulator__recorder-controls {
    display: flex;
    gap: 0.625rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tcf-simulator__download-btn {
    display: inline-flex;
    margin-top: 0.75rem;
    text-decoration: none;
}

#tcf-eo-playback {
    width: 100%;
    margin-top: 0.75rem;
}

.tcf-simulator__mic-error {
    padding: 1rem 1.5rem;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.875rem;
}

.tcf-simulator__mic-error p { margin: 0; }

@media (max-width: 768px) {
    .tcf-simulator__header {
        padding: 1.25rem 1rem;
    }

    .tcf-simulator__controls { gap: 1rem; }
    .tcf-simulator__timer-value,
    .tcf-simulator__wordcount-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
    .tcf-simulator__controls { gap: 0.875rem; }
    .tcf-simulator__phase-timer { font-size: 2rem; }
    .tcf-simulator__task-tab { font-size: 0.75rem; padding: 0.75rem 0.375rem; }
    .tcf-simulator__consigne { padding: 1rem; }
    .tcf-simulator__combo-carousel { padding: 0.75rem; }
}
