/* ==========================================================================
   SomaPublish — Modern Government Portal
   ========================================================================== */

/* Local Noto Naskh Arabic */
@font-face {
    font-family: 'Noto Naskh Arabic';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/NotoNaskhArabic-arabic.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
    font-family: 'Noto Naskh Arabic';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/NotoNaskhArabic-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Noto Naskh Arabic';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/NotoNaskhArabic-arabic.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
    font-family: 'Noto Naskh Arabic';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/NotoNaskhArabic-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD;
}

:root {
    --gold: #C4A95B;
    --gold-hover: #b39a4e;
    --gold-light: rgba(196, 169, 91, 0.15);
    --gold-border: rgba(196, 169, 91, 0.4);
    --charcoal: #3D3D3D;
    --bg: #F7F6F3;
    --surface: #FFFFFF;
    --text: #2A2A2A;
    --text-muted: #6B6B6B;
    --border: #E4E2DC;
    --ok: #2E7D32;
    --ok-bg: #E8F5E9;
    --no: #C62828;
    --no-bg: #FFEBEE;
    --cancel-bg: rgba(196, 169, 91, 0.2);
    --font: "Noto Naskh Arabic", "Droid Arabic Naskh", "Segoe UI", sans-serif;
    --font-lat: "Calibri", "Segoe UI", "Helvetica Neue", sans-serif;
    --nav-h: 70px;
    --foot-h: 50px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
    font-family: var(--font);
    direction: rtl;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: #4A7BC7; }

.hidden { display: none !important; }

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* --- Navbar --- */
.navbar {
    background: var(--gold);
    height: var(--nav-h);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.navbar .container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding-inline: 12px;
    display: flex;
    align-items: center;
}

.navbar-brand { padding: 4px; flex-shrink: 0; }
.navbar-brand img { height: 56px; }

.navbar-text {
    padding-inline-start: 12px;
    flex: 1;
}

.navbar-text h5,
.navbar-text h4 {
    color: white;
    text-align: start;
    margin: 0;
    font-weight: normal;
    line-height: 1.3;
}
.navbar-text h5 { font-size: 18px; }
.navbar-text h4 { font-size: 22px; font-weight: bold; }

/* --- Container --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding-inline: 12px;
}

/* --- Footer --- */
.footer {
    height: var(--foot-h);
    line-height: var(--foot-h);
    background: var(--charcoal);
    color: rgba(255,255,255,0.6);
    text-align: center;
    font-size: 18px;
    direction: ltr;
    flex-shrink: 0;
    margin-block-start: auto;
    font-family: var(--font-lat);
}

/* --- Forms (Index page) --- */
.form-control1 {
    direction: ltr;
    width: 300px;
    height: 45px;
    font-size: 14pt;
    text-align: center;
    padding: 10px;
    margin-block-start: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-lat);
    background: var(--surface);
}
.form-control1:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-light);
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font);
    text-align: center;
    transition: background-color 0.15s;
}
.btn-info {
    background: var(--gold);
    color: white;
    width: 150px;
}
.btn-info:hover { background: var(--gold-hover); }

/* --- Error/Warning --- */
.error-message { color: var(--no); }
.warning ul { list-style: none; margin-block-start: 5px; }
.warning span { padding-inline: 42px; color: var(--no); }

