/* =========================================================================
   CN Militar "Tudor Vladimirescu" — Sistem de raportare
   Direcție vizuală: consolă de operațiuni / dosar de unitate.
   Verde-oliv închis + alamă, tipografie condensată + monospace pentru
   date și numere de dosar. Dezvoltat de ZenyaProtect.
   ========================================================================= */

:root {
    --bg: #14170F;
    --panel: #1D2117;
    --panel-alt: #262C1E;
    --border: #333B27;
    --border-soft: #2A311F;

    --ink: #ECE8D8;
    --ink-dim: #A7AD95;
    --ink-faint: #7A8069;

    --brass: #C9A227;
    --brass-soft: #8F7420;
    --olive: #5C6E44;
    --olive-soft: #47552F;

    --steel: #5B84A8;
    --moss: #6B9159;
    --rust: #B0503F;

    --font-display: "Oswald", "Arial Narrow", sans-serif;
    --font-stencil: "Black Ops One", "Oswald", sans-serif;
    --font-body: "Inter", "Segoe UI", Arial, sans-serif;
    --font-mono: "IBM Plex Mono", "Consolas", monospace;

    --radius: 3px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 480px 320px at 8% 0%, rgba(76, 89, 53, 0.12), transparent 60%),
        radial-gradient(ellipse 520px 360px at 92% 30%, rgba(58, 48, 26, 0.14), transparent 60%),
        radial-gradient(ellipse 420px 300px at 15% 85%, rgba(107, 124, 74, 0.09), transparent 60%);
    background-attachment: fixed;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--brass); color: #1A1D13; }

a { color: var(--brass); }
a:hover { color: #ddb838; }

*:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* -------------------------------------------------------------------- */
/* Structură generală: sidebar tip consolă + zonă principală            */
/* -------------------------------------------------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 236px;
    flex-shrink: 0;
    background-color: var(--panel);
    background-image:
        radial-gradient(ellipse 140px 90px at 15% 10%, rgba(92, 110, 68, 0.4), transparent 65%),
        radial-gradient(ellipse 170px 110px at 85% 25%, rgba(58, 48, 26, 0.45), transparent 65%),
        radial-gradient(ellipse 120px 150px at 55% 60%, rgba(107, 124, 74, 0.3), transparent 65%),
        radial-gradient(ellipse 160px 100px at 20% 90%, rgba(40, 44, 28, 0.5), transparent 65%),
        radial-gradient(ellipse 130px 90px at 90% 85%, rgba(92, 110, 68, 0.3), transparent 65%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 26px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 22px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--brass);
}

.insignia { color: var(--brass); flex-shrink: 0; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }

.brand-title {
    font-family: var(--font-stencil);
    font-weight: 400;
    font-size: 0.92rem;
    letter-spacing: 0.04em;
    color: var(--ink);
    text-transform: uppercase;
    line-height: 1.3;
}

.brand-sub {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.05em;
    color: var(--ink-faint);
    text-transform: uppercase;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--ink-dim);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    border-left: 2px solid transparent;
}

.nav-link:hover { background: var(--panel-alt); color: var(--ink); }

.nav-link-active {
    background: var(--panel-alt);
    color: var(--brass);
    border-left: 2px solid var(--brass);
}

.nav-group-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    padding: 12px 12px 2px;
}
.nav-group-label:first-child { padding-top: 0; }

.badge-nav {
    display: inline-block;
    background: var(--rust);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.68rem;
    font-weight: 700;
    margin-left: 4px;
    font-family: var(--font-mono);
}

.sidebar-footer {
    border-top: 1px solid var(--border-soft);
    padding-top: 16px;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-chip {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    position: relative;
}
.user-chip::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
}
.user-name { font-size: 0.86rem; font-weight: 600; color: var(--ink); }
.user-role {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brass-soft);
}

.btn-logout-link {
    font-size: 0.82rem;
    color: var(--ink-faint);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 10px;
    text-align: center;
}
.btn-logout-link:hover { color: var(--rust); border-color: var(--rust); }

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.container {
    flex: 1;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 34px 26px 60px;
}

/* -------------------------------------------------------------------- */
/* Butonul hamburger — vizibil și funcțional pe orice dimensiune de ecran */
/* -------------------------------------------------------------------- */
.nav-toggle-btn {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 0;
}

.nav-toggle-btn:hover { border-color: var(--brass); }

.nav-toggle-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--brass);
    border-radius: 2px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

/* Pe ecran larg (laptop/desktop): meniul e vizibil implicit; butonul îl
   poate ascunde/arăta la cerere, ca să eliberezi spațiu pe ecran. */
@media (min-width: 861px) {
    #sidebar.nav-toggled .nav,
    #sidebar.nav-toggled .sidebar-footer {
        display: none;
    }
}

