/* ==========================================================================
   INSTITUTO CERVANTES — DELE A1 OFFICIAL EXAM STYLESHEET
   Accurate visual reproduction of DELE (Diplomas de Español como Lengua Extranjera)
   standards: typography, color palette, document framing, and OMR answer sheets.
   ========================================================================== */

:root {
    --cervantes-burgundy: #8c1428;      /* Official Instituto Cervantes deep red */
    --cervantes-burgundy-dark: #660c1c;
    --cervantes-cream: #faf8f5;         /* Archival document warm background */
    --cervantes-border: #d3c8ba;        /* Institutional sepia-grey border */
    --cervantes-text: #1a1a1a;          /* High-contrast charcoal text */
    --cervantes-muted: #555555;
    --cervantes-box-bg: #f4f1ea;        /* Instruction box parchment color */
    --cervantes-omr-red: #c0392b;       /* Optical mark recognition grid red */
    --cervantes-omr-bg: #fdf6f5;
    --cervantes-correct: #15803d;
    --cervantes-wrong: #b91c1c;
    --font-official: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
    --font-serif: Georgia, "Times New Roman", Times, serif;
}

/* Base Document Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.dele-theme {
    background-color: #e5e5e5;
    color: var(--cervantes-text);
    font-family: var(--font-official);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Exam Paper Wrapper (A4 look and feel) */
.exam-paper {
    max-width: 960px;
    margin: 1.5rem auto 4rem;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #c8c8c8;
    min-height: 100vh;
}

/* Official Cervantes Header */
.dele-official-header {
    background: #ffffff;
    border-bottom: 3px solid var(--cervantes-burgundy);
    padding: 1.75rem 2rem 1.25rem;
}

.cervantes-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.cervantes-logo-text {
    font-family: var(--font-official);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cervantes-logo-text .inst {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--cervantes-burgundy);
    display: block;
    line-height: 1.1;
}

.cervantes-logo-text .sub {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    letter-spacing: 0.15em;
}

.dele-title-box {
    text-align: right;
}

.dele-title-box h1 {
    font-size: 1.2rem;
    font-weight: 800;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dele-level-badge {
    display: inline-block;
    background: var(--cervantes-burgundy);
    color: #ffffff;
    font-weight: 900;
    font-size: 1.1rem;
    padding: 0.2rem 0.8rem;
    margin-top: 0.35rem;
    border-radius: 3px;
    letter-spacing: 0.05em;
}

/* Candidate Identification Grid (Exact DELE Replica) */
.candidate-id-box {
    background: var(--cervantes-cream);
    border: 1px solid var(--cervantes-border);
    padding: 0.85rem 1.25rem;
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    gap: 1rem;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .candidate-id-box { grid-template-columns: 1fr; }
}

.id-field label {
    display: block;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--cervantes-muted);
    margin-bottom: 0.2rem;
}

.id-field .dotted-line {
    border-bottom: 1px dotted #888;
    height: 1.5rem;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #1e3a8a;
    padding: 0 0.3rem;
}

/* Exam Mode Switcher & Sticky Action Bar */
.exam-control-bar {
    background: #f8f8f8;
    border-bottom: 1px solid #ddd;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.mode-toggle-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.mode-btn {
    background: #ffffff;
    border: 1px solid #ccc;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s;
}

.mode-btn.active {
    background: var(--cervantes-burgundy);
    color: white;
    border-color: var(--cervantes-burgundy);
}

.timer-box {
    font-family: monospace;
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--cervantes-burgundy);
    background: #fff;
    padding: 0.3rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Skill Navigation Tabs */
.dele-tabs {
    display: flex;
    background: #f1ede6;
    border-bottom: 2px solid var(--cervantes-burgundy);
    overflow-x: auto;
}

.dele-tab-btn {
    background: none;
    border: none;
    padding: 0.85rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #444;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-right: 1px solid #dedede;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.dele-tab-btn:hover {
    background: #e6e0d5;
}

.dele-tab-btn.active {
    background: var(--cervantes-burgundy);
    color: #ffffff;
}

/* Exam Content Container */
.paper-body {
    padding: 2rem;
}

@media (max-width: 600px) {
    .paper-body { padding: 1rem; }
}

/* Official DELE Instruction Box */
.dele-instructions {
    background: var(--cervantes-box-bg);
    border: 1px solid var(--cervantes-border);
    border-left: 5px solid var(--cervantes-burgundy);
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.75rem;
    font-size: 0.95rem;
}

.dele-instructions .inst-title {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--cervantes-burgundy);
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    display: flex;
    justify-content: space-between;
}

.dele-instructions p {
    color: #222;
    margin: 0;
}

/* Document Presentation Boxes (Authentic Artifacts) */
.dele-document {
    margin-bottom: 1.5rem;
    border: 1px solid #c8c8c8;
    background: #ffffff;
    border-radius: 2px;
}