/* --- Layout (Index page) --- */
.content-padding { padding-inline: 15px; }
.login-container { margin-block-start: 15px; }
.login-col { margin-block-end: 10px; }
.sample-img { width: 100%; border: 2px solid #191919; }

.row { display: flex; flex-wrap: wrap; }
.col-half { flex: 0 0 50%; max-width: 50%; padding-inline: 15px; }

.lh-27 { line-height: 27px; }
.text-center { text-align: center !important; }
.margin { margin-block-start: 15px; margin-block-end: 10px; }

/* --- Countdown Cards --- */
.countdown-section { padding: 60px 15px; text-align: center; }

.countdown-title {
    color: var(--gold);
    font-size: 22px;
    margin: 0 0 30px 0;
}

.countdown-cards {
    display: flex;
    justify-content: center;
    gap: 20px;
    direction: ltr;
}

.countdown-unit {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    width: 130px;
}

.countdown-box {
    background: var(--charcoal);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 130px;
}

.countdown-number {
    font-family: var(--font-lat);
    font-size: 64px;
    font-weight: bold;
    color: white;
    line-height: 1;
    letter-spacing: 2px;
}

.countdown-label-bar {
    background: var(--gold);
    color: white;
    font-family: var(--font);
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Error page --- */
.error-page { text-align: center; padding: 60px 15px; }
.error-page h2 { color: var(--charcoal); margin-block-end: 15px; }

/* ==========================================================================
   Results Page — Single-View Dashboard
   ========================================================================== */

.rp {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* --- Top bar: student name + tabs --- */
.rp-top {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 6px 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.rp-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}
.rp-label { font-size: 13px; color: var(--text-muted); }
.rp-name { font-size: 14px; font-weight: 700; color: var(--gold-hover); }

.rp-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    min-width: 0;
}
.rp-tabs::-webkit-scrollbar { display: none; }

.rp-tab {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 4px 12px;
    font-family: var(--font);
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}
.rp-tab:hover { border-color: var(--gold-border); color: var(--text); }
.rp-tab.on {
    background: var(--gold);
    border-color: var(--gold);
    color: white;
    font-weight: 700;
}

.rp-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 15px;
}

/* --- Body: image + answers side by side --- */
.rp-body {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* --- Image panel --- */
.rp-img {
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-inline-start: 1px solid var(--border);
    background: var(--surface);
}

.rp-img-head {
    display: none; /* shown on mobile only */
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    user-select: none;
}

.rp-chevron {
    transition: transform 0.2s;
    color: var(--text-muted);
}

.rp-img-wrap {
    flex: 1;
    overflow: auto;
    padding: 8px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.rp-scan {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* --- Answer panel --- */
.rp-answers {
    flex: 1;
    min-width: 0;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px 8px;
}

.rp-grid { width: 100%; }

.rp-cols {
    display: flex;
    gap: 6px;
    justify-content: center;
    direction: ltr;
}

.rp-tbl {
    border-collapse: collapse;
    flex: 0 1 auto;
}

.rp-tbl thead tr {
    background: var(--gold);
}

.rp-tbl th {
    padding: 3px 6px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    text-align: center;
    white-space: nowrap;
    border: 1px solid var(--gold-hover);
}

.rp-tbl td {
    padding: 2px 5px;
    font-size: 12px;
    text-align: center;
    font-family: var(--font-lat);
    border: 1px solid var(--border);
    line-height: 1.4;
}

.rp-tbl .qn {
    background: #F5F4F0;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    min-width: 22px;
}

/* --- Answer color coding --- */
.rp-tbl tr.cv-ok td:not(.qn) {
    background: var(--ok-bg);
    color: var(--ok);
}
.rp-tbl tr.cv-no td:not(.qn) {
    background: var(--no-bg);
    color: var(--no);
}
.rp-tbl tr.cv td:not(.qn) {
    background: var(--cancel-bg);
    color: var(--gold-hover);
}

.rp-tbl .cv-sp {
    font-size: 10px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet & below */
@media (max-width: 1024px) {
    .rp-img {
        width: 100%;
        border-inline-start: none;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }

    .rp-body {
        flex-direction: column;
    }

    .rp-img-head {
        display: flex;
    }

    .rp-img-wrap {
        display: none;
        max-height: 40vh;
    }

    .rp-img-wrap.img-open {
        display: flex;
    }
}

@media (max-width: 768px) {
    :root {
        --nav-h: 55px;
        --foot-h: 40px;
    }

    .navbar-brand img { height: 24px; }
    .navbar-text h5 { font-size: 14px; }
    .navbar-text h4 { font-size: 16px; }

    .col-half { flex: 0 0 100%; max-width: 100%; }
    .form-control1 { width: 100% !important; max-width: 100%; font-size: 16px; }

    .footer { font-size: 14px; }

    .rp-top {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 4px 6px;
    }

    .rp-bar { justify-content: center; font-size: 13px; }
    .rp-label { font-size: 12px; }
    .rp-name { font-size: 13px; }

    .rp-tab { padding: 3px 8px; font-size: 10px; }

    .rp-cols { gap: 3px; }

    .rp-tbl td { font-size: 10px; padding: 1px 3px; line-height: 1.3; }
    .rp-tbl th { font-size: 8px; padding: 2px 3px; }
    .rp-tbl .qn { font-size: 8px; min-width: 14px; padding: 1px 2px; }

    .rp-answers { padding: 4px 2px; }

    .rp-img-head { padding: 5px 8px; font-size: 11px; }

    .countdown-cards { gap: 12px; }
    .countdown-unit { width: 100px; }
    .countdown-box { height: 100px; }
    .countdown-number { font-size: 48px; }
    .countdown-label-bar { font-size: 12px; padding: 6px 0; }
    .countdown-title { font-size: 18px; }
    h3.margin { font-size: 16px; }
}

@media (max-width: 480px) {
    .navbar-brand img { height: 20px; }
    .navbar-text h5 { font-size: 12px; }
    .navbar-text h4 { font-size: 14px; }

    .rp-cols { gap: 2px; }

    .rp-tbl td { font-size: 9px; padding: 1px 2px; }
    .rp-tbl th { font-size: 7px; padding: 1px 2px; }
    .rp-tbl .qn { font-size: 7px; min-width: 12px; padding: 1px 1px; }
    .rp-tbl .cv-sp { font-size: 7px; }

    .rp-tab { padding: 3px 6px; font-size: 9px; }

    .countdown-cards { gap: 8px; }
    .countdown-unit { width: 75px; }
    .countdown-box { height: 75px; }
    .countdown-number { font-size: 36px; }
    .countdown-label-bar { font-size: 10px; padding: 5px 0; }
}
