/* ================================================================
   style.css — Public portal custom styles
   result-system/assets/style.css
   ================================================================ */

/* ── CSS Variables ──────────────────────────────────────────────── */
:root {
    --brand: #1a3a6b;
    --brand-dark: #0f2347;
    --brand-light: #e8eef8;
    --accent: #d4272b;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --surface: #f8fafc;
    --surface-card: #ffffff;
    --border: #e2e8f0;
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, .08);
    --font-body: 'Manrope', system-ui, sans-serif;
    --font-head: 'Sora', 'Manrope', system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.pub-body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text-main);
    margin: 0;
}

/* ── Top Navbar ─────────────────────────────────────────────────── */
.pub-topbar {
    background: var(--brand);
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--accent);
}

/* State logo in navbar */
.pub-state-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .1);
    padding: 3px;
}

.pub-emblem-fallback {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, .15);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.pub-gov-label {
    font-size: 10px;
    color: rgba(255, 255, 255, .65);
    text-transform: uppercase;
    letter-spacing: .06em;
    line-height: 1;
}

.pub-board-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-head);
    line-height: 1.3;
}

.pub-back-btn {
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .25);
    color: #fff !important;
    font-size: 13px;
}

.pub-back-btn:hover {
    background: rgba(255, 255, 255, .25);
    color: #fff !important;
}

/* ── Hero ───────────────────────────────────────────────────────── */
.pub-hero {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 60%, #2a5298 100%);
    padding: 30px 0 42px;
    color: #fff;
}

.pub-hero-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    padding: 6px 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, .9);
}

.pub-hero-title {
    font-family: var(--font-head);
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
}

.pub-hero-sub {
    font-size: 15px;
    color: rgba(255, 255, 255, .75);
    max-width: 540px;
    margin: 0 auto;
}

/* ── Search Section ─────────────────────────────────────────────── */
.pub-search-section {
    margin-top: -48px;
    padding-bottom: 48px;
    position: relative;
    z-index: 10;
}

.pub-search-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    text-align: center;
}

.pub-search-icon {
    width: 60px;
    height: 60px;
    background: var(--brand-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--brand);
    margin: 0 auto 14px;
}

.pub-search-heading {
    font-family: var(--font-head);
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.pub-search-sub {
    font-size: 13px;
    color: var(--text-sub);
    margin: 0;
}

/* ── Step Labels ────────────────────────────────────────────────── */
.pub-step-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: .05em;
    text-align: left;
    margin-bottom: 12px;
}

.pub-step-num {
    width: 24px;
    height: 24px;
    background: var(--brand);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

/* ── Stream Selection Grid ──────────────────────────────────────── */
.pub-stream-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.pub-stream-grid.has-error .pub-stream-option {
    border-color: #dc3545 !important;
}

.pub-stream-option {
    display: block;
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px 8px;
    text-align: center;
    transition: border-color .18s, background .18s, box-shadow .18s, transform .12s;
    position: relative;
}

.pub-stream-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pub-stream-option:hover {
    border-color: var(--brand);
    background: var(--brand-light);
}

.pub-stream-option.selected,
.pub-stream-option:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(26, 58, 107, .15);
    transform: translateY(-2px);
}

.pub-stream-inner {
    pointer-events: none;
}

.pub-stream-icon {
    font-size: 1.5rem;
    color: var(--brand);
    margin-bottom: 6px;
    transition: color .18s;
}

.pub-stream-option:not(.selected) .pub-stream-icon {
    color: #94a3b8;
}

.pub-stream-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.pub-stream-sub {
    font-size: 11px;
    color: var(--text-sub);
    margin-top: 2px;
}

/* ── Input ──────────────────────────────────────────────────────── */
.pub-input-group {
    position: relative;
}

.pub-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub);
    font-size: 18px;
    pointer-events: none;
}

.pub-input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 18px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: .1em;
    color: var(--text-main);
    background: #fff;
    transition: border-color .2s;
    outline: none;
}

.pub-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26, 58, 107, .12);
}

.pub-input.pub-input-error {
    border-color: #dc3545;
}

.pub-error-msg {
    color: #dc3545;
    font-size: 13px;
    text-align: left;
}

/* Search Button */
.pub-btn-search {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-head);
    cursor: pointer;
    transition: background .2s, transform .1s;
}

.pub-btn-search:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
}

/* Hints */
.pub-search-hints {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-sub);
}

/* ── Info Tiles ─────────────────────────────────────────────────── */
.pub-tiles-section {
    padding: 0 0 56px;
}

.pub-tile {
    background: var(--surface-card);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    border: 1px solid var(--border);
    height: 100%;
    transition: box-shadow .2s, transform .2s;
}

.pub-tile:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, .1);
    transform: translateY(-2px);
}

.pub-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.pub-tile-blue {
    background: #eff6ff;
    color: #1d4ed8;
}

.pub-tile-green {
    background: #f0fdf4;
    color: #15803d;
}

.pub-tile-amber {
    background: #fffbeb;
    color: #b45309;
}

.pub-tile-red {
    background: #fff1f2;
    color: #be123c;
}