/* Pe telefon/tabletă: meniul e ascuns implicit; butonul îl deschide. */
@media (max-width: 860px) {
    .app-shell { flex-direction: column; }

    .sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        z-index: 100;
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        overflow: visible;
        overflow-x: hidden;
    }

    .brand {
        border-bottom: none;
        padding: 14px 16px;
        margin-bottom: 0;
        flex-shrink: 0;
        position: relative;
    }

    .nav, .sidebar-footer {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0 16px 16px;
        gap: 4px;
    }

    #sidebar.nav-toggled .nav,
    #sidebar.nav-toggled .sidebar-footer {
        display: flex;
    }

    .nav-link { padding: 12px 12px; font-size: 0.98rem; }
    .sidebar-footer { border-top: 1px solid var(--border-soft); padding-top: 14px; margin-top: 4px; gap: 12px; }
    .user-chip { display: flex; }

    .container { padding: 20px 16px 40px; }
}

/* Animația de "X" a butonului, indiferent de ecran, cât timp e activ */
#sidebar.nav-toggled .nav-toggle-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#sidebar.nav-toggled .nav-toggle-btn span:nth-child(2) { opacity: 0; }
#sidebar.nav-toggled .nav-toggle-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* -------------------------------------------------------------------- */
/* Tipografie                                                            */
/* -------------------------------------------------------------------- */
h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink);
    margin: 0 0 6px;
}

h2 { font-family: var(--font-display); font-weight: 500; color: var(--ink); }

.subtitlu {
    font-family: var(--font-display);
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--brass);
    margin: 26px 0 12px;
    padding-bottom: 10px;
    position: relative;
}

.subtitlu::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: repeating-linear-gradient(
        135deg,
        var(--brass) 0px, var(--brass) 9px,
        transparent 9px, transparent 18px
    );
    opacity: 0.5;
}

.subtitlu-mic {
    font-family: var(--font-display);
    font-size: 0.98rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink);
    margin: 0;
}

.eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--brass);
    margin-bottom: 8px;
}

.muted { color: var(--ink-dim); }

.mono {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--ink-dim);
    font-size: 0.85em;
}

.case-id {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    color: var(--brass);
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: var(--radius);
    padding: 1px 6px;
    white-space: nowrap;
}

/* -------------------------------------------------------------------- */
/* Carduri și marcaj de dosar (semnătura vizuală a site-ului)            */
/* -------------------------------------------------------------------- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card-narrow {
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

.card-marcaj {
    position: relative;
    background-color: var(--panel);
    background-image:
        radial-gradient(ellipse 160px 100px at 90% 0%, rgba(92, 110, 68, 0.18), transparent 65%),
        radial-gradient(ellipse 140px 120px at 5% 100%, rgba(58, 48, 26, 0.22), transparent 65%);
}

.card-marcaj::before,
.card-marcaj::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--brass);
    border-style: solid;
    opacity: 0.9;
    pointer-events: none;
}

.card-marcaj::before { top: -1px; left: -1px; border-width: 3px 0 0 3px; }
.card-marcaj::after { bottom: -1px; right: -1px; border-width: 0 3px 3px 0; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
    padding-bottom: 14px;
    position: relative;
}

.page-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: repeating-linear-gradient(
        135deg,
        var(--brass) 0px, var(--brass) 9px,
        transparent 9px, transparent 18px
    );
    opacity: 0.55;
}

/* -------------------------------------------------------------------- */
/* Formulare                                                             */
/* -------------------------------------------------------------------- */
label {
    display: block;
    margin: 14px 0 6px;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-dim);
}

input, select, textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brass);
}

textarea { resize: vertical; }

::placeholder { color: var(--ink-faint); }

/* -------------------------------------------------------------------- */
/* Butoane                                                               */
/* -------------------------------------------------------------------- */
.btn {
    display: inline-block;
    border: none;
    border-radius: var(--radius);
    padding: 10px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: var(--brass);
    color: #1A1D13;
    margin-top: 16px;
}
.btn-primary:hover { background: #ddb838; }

.btn-warning {
    background: transparent;
    color: var(--brass);
    border: 1px solid var(--brass);
    margin-top: 0;
}
.btn-warning:hover { background: rgba(201, 162, 39, 0.12); }

.btn-danger {
    background: transparent;
    color: var(--rust);
    border: 1px solid var(--rust);
    margin-top: 0;
}
.btn-danger:hover { background: rgba(176, 80, 63, 0.15); }

/* -------------------------------------------------------------------- */
/* Mesaje de sistem (flash)                                              */
/* -------------------------------------------------------------------- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.flash-error { background: rgba(176, 80, 63, 0.12); color: #E08874; border-color: rgba(176, 80, 63, 0.4); }
.flash-success { background: rgba(107, 145, 89, 0.14); color: #9BC98A; border-color: rgba(107, 145, 89, 0.4); }

/* -------------------------------------------------------------------- */
/* Tabele                                                                */
/* -------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.tabel { width: 100%; border-collapse: collapse; }

.tabel th, .tabel td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.88rem;
}

.tabel th {
    background: var(--panel-alt);
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tabel tr:last-child td { border-bottom: none; }
.tabel tr:hover td { background: rgba(201, 162, 39, 0.04); }

/* -------------------------------------------------------------------- */
/* Insigne (status / rol / stare cont)                                   */
/* -------------------------------------------------------------------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #14170F;
}

.badge-trimis { background: var(--steel); color: #0F1A22; }
.badge-in_lucru { background: var(--brass); }
.badge-rezolvat { background: var(--moss); }
.badge-respins { background: var(--rust); color: #fff; }

.badge-rol-elev { background: var(--steel); color: #0F1A22; }
.badge-rol-admin { background: var(--olive); color: #0E140A; }
.badge-rol-dezvoltator { background: var(--brass); }

.badge-activ { background: var(--moss); }
.badge-inactiv { background: var(--rust); color: #fff; }

.badge-usoara { background: var(--steel); color: #0F1A22; }
.badge-medie { background: var(--brass); }
.badge-grava { background: var(--rust); color: #fff; }

.badge-curat { background: var(--moss); }
.badge-murdar { background: var(--rust); color: #fff; }

.poza-control {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
    margin-top: 10px;
}

/* -------------------------------------------------------------------- */
/* Statistici                                                            */
/* -------------------------------------------------------------------- */
.stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    min-width: 110px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
}

