/* TCF Simulator Frontend */
:root {
    --tcf-primary: #1a73e8;
    --tcf-primary-hover: #1557b0;
    --tcf-danger: #dc3545;
    --tcf-success: #28a745;
    --tcf-warning: #ffc107;
    --tcf-light: #f8f9fa;
    --tcf-dark: #333;
    --tcf-gray: #6c757d;
    --tcf-border: #e0e0e0;
    --tcf-radius: 8px;
}

.tcf-simulator {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--tcf-dark);
    line-height: 1.6;
}
.tcf-simulator * {
    box-sizing: border-box;
}

/* Steps */
.tcf-step {
    display: none;
}
.tcf-step-active {
    display: block;
}

/* Cards */
.tcf-card {
    background: #fff;
    border-radius: var(--tcf-radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}
.tcf-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--tcf-border);
}
.tcf-card-header h2 {
    margin: 0;
    color: var(--tcf-primary);
    font-size: 22px;
}
.tcf-card-body {
    padding: 24px;
}

/* Forms */
.tcf-form-group {
    margin-bottom: 18px;
}
.tcf-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--tcf-dark);
}
.tcf-form-group label .required {
    color: var(--tcf-danger);
}
.tcf-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--tcf-border);
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s;
}
.tcf-form-group input:focus {
    outline: none;
    border-color: var(--tcf-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}
.tcf-form-actions {
    text-align: center;
    margin-top: 24px;
}
.tcf-form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--tcf-danger);
    padding: 12px;
    border-radius: 6px;
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
}
.tcf-form-intro {
    margin-bottom: 24px;
    padding: 16px;
    background: #eef4fd;
    border-radius: 6px;
    color: #1a56a0;
}

/* Buttons */
.tcf-btn {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}
.tcf-btn-primary {
    background: var(--tcf-primary);
    color: #fff;
}
.tcf-btn-primary:hover {
    background: var(--tcf-primary-hover);
}
.tcf-btn-outline {
    background: #fff;
    color: var(--tcf-primary);
    border: 2px solid var(--tcf-primary);
}
.tcf-btn-outline:hover {
    background: #eef4fd;
}
.tcf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Epreuve Container */
.tcf-epreuve-container {
    background: #fff;
    border-radius: var(--tcf-radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 24px;
}

/* Timer Header */
.tcf-epreuve-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.tcf-timer {
    color: var(--tcf-primary);
    font-size: 15px;
    font-weight: 500;
}
.tcf-timer-icon {
    margin-right: 4px;
}
.tcf-timer-display {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.tcf-timer.tcf-timer-warning .tcf-timer-display {
    color: var(--tcf-danger);
    animation: tcf-blink 1s infinite;
}
@keyframes tcf-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.tcf-question-counter {
    color: var(--tcf-gray);
    font-size: 15px;
}
.tcf-epreuve-divider {
    border-top: 2px dashed var(--tcf-primary);
    margin-bottom: 20px;
}

/* Question Instructions */
.tcf-question-instructions {
    background: #eef4fd;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #1a56a0;
}
.tcf-question-instructions:empty {
    display: none;
}

/* Question Content */
.tcf-question-content {
    margin-bottom: 20px;
}
.tcf-question-number-badge {
    display: inline-block;
    padding: 6px 16px;
    border: 2px solid var(--tcf-primary);
    border-radius: 20px;
    color: var(--tcf-primary);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 16px;
}
.tcf-question-media {
    text-align: center;
    margin-bottom: 16px;
}
.tcf-question-media img {
    max-width: 100%;
    border: 2px dashed var(--tcf-border);
    border-radius: 6px;
    padding: 8px;
}
.tcf-question-media:empty {
    display: none;
}
.tcf-question-text {
    font-size: 16px;
    padding: 16px;
    background: var(--tcf-light);
    border-radius: 6px;
    border: 1px solid var(--tcf-border);
    white-space: pre-line;
}
.tcf-question-text:empty {
    display: none;
}

/* Audio Player */
.tcf-question-audio-player audio {
    width: 100%;
    margin: 12px 0;
}
.tcf-question-audio-player:empty {
    display: none;
}

/* Answers */
.tcf-answers-container {
    margin-bottom: 20px;
}
.tcf-answer-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 8px;
    background: var(--tcf-light);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.tcf-answer-option:hover {
    background: #eef4fd;
    border-color: #bbd4f7;
}
.tcf-answer-option.selected {
    background: #eef4fd;
    border-color: var(--tcf-primary);
}
.tcf-answer-letter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #555;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s;
}
.tcf-answer-option.selected .tcf-answer-letter-badge {
    background: var(--tcf-primary);
    color: #fff;
}
.tcf-answer-text {
    font-size: 15px;
}

/* Navigation */
.tcf-navigation {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* Intermediate Pages */
.tcf-intermediate-card {
    text-align: center;
}
.tcf-intermediate-timer {
    padding: 12px;
    background: #eef4fd;
    color: var(--tcf-primary);
    font-weight: 600;
    font-size: 15px;
}
.tcf-intermediate-content {
    padding: 20px 0;
    text-align: left;
}
.tcf-intermediate-content h3 {
    color: var(--tcf-primary);
}

/* Expression Écrite */
.tcf-task-instructions {
    background: #eef4fd;
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #1a56a0;
    font-weight: 500;
}
.tcf-task-instructions:empty {
    display: none;
}
.tcf-task-content {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--tcf-light);
    border: 1px solid var(--tcf-border);
    border-radius: 6px;
}
.tcf-task-content:empty {
    display: none;
}
.tcf-task-indicator {
    color: var(--tcf-gray);
    font-size: 15px;
    font-weight: 500;
}
.tcf-writing-area {
    margin-bottom: 20px;
}
.tcf-wysiwyg {
    width: 100%;
    min-height: 250px;
    padding: 16px;
    border: 1px solid var(--tcf-border);
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.7;
    resize: vertical;
}
.tcf-wysiwyg:focus {
    outline: none;
    border-color: var(--tcf-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}
.tcf-word-counter {
    margin-top: 8px;
    font-size: 14px;
    color: var(--tcf-gray);
}
.tcf-word-count {
    font-weight: 700;
}
.tcf-word-status {
    margin-left: 10px;
    font-weight: 600;
}
.tcf-word-status.under-min {
    color: var(--tcf-warning);
}
.tcf-word-status.over-max {
    color: var(--tcf-danger);
}
.tcf-word-status.ok {
    color: var(--tcf-success);
}

/* Expression Orale - Recording */
.tcf-recording-area {
    text-align: center;
    padding: 30px;
    background: var(--tcf-light);
    border-radius: 6px;
    margin-bottom: 20px;
}
.tcf-mic-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 18px;
    margin-bottom: 16px;
}
.tcf-mic-icon {
    font-size: 32px;
}
.tcf-recording-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    color: var(--tcf-danger);
    font-weight: 600;
}
.tcf-recording-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: var(--tcf-danger);
    border-radius: 50%;
    animation: tcf-pulse 1.5s infinite;
}
@keyframes tcf-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Processing */
.tcf-processing-card {
    min-height: 300px;
    display: flex;
    align-items: center;
}
.tcf-text-center {
    text-align: center;
    width: 100%;
}
.tcf-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--tcf-border);
    border-top-color: var(--tcf-primary);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: tcf-spin 0.8s linear infinite;
}
@keyframes tcf-spin {
    to { transform: rotate(360deg); }
}
.tcf-processing-text {
    font-size: 18px;
    color: var(--tcf-gray);
    margin-bottom: 30px;
}
.tcf-btn-quit {
    font-size: 13px;
}