.pub-tile h5 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 6px;
}

.pub-tile p {
    font-size: 12px;
    color: var(--text-sub);
    margin: 0;
    line-height: 1.6;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.pub-footer {
    background: var(--brand-dark);
    padding: 24px 0;
    font-size: 13px;
}

.pub-footer p {
    color: rgba(255, 255, 255, .6);
}

.pub-footer-note {
    font-size: 11px;
    color: rgba(255, 255, 255, .35);
}

/* ── 404 / Offline Icons ────────────────────────────────────────── */
.pub-404-icon,
.pub-offline-icon {
    font-size: 4rem;
    color: var(--text-sub);
}

/* ── Result Page ─────────────────────────────────────────────────── */
.pub-result-main {
    background: var(--surface);
    min-height: calc(100vh - 64px - 72px);
}

.pub-alert-pass {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius-md);
    color: #14532d;
    padding: 16px 20px;
}

.pub-alert-fail {
    background: #fff1f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: #7f1d1d;
    padding: 16px 20px;
}

/* Marksheet */
.marksheet-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.marksheet-header {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
    color: #fff;
}

/* State logo on marksheet header */
.ms-logo-row {
    display: flex;
    justify-content: center;
}

.ms-state-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    background: rgba(255, 255, 255, .1);
    border-radius: 8px;
    padding: 4px;
}

.ms-board {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .75);
}

.ms-exam-title {
    font-family: var(--font-head);
    font-size: clamp(.95rem, 3vw, 1.35rem);
    font-weight: 700;
    color: #fff;
    margin: 6px 0 0;
}

.ms-exam-meta {
    font-size: 13px;
    color: rgba(255, 255, 255, .8);
    margin-top: 4px;
}

.ms-doc-type {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 4px 16px;
    border-radius: 999px;
}

/* Student info grid */
.ms-student-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 18px;
    background: var(--brand-light);
    border-radius: var(--radius-md);
    border: 1px solid #c8d8f0;
}

.ms-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ms-field-full {
    grid-column: 1 / -1;
}

.ms-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-sub);
    font-weight: 600;
}

.ms-val {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
}

.ms-name {
    font-size: 1.1rem;
    font-weight: 800;
    font-family: var(--font-head);
    color: var(--brand);
}

/* Marks table */
.ms-table {
    font-size: 13px;
    margin-bottom: 0;
}

.ms-thead th {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    border-color: rgba(255, 255, 255, .1) !important;
}

.ms-sep-row td {
    background: var(--brand);
    color: rgba(255, 255, 255, .9);
    font-weight: 600;
    font-size: 12px;
    padding: 7px 14px;
}

.ms-group-row td {
    background: #f1f5fd;
    color: var(--text-sub);
    font-size: 11px;
    font-style: italic;
    padding: 5px 14px 5px 26px;
}

.ms-total-row td {
    background: var(--brand-dark);
    color: #fff;
    font-size: 14px;
}

.ms-grade-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--text-sub);
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.ms-cf-note {
    font-size: 10px;
    font-style: italic;
    margin-left: 4px;
}

/* Buttons */
.pub-btn-print {
    background: var(--brand);
    border: none;
    color: #fff;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background .2s;
}

.pub-btn-print:hover {
    background: var(--brand-dark);
    color: #fff;
}

.pub-btn-back {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main) !important;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: border-color .2s;
}

.pub-btn-back:hover {
    border-color: var(--brand);
}

/* ── Print ──────────────────────────────────────────────────────── */
@media print {

    .pub-topbar,
    .pub-alert-pass,
    .pub-alert-fail,
    .pub-footer,
    .d-print-none {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .pub-result-main {
        padding: 0 !important;
    }

    .marksheet-card {
        box-shadow: none !important;
        border: 1px solid #ccc;
    }

    .marksheet-header,
    .ms-thead th,
    .ms-sep-row td,
    .ms-total-row td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ms-state-logo {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 575px) {
    .pub-hero {
        padding: 50px 0 68px;
    }

    .pub-search-card {
        padding: 24px 16px;
    }

    .pub-stream-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .pub-stream-option {
        padding: 12px 6px;
    }

    .pub-stream-name {
        font-size: 11px;
    }

    .ms-student-grid {
        grid-template-columns: 1fr;
    }

    .ms-field-full {
        grid-column: 1;
    }

    .pub-topbar .pub-board-name {
        font-size: 12px;
    }
}

/* ================================================================
   MEMO MARKSHEET STYLES
   ================================================================ */

/* ── Wrapper ────────────────────────────────────────────────────── */
.memo-wrap {
    background: #fff;
    border: 2px solid #1a3a6b;
    border-radius: 4px;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
}

/* ── Header ─────────────────────────────────────────────────────── */
.memo-header {
    background: #dbe8f7;
    border-bottom: 2px solid #1a3a6b;
    padding: 10px 16px;
}

.memo-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.memo-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    flex-shrink: 0;
}

.memo-logo-right {
    margin-left: auto;
}

.memo-header-text {
    text-align: center;
    flex: 1;
}

.memo-board {
    font-size: 15px;
    font-weight: 700;
    color: #0f2347;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.memo-exam {
    font-size: 12px;
    font-weight: 600;
    color: #1a3a6b;
    margin-top: 2px;
}

.memo-doc {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: #d4272b;
    text-decoration: underline;
    margin-top: 3px;
    letter-spacing: .02em;
}

/* ── Student Details ────────────────────────────────────────────── */
.memo-details {
    padding: 8px 14px;
    border-bottom: 1px solid #b8cfe8;
    background: #f5f9ff;
}

.memo-info-table {
    width: 100%;
    border-collapse: collapse;
}

.memo-info-table td {
    padding: 2px 6px;
    font-size: 12px;
    white-space: nowrap;
}

.memo-lbl {
    color: #1a3a6b;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    width: 110px;
}

.memo-sep {
    color: #555;
    width: 12px;
}

.memo-val {
    color: #1e293b;
}

.mono {
    font-family: 'Courier New', monospace;
    letter-spacing: .08em;
}

/* ── Marks Table Wrapper ────────────────────────────────────────── */
.memo-table-wrap {
    overflow-x: auto;
    border-bottom: 1px solid #b8cfe8;
}

/* ── GEN Transposed Table ───────────────────────────────────────── */
.memo-marks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
}