/* Simulated Email */
.doc-email {
    border: 1px solid #b0bec5;
}

.doc-email .email-header {
    background: #eceff1;
    border-bottom: 1px solid #cfd8dc;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: #37474f;
}

.doc-email .email-header strong {
    color: #263238;
}

.doc-email .email-body {
    padding: 1.1rem;
    font-family: var(--font-official);
    font-size: 0.95rem;
    color: #212121;
}

/* Simulated Public Notice / Cartel */
.doc-notice {
    border: 2px solid #546e7a;
    background: #fafafa;
}

.doc-notice .notice-header {
    background: #546e7a;
    color: #ffffff;
    text-align: center;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4rem;
    font-size: 0.9rem;
}

.doc-notice .notice-body {
    padding: 1.1rem;
    font-size: 0.95rem;
}

/* Classified Ads Grid (Tarea 2) */
.ads-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 700px) {
    .ads-grid { grid-template-columns: 1fr; }
}

.ad-card {
    border: 1px dashed #78909c;
    background: #fdfdfd;
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
}

.ad-card .ad-letter {
    display: inline-block;
    background: var(--cervantes-burgundy);
    color: #fff;
    font-weight: bold;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    border-radius: 50%;
    margin-right: 0.4rem;
}

.ad-card h4 {
    display: inline;
    color: #111;
    font-size: 0.92rem;
}

.ad-card p {
    margin-top: 0.4rem;
    color: #333;
}

/* Question Items */
.dele-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e5e5e5;
}

.dele-item-stem {
    font-weight: 700;
    font-size: 1rem;
    color: #111;
    margin-bottom: 0.75rem;
}

.dele-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* DELE Letter Bubble Radio Options */
.dele-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0.9rem;
    background: #ffffff;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.dele-option:hover {
    background: #f7f7f7;
    border-color: #999;
}

.dele-option input[type="radio"] {
    display: none;
}

.option-bubble {
    width: 26px;
    height: 26px;
    border: 2px solid #555;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: #444;
    flex-shrink: 0;
    background: #fff;
    transition: all 0.15s;
}

.dele-option:has(input[type="radio"]:checked) {
    background: #fdf5f5;
    border-color: var(--cervantes-burgundy);
}

.dele-option:has(input[type="radio"]:checked) .option-bubble {
    background: var(--cervantes-burgundy);
    color: #ffffff;
    border-color: var(--cervantes-burgundy);
}

/* Explanations (revealed in Study Mode or after submission) */
.dele-explanation {
    display: none;
    background: #f0fdf4;
    border-left: 4px solid var(--cervantes-correct);
    padding: 0.85rem 1.1rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #14532d;
}

.is-correct-box {
    background: #f0fdf4 !important;
    border-color: var(--cervantes-correct) !important;
}

.is-wrong-box {
    background: #fef2f2 !important;
    border-color: var(--cervantes-wrong) !important;
}

/* ==========================================================================
   OFFICIAL DELE HOJA DE RESPUESTAS (OMR BUBBLE SHEET REPLICA)
   ========================================================================== */
.omr-sheet-container {
    background: var(--cervantes-omr-bg);
    border: 2px solid var(--cervantes-omr-red);
    padding: 1.5rem;
    margin-top: 2rem;
    font-family: var(--font-official);
}

.omr-sheet-header {
    text-align: center;
    border-bottom: 2px solid var(--cervantes-omr-red);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.omr-sheet-header h3 {
    color: var(--cervantes-omr-red);
    font-size: 1.2rem;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.omr-instructions {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.35rem;
    text-transform: uppercase;
}

.omr-instructions span {
    font-weight: bold;
    color: #111;
}

.omr-columns-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 650px) {
    .omr-columns-grid { grid-template-columns: 1fr; }
}

.omr-section-box {
    background: #fff;
    border: 1px solid #e0c2be;
    padding: 1rem;
}

.omr-section-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--cervantes-omr-red);
    text-transform: uppercase;
    border-bottom: 1px solid #e0c2be;
    padding-bottom: 0.4rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.omr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid #f2f2f2;
    font-size: 0.85rem;
}

.omr-row .omr-num {
    font-weight: 700;
    width: 25px;
    color: #333;
}

.omr-bubbles {
    display: flex;
    gap: 0.5rem;
}

.omr-bubble-btn {
    width: 24px;
    height: 18px;
    border: 1px solid #777;
    border-radius: 50% / 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #444;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s;
}

.omr-bubble-btn.filled {
    background: #222222;
    color: #ffffff;
    border-color: #000;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}

/* Submission & Grading Bar */
.dele-action-bar {
    position: sticky;
    bottom: 0;
    background: #262626;
    color: #ffffff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 99;
    border-top: 3px solid var(--cervantes-burgundy);
}

.dele-submit-btn {
    background: var(--cervantes-burgundy);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}

.dele-submit-btn:hover {
    background: var(--cervantes-burgundy-dark);
}