.stat-card:hover { border-color: var(--brass-soft); }

.stat-card.active {
    border-color: var(--brass);
    box-shadow: inset 0 0 0 1px var(--brass);
}

.stat-number {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--brass);
}

.stat-label {
    display: block;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-dim);
    margin-top: 4px;
}

/* -------------------------------------------------------------------- */
/* Detaliu (definition list)                                             */
/* -------------------------------------------------------------------- */
.detalii {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 12px;
    margin: 16px 0;
}

.detalii dt {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
}

.detalii dd { margin: 0; color: var(--ink); }

.inline-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    margin-top: 14px;
    flex-wrap: wrap;
}

.inline-form select { width: auto; }
.inline-form label { margin: 0; }
.inline-form .btn { margin-top: 0; }

/* -------------------------------------------------------------------- */
/* Mesaje (elev / admin / cameră)                                        */
/* -------------------------------------------------------------------- */
.mesaj-card { margin-bottom: 12px; }

.mesaj-necitit { border-left: 3px solid var(--brass); }

.mesaj-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.mesaj-continut { margin: 0; white-space: pre-wrap; color: var(--ink); }

/* -------------------------------------------------------------------- */
/* Camere                                                                */
/* -------------------------------------------------------------------- */
.lista-elevi { margin: 8px 0 0; padding-left: 20px; }
.lista-elevi li { margin-bottom: 4px; }

.repartizare-form { display: flex; gap: 8px; align-items: center; }
.repartizare-form select { width: auto; }
.input-editare-nume { max-width: 160px; }
.input-editare-pret { max-width: 90px; }

/* -------------------------------------------------------------------- */
/* Mentenanță                                                            */
/* -------------------------------------------------------------------- */
.mentenanta-panou { border-left: 3px solid var(--moss); }
.mentenanta-panou-activ { border-left: 3px solid var(--rust); }
.mentenanta-card { text-align: center; }

.mentenanta-mesaj {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-style: italic;
    color: var(--ink-dim);
}

/* -------------------------------------------------------------------- */
/* Subsol                                                                */
/* -------------------------------------------------------------------- */
.footer {
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid var(--border-soft);
    color: var(--ink-faint);
    font-size: 0.8rem;
}

.footer p { margin: 4px 0; }

.footer-copyright {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}

.footer-copyright strong { color: var(--brass-soft); }

/* -------------------------------------------------------------------- */
/* Tabele -> carduri verticale pe telefon (fara scroll lateral)          */
/* -------------------------------------------------------------------- */
@media (max-width: 700px) {
    .table-wrap {
        overflow-x: visible;
        border: none;
        background: transparent;
    }

    .tabel, .tabel thead, .tabel tbody, .tabel th, .tabel td, .tabel tr {
        display: block;
        width: 100%;
    }

    .tabel thead { display: none; }

    .tabel tr {
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 12px;
        padding: 4px 14px;
    }

    .tabel tr:hover td { background: transparent; }

    .tabel td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-soft);
        text-align: right;
        white-space: normal;
        word-break: break-word;
        flex-wrap: wrap;
    }

    .tabel td:last-child { border-bottom: none; }

    .tabel td::before {
        content: attr(data-label);
        font-family: var(--font-mono);
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--ink-faint);
        text-align: left;
        flex-shrink: 0;
    }

    /* Rândurile cu formulare inline (repartizare, editare) stau pe toată lățimea */
    .tabel td:has(form),
    .tabel td:has(select) {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    .tabel td:has(form)::before,
    .tabel td:has(select)::before {
        margin-bottom: 6px;
    }

    .repartizare-form, .inline-form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .repartizare-form select, .repartizare-form input,
    .inline-form select, .inline-form input {
        width: 100%;
        max-width: none;
    }

    .detalii {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }
    .detalii dt { margin-top: 8px; }
    .detalii dt:first-child { margin-top: 0; }
}