.memo-marks-table th,
.memo-marks-table td {
    border: 1px solid #9ab8d8;
    text-align: center;
    padding: 4px 5px;
}

.memo-part-row th {
    background: #c5d9f0;
    color: #0f2347;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .06em;
}

.memo-part-head {
    background: #c5d9f0 !important;
}

.memo-subj-row th {
    background: #dbe8f7;
    color: #1a3a6b;
    font-weight: 700;
    font-size: 11px;
}

.memo-subhdr-row th {
    background: #eaf1fb;
    color: #374151;
    font-size: 10px;
    font-weight: 600;
}

.memo-th-year {
    width: 60px;
    background: #c5d9f0;
    font-weight: 700;
    color: #0f2347;
    vertical-align: middle;
}

.memo-th-subject {
    width: 90px;
    background: #c5d9f0;
    font-weight: 700;
    color: #0f2347;
    vertical-align: middle;
}

.memo-year-cell {
    font-weight: 700;
    color: #1a3a6b;
    font-size: 11px;
    vertical-align: middle;
    background: #eaf1fb;
}

.memo-row-label {
    font-weight: 600;
    font-size: 11px;
    color: #374151;
    background: #f5f9ff;
    text-align: left;
    padding-left: 8px;
}

.memo-row-max td {
    background: #fafcff;
}

.memo-row-marks td {
    background: #fff;
}

.memo-cell {
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.ms-pass {
    color: #166534;
}

.ms-fail {
    color: #991b1b;
    font-weight: 700;
}

/* ── VOC Table ──────────────────────────────────────────────────── */
.memo-voc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.memo-voc-table th,
.memo-voc-table td {
    border: 1px solid #9ab8d8;
    padding: 4px 8px;
}

.memo-voc-table thead th {
    background: #c5d9f0;
    color: #0f2347;
    font-weight: 700;
    font-size: 11px;
}

.memo-sep-row td {
    background: #1a3a6b;
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    padding: 3px 8px;
}

.memo-group-row td {
    background: #eaf1fb;
    color: #374151;
    font-size: 10.5px;
    font-style: italic;
    padding: 2px 8px 2px 20px;
}

/* ── Grand Total Bar ────────────────────────────────────────────── */
.memo-total-bar {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid #9ab8d8;
    background: #e8f0fb;
    padding: 6px 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.memo-total-left,
.memo-total-mid {
    display: flex;
    align-items: center;
    gap: 8px;
}

.memo-total-label {
    font-size: 11px;
    font-weight: 700;
    color: #1a3a6b;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.memo-total-num {
    font-size: 16px;
    font-weight: 800;
    color: #0f2347;
    font-family: 'Courier New', monospace;
}

.memo-total-words {
    font-size: 12px;
    font-weight: 700;
    color: #0f2347;
    font-family: 'Courier New', monospace;
    letter-spacing: .04em;
}

/* ── Result & Date Bar ──────────────────────────────────────────── */
.memo-result-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: #f5f9ff;
    flex-wrap: wrap;
    gap: 8px;
}

.memo-grade-note {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 10px;
    color: #374151;
}

.memo-grade-note span {
    white-space: nowrap;
}

.memo-result-box {
    display: flex;
    gap: 20px;
    align-items: center;
}

.memo-result-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.memo-result-label {
    font-size: 11px;
    font-weight: 700;
    color: #1a3a6b;
    text-transform: uppercase;
}

.memo-result-value {
    font-size: 13px;
    font-weight: 800;
    color: #0f2347;
    border: 2px solid #1a3a6b;
    padding: 2px 12px;
    border-radius: 3px;
}

.memo-pass {
    color: #166534 !important;
    border-color: #166534 !important;
}

.memo-fail {
    color: #991b1b !important;
    border-color: #991b1b !important;
}