
:root {
    --primary: #0f7fbf;
    --primary-dark: #075985;
    --primary-soft: #e0f2fe;
    --cyan: #38bdf8;
    --green: #16a34a;
    --gold: #f59e0b;
    --text: #0f172a;
    --muted: #64748b;
    --white: #ffffff;
    --border: rgba(15, 23, 42, .10);
    --shadow: 0 24px 70px rgba(2, 132, 199, .20);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Cairo", "Tahoma", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, .30), transparent 32rem),
        linear-gradient(135deg, #f8fafc 0%, #eefaff 55%, #ffffff 100%);
}

.page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(14, 165, 233, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, .05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 85%);
}

.site-shell {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 34px 0 48px;
    position: relative;
    z-index: 2;
}

.hero-card {
    position: relative;
    overflow: hidden;
    min-height: 420px;
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 34px;
    padding: 32px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(239, 249, 255, .86)),
        linear-gradient(135deg, rgba(14, 165, 233, .18), rgba(255,255,255,.10));
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 28px;
    align-items: center;
}

.compact-hero {
    min-height: auto;
    margin-bottom: 22px;
}

.hero-pattern {
    position: absolute;
    inset: auto -120px -160px auto;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(14, 165, 233, .22), rgba(255,255,255,.10));
}

.school-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    z-index: 2;
}

.brand-logo {
    width: 92px;
    height: 92px;
    border-radius: 28px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    color: #fff;
    font-size: 32px;
    font-weight: 900;
    box-shadow: 0 18px 40px rgba(14, 165, 233, .28);
    overflow: hidden;
    flex: 0 0 auto;
}

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

.ministry-line {
    margin: 0 0 8px;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: .2px;
}

.school-brand h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.25;
    color: var(--primary-dark);
}

.school-brand p:last-child {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 17px;
    font-weight: 700;
}

.search-panel {
    position: relative;
    z-index: 2;
    padding: 26px;
    border-radius: 28px;
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(14, 165, 233, .18);
    box-shadow: 0 18px 44px rgba(15, 23, 42, .08);
}

.search-panel h2 {
    margin: 0 0 8px;
    font-size: 26px;
    color: var(--text);
}

.search-panel p {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.8;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.search-form input {
    width: 100%;
    border: 1px solid rgba(14, 165, 233, .25);
    background: #f8fafc;
    border-radius: 18px;
    padding: 16px 18px;
    font-size: 18px;
    font-weight: 800;
    outline: none;
    transition: .2s;
}

.search-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, .12);
    background: #fff;
}

.search-form button,
.btn-print,
.btn-secondary {
    border: 0;
    border-radius: 18px;
    padding: 15px 22px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.search-form button,
.btn-print {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 14px 30px rgba(7, 89, 133, .22);
}

.btn-secondary {
    background: #fff;
    color: var(--primary-dark);
    border: 1px solid rgba(14, 165, 233, .20);
}

.alert-error {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
    font-weight: 800;
}

.intro-grid {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.intro-card {
    padding: 22px;
    border-radius: 26px;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(14,165,233,.12);
    box-shadow: 0 16px 42px rgba(15,23,42,.06);
}

.intro-card span {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 900;
}

.intro-card h3 {
    margin: 14px 0 8px;
    font-size: 21px;
}

.intro-card p {
    margin: 0;
    line-height: 1.8;
    color: var(--muted);
}

.result-card {
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(14, 165, 233, .16);
    border-radius: 32px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.result-brand {
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    border: 1px solid rgba(14, 165, 233, .14);
    text-align: center;
}

.result-brand strong {
    display: block;
    color: var(--primary-dark);
    font-size: 24px;
    margin-bottom: 6px;
}

.result-brand span {
    color: var(--muted);
    font-weight: 800;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.status-badge {
    display: inline-flex;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(22, 163, 74, .10);
    color: var(--green);
    font-weight: 900;
    border: 1px solid rgba(22, 163, 74, .16);
}

.result-header h2 {
    margin: 12px 0 6px;
    font-size: 30px;
    color: var(--primary-dark);
}

.result-header p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.score-circle {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-align: center;
    background:
        radial-gradient(circle at center, #ffffff 0 54%, transparent 55%),
        conic-gradient(var(--primary) 0 var(--score), #e2e8f0 var(--score) 100%);
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, .16);
}

.score-circle strong {
    display: block;
    font-size: 34px;
    color: var(--primary-dark);
    line-height: 1;
}

.score-circle span {
    color: var(--muted);
    font-weight: 800;
    font-size: 13px;
}

.student-grid {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 14px;
}

.info-box {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, #f8fafc, #eff6ff);
    border: 1px solid rgba(14,165,233,.12);
}

.info-box span {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 8px;
}

.info-box strong {
    display: block;
    color: var(--text);
    font-size: 20px;
    line-height: 1.6;
}

.total-strip {
    margin-top: 18px;
    border-radius: 24px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
}

.total-strip span {
    font-weight: 700;
    opacity: .9;
}

.total-strip strong {
    display: block;
    margin-top: 4px;
    font-size: 25px;
}

.total-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.24);
    margin-top: 14px;
    overflow: hidden;
}

.total-bar span,
.subject-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), #22c55e);
}

.subjects-title {
    margin: 26px 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subjects-title h3 {
    margin: 0;
    font-size: 24px;
    color: var(--primary-dark);
}

.subjects-title span {
    color: var(--muted);
    font-weight: 800;
}

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

.subject-item {
    padding: 16px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 20px;
}

.subject-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    color: var(--text);
    font-weight: 800;
}

.subject-row strong {
    color: var(--primary-dark);
    white-space: nowrap;
}

.subject-bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-top: 12px;
}

.result-footer {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px dashed rgba(15,23,42,.16);
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-weight: 800;
}

.result-footer p {
    margin: 0;
}

.developer {
    color: var(--primary-dark);
}

.main-page-greeting {
    margin: 28px auto 0;
    padding: 16px 20px;
    max-width: 520px;
    text-align: center;
    border-radius: 24px;
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(14,165,233,.16);
    box-shadow: 0 16px 42px rgba(15,23,42,.06);
}

.main-page-greeting span {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 4px;
}

.main-page-greeting strong {
    display: block;
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 900;
}

.action-row {
    margin: 20px 0 0;
    display: flex;
    justify-content: center;
    gap: 12px;
}

@media (max-width: 900px) {
    .hero-card {
        grid-template-columns: 1fr;
        padding: 22px;
        border-radius: 26px;
    }

    .school-brand {
        align-items: flex-start;
    }

    .brand-logo {
        width: 74px;
        height: 74px;
        border-radius: 22px;
        font-size: 24px;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .intro-grid,
    .student-grid,
    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .score-circle {
        width: 112px;
        height: 112px;
    }

    .result-footer {
        flex-direction: column;
    }
}

@media print {
    body {
        background: #fff !important;
    }

    .page-bg,
    .hero-card,
    .no-print,
    .action-row,
    .intro-grid {
        display: none !important;
    }

    .site-shell {
        width: 100%;
        padding: 0;
    }

    .result-card {
        box-shadow: none;
        border: 1px solid #111;
        border-radius: 0;
        padding: 18px;
    }

    .subject-item,
    .info-box {
        break-inside: avoid;
    }
}