/* Results */
.tcf-results-card .tcf-card-body {
    padding: 24px;
}
.tcf-result-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--tcf-border);
}
.tcf-result-header h3 {
    margin: 0 0 4px 0;
    color: var(--tcf-dark);
    font-size: 20px;
}
.tcf-result-date {
    color: var(--tcf-gray);
    font-size: 14px;
}
.tcf-result-block {
    background: var(--tcf-light);
    border: 1px solid var(--tcf-border);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 14px;
}
.tcf-result-block h4 {
    margin: 0 0 10px 0;
    color: var(--tcf-primary);
    font-size: 16px;
}
.tcf-result-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 14px;
}
.tcf-result-badge {
    display: inline-block;
    background: var(--tcf-primary);
    color: #fff;
    padding: 5px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    margin-top: 8px;
}

/* Error */
.tcf-error-card .tcf-card-body {
    padding: 40px;
}
.tcf-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 640px) {
    .tcf-simulator {
        padding: 10px;
    }
    .tcf-epreuve-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    .tcf-navigation {
        flex-direction: column;
    }
    .tcf-navigation .tcf-btn {
        width: 100%;
        text-align: center;
    }
    .tcf-answer-option {
        padding: 12px;
    }
}

/* ==============================
   CO Audio Status
============================== */
.tcf-audio-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--tcf-light);
    border-radius: 6px;
    margin: 12px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--tcf-dark);
}
.tcf-audio-icon {
    font-size: 20px;
}
.tcf-btn-sm {
    padding: 8px 18px;
    font-size: 14px;
}

/* ==============================
   EO Recording Pulse Button
============================== */
.tcf-btn-pulse {
    animation: tcf-btn-pulse-anim 1.5s infinite;
    box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.4);
}
@keyframes tcf-btn-pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.4); }
    70% { box-shadow: 0 0 0 14px rgba(26, 115, 232, 0); }
    100% { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0); }
}

/* ==============================
   EE Plaintext Textarea
============================== */
.tcf-wysiwyg {
    -webkit-text-security: none;
    font-variant-ligatures: none;
    -moz-appearance: none;
    -webkit-appearance: none;
}
.tcf-wysiwyg::spelling-error,
.tcf-wysiwyg::grammar-error {
    text-decoration: none;
}

/* ==============================
   Error Banner
============================== */
.tcf-error-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 14px;
    border-radius: 6px;
    margin-top: 16px;
    color: var(--tcf-danger);
    text-align: center;
    font-size: 14px;
}

