:root {
    --navy-950: #0b2552;
    --navy-900: #12366f;
    --navy-800: #1b4a8d;
    --blue-600: #2e6eb8;
    --blue-400: #6c9fda;
    --sky-100: #eaf4ff;
    --gold-500: #f0b63d;
    --gold-300: #ffd77a;
    --green-600: #15946c;
    --green-100: #e8f8f2;
    --orange-600: #dc7a18;
    --orange-100: #fff3df;
    --red-600: #c94545;
    --red-100: #ffeded;
    --ink: #173052;
    --muted: #657694;
    --line: #dce6f4;
    --surface: #ffffff;
    --surface-soft: #f6f9fd;
    --shadow-lg: 0 28px 80px rgba(6, 27, 64, .24);
    --shadow-md: 0 16px 40px rgba(16, 53, 105, .14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.public-result-page {
    margin: 0;
    min-height: 100vh;
    direction: rtl;
    color: var(--ink);
    font-family: "Cairo", "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
    background:
        radial-gradient(circle at 12% 18%, rgba(139, 183, 235, .24) 0 54px, transparent 55px),
        radial-gradient(circle at 90% 32%, rgba(255, 214, 112, .18) 0 78px, transparent 79px),
        linear-gradient(145deg, #0f2f66 0%, #204f91 48%, #173f7b 100%);
    background-attachment: fixed;
}

body.public-result-page::before,
body.public-result-page::after {
    content: "";
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .14);
}

body.public-result-page::before {
    width: 420px;
    height: 420px;
    top: -240px;
    right: -110px;
}

body.public-result-page::after {
    width: 320px;
    height: 320px;
    bottom: -190px;
    left: -90px;
}

.public-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 24px 0 34px;
}

.authority-header {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 92px;
    align-items: center;
    gap: 18px;
    min-height: 126px;
    padding: 18px 28px;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 30px;
    background: rgba(255, 255, 255, .95);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.authority-logo {
    display: grid;
    place-items: center;
    width: 78px;
    height: 78px;
    margin: auto;
    overflow: hidden;
    border: 4px solid #fff;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 59, 109, .16);
}

.authority-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.authority-logo .fallback-mark {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border: 2px solid #dbe6f5;
    border-radius: 50%;
    color: var(--navy-900);
    font-size: 19px;
    font-weight: 900;
}

.authority-copy { text-align: center; }

.authority-copy .governorate {
    margin: 0 0 5px;
    color: var(--blue-600);
    font-size: 14px;
    font-weight: 800;
}

.authority-copy h1 {
    margin: 0;
    color: var(--navy-950);
    font-size: clamp(22px, 3vw, 34px);
    line-height: 1.35;
    font-weight: 900;
    letter-spacing: -.35px;
}

.authority-copy p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.leadership-panel {
    width: min(760px, 94%);
    margin: 28px auto 0;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 28px;
    background: rgba(255, 255, 255, .10);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
    backdrop-filter: blur(12px);
}

.leadership-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.leader-card {
    position: relative;
    min-height: 112px;
    padding: 19px 18px 17px;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(111, 157, 215, .82), rgba(75, 119, 183, .92));
    color: #fff;
    text-align: center;
    box-shadow: 0 12px 28px rgba(5, 26, 65, .18);
}

.leader-card::after {
    content: "";
    position: absolute;
    inset: 0 0 0 auto;
    width: 5px;
    background: var(--gold-500);
}

.leader-card strong {
    display: block;
    margin-bottom: 8px;
    color: #ffe36f;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 900;
}

.leader-card span {
    display: block;
    color: rgba(255, 255, 255, .94);
    font-size: 12px;
    line-height: 1.7;
    font-weight: 700;
}

.search-stage,
.result-stage {
    position: relative;
    margin-top: 30px;
    padding: clamp(25px, 5vw, 50px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 32px;
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--shadow-lg);
}

.search-stage::before,
.result-stage::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--gold-500), #ffd873 35%, var(--blue-600));
}

.hero-copy { text-align: center; }

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 15px;
    border: 1px solid #d6e5f7;
    border-radius: 999px;
    background: linear-gradient(90deg, #edf7ff, #f8edff);
    color: var(--blue-600);
    font-size: 13px;
    font-weight: 800;
}

.hero-copy h2 {
    margin: 20px 0 10px;
    color: var(--navy-950);
    font-size: clamp(27px, 4vw, 44px);
    line-height: 1.35;
    font-weight: 900;
    letter-spacing: -.65px;
}

.hero-copy p {
    max-width: 760px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.9;
    font-weight: 600;
}

