/* ==========================================================================
   GLOBAL.CSS — MatePro
   Toate stilurile comune pentru subiectul1, subiectul2, subiectul3
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET & BAZA
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    color: #1f2937;
}

/* --------------------------------------------------------------------------
   2. KATEX — mărime uniformă pentru toate formulele
   -------------------------------------------------------------------------- */
.katex {
    font-size: 1.05rem !important;
}

/* --------------------------------------------------------------------------
   3. CONTAINER & TITLURI (folosit de toate paginile)
   -------------------------------------------------------------------------- */
.mp-container {
    max-width: 800px;
    margin: 0 auto;
}

.mp-status {
    margin-bottom: 20px;
    font-style: italic;
    color: #666;
}

/* --------------------------------------------------------------------------
   4. CARD EXERCIȚIU — stiluri de bază comune
   -------------------------------------------------------------------------- */
.card-exercitiu {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.ex-title {
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 8px;
}

.ex-enunt {
    font-size: 1.1em;
    margin-bottom: 15px;
}

.ex-img {
    display: block;
    margin: 15px auto;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* --------------------------------------------------------------------------
   5. GRILĂ RĂSPUNSURI (Subiectele 1 și 2)
   -------------------------------------------------------------------------- */
.grila-optiuni {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.btn-optiune {
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    font-size: 1em;
    transition: all 0.2s;
    text-align: left;
}

.btn-optiune:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.btn-optiune.selected {
    background-color: #e0f2fe;
    border-color: #3b82f6;
    font-weight: bold;
}

/* --------------------------------------------------------------------------
   6. BUTOANE DE ACȚIUNE (Verifică / Generează)
   -------------------------------------------------------------------------- */
.zona-control {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 50px;
}

.btn-actiune {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: opacity 0.2s;
}

.btn-actiune:hover {
    opacity: 0.9;
}

/* Culori specifice per acțiune */
.btn-verifica  { background-color: #059669; } /* verde */
.btn-genereaza { background-color: #2563eb; } /* albastru */

/* --------------------------------------------------------------------------
   7. REZULTAT FINAL (panoul de scor)
   -------------------------------------------------------------------------- */
.rezultat-final {
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* --------------------------------------------------------------------------
   8. BUTON RAPORTEAZĂ EROARE
   -------------------------------------------------------------------------- */
.btn-raporteaza {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 10px;
}

.btn-raporteaza:hover {
    color: #ef4444;
}

/* --------------------------------------------------------------------------
   9. TEME PER SUBIECT
   -------------------------------------------------------------------------- */

/* — Subiectul 1: verde — */
body.tema-s1 {
    background: #f0fdf4;
}
body.tema-s1 .mp-header-title { color: #166534; border-bottom: 2px solid #bbf7d0; }
body.tema-s1 .mp-info-bar      { background: #dcfce7; }
body.tema-s1 .card-exercitiu   { border: 2px solid #bbf7d0; }
body.tema-s1 .ex-title         { color: #166534; }

/* — Subiectul 2: albastru — */
body.tema-s2 {
    background: #f0f7ff;
}
body.tema-s2 .mp-header-title { color: #1e40af; border-bottom: 2px solid #bfdbfe; }
body.tema-s2 .mp-info-bar      { background: #dbeafe; }
body.tema-s2 .card-exercitiu   { border: 2px solid #bfdbfe; }
body.tema-s2 .ex-title         { color: #1e40af; }

/* — Subiectul 3: portocaliu/chihlimbar — */
body.tema-s3 {
    background: #fdf6ec;
}
body.tema-s3 .mp-header-title { color: #d35400; border-bottom: 2px solid #f5cba7; }
body.tema-s3 .mp-info-bar      { background: #fff3e0; }
body.tema-s3 .card-exercitiu   { border: 2px solid #f5cba7; }
body.tema-s3 .ex-title         { color: #d35400; }

/* --------------------------------------------------------------------------
   10. ELEMENTE SPECIFICE SUBIECTUL 3 (subpuncte, hint, rezolvare)
   -------------------------------------------------------------------------- */
.subpunct-container {
    background: #fffbf7;
    border-left: 4px solid #e67e22;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 0 8px 8px 0;
}

.btn-hint {
    background: #fbf1e6;
    border: 1px solid #e0a96d;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    margin-top: 10px;
    display: inline-block;
    color: #d35400;
}

.btn-hint:hover {
    background: #f5e4d3;
}

.panou-rezolvare {
    display: none;
    background: #fbf1e6;
    border: 1px dashed #e0a96d;
    border-radius: 8px;
    padding: 15px;
    margin-top: 12px;
    font-size: 0.95em;
}

/* --------------------------------------------------------------------------
   11. ELEMENTE MATEMATICE INTERACTIVE (parser formule cu căsuțe)
   -------------------------------------------------------------------------- */
.matematica-template-wrapper {
    display: block;
    margin: 16px 0 8px 0;
    padding: 10px 14px;
    background: #faf5ff;
    border: 1.5px solid #e9d5ff;
    border-radius: 12px;
    clear: both;
}

.math-flex-row {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.35rem;
    font-weight: bold;
    color: #3b0764;
    line-height: 1.8;
}

.math-flex-row span {
    font-style: normal !important;
    font-weight: bold !important;
    color: #3b0764;
}

/* Fracții */
.math-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    padding: 0 6px;
    gap: 2px;
}

.math-num {
    padding-bottom: 2px;
    text-align: center;
    width: 100%;
}

.math-den {
    border-top: 2px solid #7e22ce;
    padding-top: 3px;
    text-align: center;
    width: 100%;
}

/* Radicali */
.math-sqrt {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    position: relative;
    padding-left: 2px;
}

.math-sqrt-symbol {
    font-size: 1.6rem;
    margin-right: -2px;
    user-select: none;
    color: #7e22ce;
    line-height: 1;
}

.math-sqrt-content {
    border-top: 2px solid #7e22ce;
    padding-top: 2px;
    padding-left: 3px;
    padding-right: 3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Operatori */
.math-operator {
    display: inline-block;
    margin: 0 8px;
    font-weight: 600;
    color: #7e22ce;
    user-select: none;
    font-size: 1.2rem;
}

/* Infinit (∞ și -∞ — simbol fix, nu input) */
.math-infty {
    font-style: italic;
    font-weight: bold;
    color: #3b0764;
    padding: 0 2px;
    user-select: none;
}

/* Unghi (∠ — simbol fix, nu input) */
.math-angle {
    font-style: normal;
    font-weight: bold;
    color: #3b0764;
    padding: 0 1px 0 0;
    user-select: none;
}

/* Putere (_^_) — bază + exponent suprascriat */
.math-power {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    vertical-align: middle;
}

.math-exp {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    line-height: 1;
}

/* Căsuța din exponent — mai mică decât cea normală */
.math-mini-input--exp {
    width: 26px !important;
    height: 22px !important;
    font-size: 0.7rem !important;
    padding: 0 2px !important;
}

/* Căsuțe mini (în interiorul șabloanelor) */
.math-mini-input {
    width: 48px !important;
    height: 36px !important;
    text-align: center !important;
    font-family: 'Times New Roman', serif;
    font-size: 1.05rem;
    font-weight: bold;
    color: #3b0764;
    border: 1.5px solid #c4b5fd !important;
    border-radius: 8px !important;
    background-color: #faf5ff !important;
    transition: all 0.2s ease;
    outline: none;
    padding: 0;
    box-shadow: 0 1px 3px rgba(124, 58, 237, 0.08);
}

.math-mini-input:focus {
    border-color: #7c3aed !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12) !important;
}

.math-mini-input.corecta {
    border-color: #22c55e !important;
    background-color: #f0fdf4 !important;
}

.math-mini-input.gresita {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

/* Căsuța mare standard (fără șablon) */
.math-standard-container {
    display: block;
    margin-top: 12px;
}

.input-raspuns {
    width: 100%;
    max-width: 220px;
    padding: 8px 14px;
    border: 1.5px solid #c4b5fd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Times New Roman', serif;
    color: #3b0764;
    background: #faf5ff;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(124, 58, 237, 0.08);
}

.input-raspuns:focus {
    border-color: #7c3aed !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12) !important;
}

.input-raspuns.corecta {
    border-color: #22c55e !important;
    background-color: #f0fdf4 !important;
}

.input-raspuns.gresita {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

/* ==========================================================================
   STILURI SPECIFICE TEST COMPLET
   ========================================================================== */

/* Tema lila/mov pentru test-complet.html */
body.tema-test {
    background-color: #faf5ff;
    color: #3b0764;
}

.tema-test .container {
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(107, 33, 168, 0.05);
}

.tema-test h1, .tema-test h2 {
    text-align: center;
    color: #6b21a8;
}

.sectiune-titlu {
    border-bottom: 3px solid #e9d5ff;
    padding-bottom: 8px;
    margin-top: 40px;
    margin-bottom: 20px;
    color: #7e22ce;
    font-size: 1.5em;
    font-weight: bold;
}

/* Card exercitiu — suprascrie tema de baza pentru mov */
.tema-test .card-exercitiu {
    background-color: #fdfaff;
    border: 1px solid #e9d5ff;
    position: relative;
}

.tema-test .ex-title { color: #6b21a8; }

/* Grila optiuni test complet */
.optiuni-grila {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 15px;
}

.tema-test .btn-optiune {
    background: #ffffff;
    border: 1px solid #d8b4fe;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 0.95em;
    color: #581c87;
    transition: all 0.2s;
}

.tema-test .btn-optiune:hover   { background: #f3e8ff; }
.tema-test .btn-optiune.selected {
    background: #c084fc !important;
    color: #ffffff !important;
    border-color: #a855f7;
}

/* Subpuncte S3 — suprascrie culoarea linie stanga */
.tema-test .subpunct-container {
    border-left: 4px solid #7e22ce;
    background: rgba(243, 232, 255, 0.3);
}

.tema-test .btn-hint {
    background: #f3e8ff;
    border: 1px solid #d8b4fe;
    color: #6b21a8;
}

.tema-test .panou-rezolvare {
    background: #faf5ff;
    border: 1px dashed #c084fc;
}

/* Butoane actiune test complet */
.tema-test .btn-verifica  { background: #7e22ce; }
.tema-test .btn-genereaza { background: #a855f7; }

/* Rezultat final test complet */
.tema-test .rezultat-final {
    background: #faf5ff;
    border: 2px solid #bab3ff;
}

/* Avertisment completare */
.mesaj-avertisment {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin-top: 15px;
    display: none;
}

/* Cronometru fix */
#cronometru {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #6b21a8;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buton printare admin */
#btn-printare {
    display: none;
    background: #9333ea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 20px;
}

/* ==========================================================================
   PRINT — Test Complet
   ========================================================================== */
@media print {
    @page { size: A4; margin: 12mm 15mm; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; box-sizing: border-box !important; }

    #cronometru, .zona-control, #btn-printare, .btn-hint, .panou-rezolvare,
    .mesaj-avertisment, #status, .rezultat-final, #rezultat-test,
    .btn-rezolvare-ascuns, .btn-raporteaza, .mp-info-bar { display: none !important; }

    body {
        background: #fff !important; color: #000 !important;
        font-size: 10pt !important; line-height: 1.45 !important;
        padding: 0 !important; margin: 0 !important;
        font-family: 'Times New Roman', serif !important;
    }

    .katex, .katex * { font-size: 10pt !important; }
    .katex-display { margin: 2px 0 !important; }

    .container { box-shadow: none !important; border-radius: 0 !important; padding: 0 !important; max-width: 100% !important; margin: 0 !important; }

    h1 { font-size: 13pt !important; text-align: center !important; margin: 0 0 2px 0 !important; }
    h2 { font-size: 10pt !important; text-align: center !important; font-weight: normal !important; font-style: italic !important; margin: 0 0 10px 0 !important; }
    h1::before {
        content: "MatePro — matepro10.ro";
        display: block; font-size: 7.5pt !important; font-weight: normal !important;
        color: #7e22ce !important; letter-spacing: 1.5px !important;
        text-transform: uppercase !important; text-align: center !important;
        margin-bottom: 3px !important; font-family: Arial, sans-serif !important;
    }

    .sectiune-titlu {
        font-size: 10pt !important; font-weight: bold !important;
        text-transform: uppercase !important; border-bottom: 1.5px solid #000 !important;
        margin: 8px 0 5px 0 !important; padding-bottom: 2px !important;
        page-break-after: avoid !important; color: #000 !important;
        page-break-before: always !important;
    }

    /* Prima sectiune nu rupe pagina */
    #subiect1-container ~ * .sectiune-titlu:first-child,
    .sectiune-titlu:first-of-type { page-break-before: avoid !important; }

    .card-exercitiu {
        display: block !important; position: relative !important;
        border: 0.75px solid #666 !important; border-radius: 0 !important;
        margin-bottom: 5px !important; padding: 5px 8px 5px 28px !important;
        background: transparent !important; page-break-inside: avoid !important;
    }

    .card-exercitiu::before {
        content: "5p"; position: absolute !important;
        left: 4px !important; top: 5px !important;
        font-size: 8pt !important; font-weight: bold !important;
        color: #000 !important; font-family: Arial, sans-serif !important;
    }

    .card-exercitiu::after { content: ""; display: table; clear: both; }

    .ex-title {
        font-weight: bold !important; font-size: 10pt !important;
        margin: 0 0 3px 0 !important; color: #000 !important; display: block !important;
    }
    .ex-title span { display: none !important; }
    .ex-title button { display: none !important; }

    .ex-enunt { font-size: 10pt !important; margin: 2px 0 5px 0 !important; line-height: 1.4 !important; display: block !important; }

    /* Imagini mai mari */
    .ex-img {
        float: right !important; max-height: 110px !important;
        max-width: 160px !important; margin: 0 0 5px 10px !important; display: block !important;
    }

    /* Opțiuni pe verticală */
    .grila-optiuni, .optiuni-grila {
        display: block !important; margin-top: 4px !important;
        columns: 1 !important;
    }

    .btn-optiune {
        display: block !important; border: none !important;
        background: transparent !important; color: #000 !important;
        padding: 1px 0 !important; font-size: 10pt !important;
        font-family: 'Times New Roman', serif !important; text-align: left !important;
        width: 100% !important;
    }

    .input-raspuns, .matematica-template-wrapper, .math-mini-input { display: none !important; }

    /* S3 subpuncte pe linii */
    .subpunct-container {
        display: block !important; width: 100% !important;
        border-left: none !important; background: transparent !important;
        padding: 4px 0 0 0 !important; margin: 6px 0 0 0 !important;
        clear: both !important;
    }

    /* Căsuță rezolvare S3 — înaltă, cu border simplu */
    .subpunct-container::after {
        content: ""; display: block; margin-top: 5px;
        width: 100%; height: 100mm;
        border: 0.75px solid #888; background: #fff;
    }

    /* S3: 1 exercițiu per pagină, ocupă pagina */
    #subiect3-container .card-exercitiu {
        border: none !important; padding: 0 !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
        min-height: 230mm !important;
    }

    #subiect3-container { page-break-before: always !important; }
    #subiect2-container { page-break-before: always !important; }
}