/* ==============================
   Detailed Results - Banner
============================== */
.tcf-result-banner {
    background: linear-gradient(135deg, #1a73e8, #4fc3f7);
    color: #fff;
    padding: 18px 24px;
    border-radius: 10px 10px 0 0;
    text-align: center;
}
.tcf-result-banner-title {
    font-size: 20px;
    font-weight: 700;
}
.tcf-result-block-banner {
    padding: 10px 18px;
    border-radius: 8px 8px 0 0;
    font-size: 15px;
    color: #fff;
    margin: -18px -18px 16px -18px;
}
.tcf-result-block-banner.tcf-level-low { background: linear-gradient(135deg, #ef4444, #f87171); }
.tcf-result-block-banner.tcf-level-b2 { background: linear-gradient(135deg, #eab308, #facc15); color: #333; }
.tcf-result-block-banner.tcf-level-c1 { background: linear-gradient(135deg, #ea580c, #fb923c); }
.tcf-result-block-banner.tcf-level-c2 { background: linear-gradient(135deg, #16a34a, #4ade80); }

/* Score Row */
.tcf-result-score-row {
    display: flex;
    justify-content: space-around;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.tcf-result-score-item {
    text-align: center;
    flex: 1;
    min-width: 80px;
}
.tcf-result-score-big {
    font-size: 28px;
    font-weight: 700;
    color: var(--tcf-primary);
}
.tcf-result-score-label {
    font-size: 12px;
    color: var(--tcf-gray);
    margin-top: 2px;
}

/* Review Section */
.tcf-review-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--tcf-border);
}
.tcf-review-detail {
    margin-top: 14px;
}

/* Answer Grid */
.tcf-answer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.tcf-grid-item {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}
.tcf-grid-correct { background: #16a34a; }
.tcf-grid-wrong { background: #ef4444; }
.tcf-grid-empty { background: #d1d5db; color: #6b7280; }
.tcf-grid-legend {
    font-size: 12px;
    color: var(--tcf-gray);
    margin-bottom: 14px;
}
.tcf-grid-legend span {
    margin-right: 8px;
}

/* Review List */
.tcf-review-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tcf-review-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--tcf-light);
    border-radius: 6px;
    font-size: 14px;
}
.tcf-review-num {
    font-weight: 700;
    min-width: 24px;
    color: var(--tcf-gray);
}
.tcf-review-status {
    font-size: 16px;
    min-width: 20px;
}
.tcf-q-correct .tcf-review-status { color: #16a34a; }
.tcf-q-wrong .tcf-review-status { color: #ef4444; }
.tcf-review-wrong-ans {
    text-decoration: line-through;
    color: #ef4444;
    margin-right: 8px;
}
.tcf-review-correct-ans {
    color: #16a34a;
    font-weight: 500;
}

/* Feedback Boxes (EE/EO) */
.tcf-feedback-task {
    background: var(--tcf-light);
    border: 1px solid var(--tcf-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}
.tcf-feedback-task h4 {
    margin: 0 0 12px;
    color: var(--tcf-primary);
}
.tcf-feedback-box {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}
.tcf-feedback-box h5 {
    margin: 0 0 6px;
    font-size: 13px;
}
.tcf-feedback-box p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}
.tcf-feedback-positive {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.tcf-feedback-positive h5 { color: #16a34a; }
.tcf-feedback-improve {
    background: #fff7ed;
    border: 1px solid #fed7aa;
}
.tcf-feedback-improve h5 { color: #ea580c; }

.tcf-feedback-detail {
    margin-top: 8px;
}
.tcf-feedback-detail summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--tcf-primary);
    padding: 8px 0;
}
.tcf-feedback-detail p {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--tcf-border);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-line;
}

/* Level Messages */
.tcf-result-level-message {
    background: #eef4fd;
    border: 1px solid #bbd4f7;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}
.tcf-result-level-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* Toggle review button */
.tcf-toggle-review.tcf-toggled {
    background: var(--tcf-primary);
    color: #fff;
    border-color: var(--tcf-primary);
}

/* ==============================
   Cours Single Page
============================== */
.tcf-cours-single {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}
.tcf-cours-description {
    font-size: 16px;
    line-height: 1.8;
    color: #444;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #1a73e8;
}
.tcf-cours-toc {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 30px;
}
.tcf-cours-toc h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #333;
}
.tcf-cours-toc ol {
    margin: 0;
    padding-left: 20px;
}
.tcf-cours-toc li {
    margin-bottom: 6px;
}
.tcf-cours-toc a {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
}
.tcf-cours-toc a:hover {
    text-decoration: underline;
}
.tcf-cours-chapter {
    margin-bottom: 40px;
    padding: 24px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
}
.tcf-chapter-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    margin: 0 0 16px;
    color: #333;
    padding-bottom: 12px;
    border-bottom: 2px solid #eef4fd;
}
.tcf-chapter-num-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a73e8;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}
.tcf-chapter-content {
    font-size: 15px;
    line-height: 1.9;
    color: #444;
}
.tcf-chapter-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}
.tcf-cours-back {
    margin-top: 30px;
    text-align: center;
}