.academic-year {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 11px 20px;
    border-radius: 14px;
    background: linear-gradient(90deg, #e7f4ff, #f4e9fa);
    color: var(--navy-800);
    font-size: 17px;
    font-weight: 900;
}

.search-card {
    width: min(680px, 100%);
    margin: 28px auto 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface-soft);
    box-shadow: 0 12px 34px rgba(35, 73, 128, .08);
}

.form-label {
    display: block;
    margin-bottom: 9px;
    color: var(--navy-900);
    font-size: 14px;
    font-weight: 900;
}

.input-wrap { position: relative; }

.input-wrap .input-icon {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    color: var(--blue-600);
    font-size: 19px;
}

.national-id-input {
    width: 100%;
    height: 62px;
    padding: 0 52px 0 18px;
    border: 2px solid #d6e2f2;
    border-radius: 16px;
    outline: none;
    background: #fff;
    color: var(--navy-950);
    direction: ltr;
    text-align: center;
    font-family: "Cairo", Tahoma, Arial, sans-serif;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 2px;
    transition: .2s ease;
}

.national-id-input:focus {
    border-color: var(--blue-600);
    box-shadow: 0 0 0 4px rgba(46, 110, 184, .12);
}

.search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 58px;
    margin-top: 15px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #f7bd4e, #f2a936);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 13px 28px rgba(226, 151, 32, .28);
    transition: transform .2s ease, box-shadow .2s ease;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 17px 34px rgba(226, 151, 32, .34);
}

.search-button:disabled {
    cursor: not-allowed;
    filter: grayscale(.5);
    opacity: .65;
    transform: none;
}

.form-help {
    margin: 10px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
    font-weight: 600;
}

.public-message {
    width: min(760px, 100%);
    margin: 22px auto 0;
    padding: 14px 17px;
    border: 1px solid #e3cf8a;
    border-radius: 15px;
    background: #fff8dc;
    color: #765917;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.8;
}

.public-footer {
    padding: 25px 14px 3px;
    color: rgba(255, 255, 255, .78);
    text-align: center;
    font-size: 12px;
    line-height: 1.9;
}

.public-footer strong { color: #fff; }

.result-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 24px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid #d9e5f3;
    border-radius: 12px;
    background: #fff;
    color: var(--navy-800);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(23, 65, 120, .07);
}

.result-reference {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.result-banner {
    position: relative;
    padding: 28px;
    border-radius: 24px;
    overflow: hidden;
}

.result-banner.accepted {
    border: 1px solid #b7e7d4;
    background: linear-gradient(135deg, #eafaf4, #f7fffb);
}

.result-banner.nominated {
    border: 1px solid #f2d493;
    background: linear-gradient(135deg, #fff4dc, #fffaf1);
}

.result-banner.waiting {
    border: 1px solid #cadcf2;
    background: linear-gradient(135deg, #edf5ff, #fafcff);
}

.result-banner .status-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin-bottom: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .78);
    font-size: 28px;
    box-shadow: 0 9px 22px rgba(33, 72, 122, .10);
}

.result-banner h2 {
    margin: 0;
    color: var(--navy-950);
    font-size: clamp(25px, 4vw, 38px);
    font-weight: 900;
}

.result-banner p {
    max-width: 820px;
    margin: 9px 0 0;
    color: #596d89;
    font-size: 14px;
    line-height: 1.9;
    font-weight: 700;
}

.school-highlight {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding: 18px 20px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 11px 28px rgba(27, 69, 124, .10);
}

.school-highlight strong {
    display: block;
    color: var(--navy-950);
    font-size: 20px;
    line-height: 1.55;
    font-weight: 900;
}

.school-highlight span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.round-pill {
    display: inline-flex !important;
    margin: 0 !important;
    padding: 9px 13px;
    border-radius: 999px;
    background: var(--sky-100);
    color: var(--navy-800) !important;
    white-space: nowrap;
    font-size: 12px !important;
    font-weight: 900 !important;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.info-card {
    min-height: 105px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
}

.info-card span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.info-card strong {
    display: block;
    color: var(--navy-950);
    font-size: 14px;
    line-height: 1.7;
    font-weight: 900;
}

.section-card {
    margin-top: 20px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-heading h3 {
    margin: 0;
    color: var(--navy-950);
    font-size: 20px;
    font-weight: 900;
}

.section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.preferences-list {
    display: grid;
    gap: 10px;
}

.preference-row {
    display: grid;
    grid-template-columns: 135px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 68px;
    padding: 12px 14px;
    border: 1px solid #dfe8f4;
    border-radius: 15px;
    background: #fbfdff;
}

.preference-order {
    color: var(--blue-600);
    font-size: 12px;
    font-weight: 900;
}

.preference-school strong {
    display: block;
    color: var(--navy-950);
    font-size: 14px;
    line-height: 1.6;
    font-weight: 900;
}

.preference-school small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 11px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 900;
}

.status-badge.accepted,
.status-badge.success { background: var(--green-100); color: var(--green-600); }
.status-badge.nominated,
.status-badge.warning { background: var(--orange-100); color: var(--orange-600); }
.status-badge.waiting { background: var(--sky-100); color: var(--blue-600); }
.status-badge.danger { background: var(--red-100); color: var(--red-600); }
.status-badge.neutral { background: #eef1f6; color: #66748b; }

.timeline {
    position: relative;
    display: grid;
    gap: 12px;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 15px;
    border: 1px solid #dfe7f2;
    border-radius: 15px;
    background: #fbfdff;
}

.timeline-round {
    color: var(--blue-600);
    font-size: 12px;
    font-weight: 900;
}

.timeline-school strong {
    display: block;
    font-size: 13px;
    line-height: 1.6;
    font-weight: 900;
}

.timeline-school small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
}

.confirmed-school-note {
    margin-top: 14px;
    padding: 13px 15px;
    border-right: 4px solid var(--blue-600);
    border-radius: 12px;
    background: #eef6ff;
    color: #315b8c;
    font-size: 12px;
    line-height: 1.8;
    font-weight: 700;
}

.error-state {
    max-width: 720px;
    margin: 15px auto 0;
    padding: 38px 24px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #fff;
    text-align: center;
}

.error-state .error-icon {
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    margin: 0 auto 15px;
    border-radius: 20px;
    background: var(--red-100);
    color: var(--red-600);
    font-size: 30px;
}

.error-state h2 {
    margin: 0;
    color: var(--navy-950);
    font-size: 26px;
    font-weight: 900;
}

.error-state p {
    max-width: 580px;
    margin: 10px auto 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.9;
    font-weight: 600;
}

@media (max-width: 900px) {
    .leadership-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: repeat(2, 1fr); }
    .preference-row { grid-template-columns: 120px minmax(0, 1fr); }
    .preference-row .status-badge { grid-column: 1 / -1; justify-self: start; }
    .timeline-item { grid-template-columns: 105px minmax(0, 1fr); }
    .timeline-item .status-badge { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 620px) {
    .public-shell { width: min(100% - 16px, 1180px); padding-top: 10px; }
    .authority-header {
        grid-template-columns: 58px minmax(0, 1fr) 58px;
        gap: 8px;
        min-height: 100px;
        padding: 14px 10px;
        border-radius: 21px;
    }
    .authority-logo { width: 54px; height: 54px; border-width: 2px; }
    .authority-copy .governorate { font-size: 10px; }
    .authority-copy h1 { font-size: 17px; }
    .authority-copy p { font-size: 9px; margin-top: 4px; }
    .leadership-panel { width: 100%; margin-top: 16px; padding: 12px; border-radius: 20px; }
    .leader-card { min-height: 94px; padding: 15px; }
    .leader-card strong { font-size: 14px; }
    .search-stage, .result-stage { margin-top: 16px; padding: 22px 14px; border-radius: 22px; }
    .hero-copy h2 { font-size: 26px; }
    .hero-copy p { font-size: 13px; }
    .search-card { padding: 15px; border-radius: 18px; }
    .national-id-input { height: 58px; font-size: 17px; letter-spacing: 1px; }
    .result-topbar { align-items: flex-start; flex-direction: column; }
    .result-banner { padding: 20px 16px; }
    .school-highlight { grid-template-columns: 1fr; }
    .round-pill { justify-self: start; }
    .info-grid { grid-template-columns: 1fr; }
    .info-card { min-height: auto; }
    .section-card { padding: 16px 12px; border-radius: 18px; }
    .preference-row { grid-template-columns: 1fr; gap: 5px; }
    .preference-row .status-badge { grid-column: auto; }
    .timeline-item { grid-template-columns: 1fr; gap: 6px; }
    .timeline-item .status-badge { grid-column: auto; }
}

@media print {
    body.public-result-page { background: #fff; }
    body.public-result-page::before,
    body.public-result-page::after,
    .leadership-panel,
    .public-footer,
    .back-link { display: none !important; }
    .public-shell { width: 100%; padding: 0; }
    .authority-header,
    .result-stage { box-shadow: none; border: 1px solid #cfd9e8; }
    .result-stage { margin-top: 10px; }
}
