/* ============================================================
   Education Board Result — Styles (PECE Color Scheme)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Sora:wght@400;500;600;700;800&display=swap');

/* ── Variables (PECE color scheme) ─────────────────────────── */
.ebr-wrap {
    --ebr-primary:    #1434A4;
    --ebr-primary-dk: #0f2a82;
    --ebr-accent:     #1434A4;
    --ebr-success:    #10b981;
    --ebr-danger:     #ef4444;
    --ebr-bg:         #edf0f9;
    --ebr-card:       #ffffff;
    --ebr-border:     #dbe4f7;
    --ebr-text:       #1e293b;
    --ebr-muted:      #64748b;
    --ebr-radius:     14px;
    --ebr-radius-s:   8px;
    --ebr-shadow:     0 4px 24px rgba(20,52,164,.12);
    --ebr-font:       'Sora', 'Hind Siliguri', sans-serif;
}

/* ── Wrapper ───────────────────────────────────────────────── */
.ebr-wrap {
    font-family: var(--ebr-font);
    font-size: 14px;
    color: var(--ebr-text);
    max-width: 760px;
    margin: 24px auto;
    background: var(--ebr-bg);
    border-radius: var(--ebr-radius);
    overflow: hidden;
    box-shadow: var(--ebr-shadow);
}

/* ── Header ─────────────────────────────────────────────────── */
.ebr-header {
    background: linear-gradient(135deg, var(--ebr-primary) 0%, #1434A4 100%);
    position: relative;
    overflow: hidden;
}
.ebr-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 80% 50%, rgba(255,255,255,0.07) 0%, transparent 60%);
    pointer-events: none;
}
.ebr-header-inner {
    display: flex;
    align-items: center;
    padding: 20px 28px;
    gap: 22px;
    position: relative;
    z-index: 1;
}

/* Logo */
.ebr-logo-cell {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: var(--ebr-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.22), 0 0 0 3px rgba(255,255,255,0.2);
    padding: 8px;
}
.ebr-logo-cell img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    display: block;
}

/* Title */
.ebr-title-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ebr-ministry {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    margin: 0 0 2px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.ebr-site-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    text-shadow: 0 1px 6px rgba(0,0,0,0.25);
}

/* ── Content box ────────────────────────────────────────────── */
.ebr-content-box {
    background: var(--ebr-card);
    padding: 28px 28px 22px;
}

/* ── Form grid ──────────────────────────────────────────────── */
.ebr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 560px) {
    .ebr-grid { grid-template-columns: 1fr; }
    .ebr-field-full { grid-column: 1; }
}
.ebr-field-full { grid-column: 1 / -1; }

.ebr-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.ebr-field label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ebr-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 5px;
}
.ebr-field label svg {
    color: var(--ebr-primary);
    flex-shrink: 0;
}
.ebr-req { color: var(--ebr-danger); }

.ebr-field input,
.ebr-field select {
    font-family: var(--ebr-font);
    font-size: 14px;
    color: var(--ebr-text);
    background: #f8faff;
    border: 1.5px solid var(--ebr-border);
    padding: 10px 13px;
    border-radius: var(--ebr-radius-s);
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
    -webkit-appearance: none;
    appearance: none;
}
.ebr-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231a56db' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.ebr-field input:focus,
.ebr-field select:focus {
    border-color: var(--ebr-primary);
    background: var(--ebr-card);
    box-shadow: 0 0 0 3px rgba(20,52,164,.15);
}

/* ── Submit button ──────────────────────────────────────────── */
.ebr-btn-row {
    text-align: center;
    padding-top: 22px;
}
.ebr-submit-btn {
    font-family: var(--ebr-font);
    font-size: 15px;
    font-weight: 700;
    background: var(--ebr-primary);
    color: #fff;
    border: none;
    padding: 12px 44px;
    border-radius: 50px;
    cursor: pointer;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 18px rgba(20,52,164,.35);
    transition: all .22s ease;
}
.ebr-submit-btn:hover {
    background: var(--ebr-primary-dk);
    box-shadow: 0 6px 24px rgba(20,52,164,.5);
    transform: translateY(-2px);
}
.ebr-submit-btn:active  { transform: translateY(0); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.ebr-submit-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* Spinner */
.ebr-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ebr-spin .7s linear infinite;
    display: inline-block;
}
@keyframes ebr-spin { to { transform: rotate(360deg); } }

/* ── Message ────────────────────────────────────────────────── */
.ebr-message {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--ebr-radius-s);
    font-size: 13.5px;
    font-weight: 500;
    text-align: center;
}
.ebr-message.ebr-msg-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--ebr-danger);
}
.ebr-message.ebr-msg-info {
    background: var(--ebr-bg);
    border: 1px solid var(--ebr-border);
    color: var(--ebr-primary);
}

/* ── Result section ─────────────────────────────────────────── */
.ebr-result-section {
    margin-top: 24px;
    animation: ebr-fadein .35s ease;
}
@keyframes ebr-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Result heading ─────────────────────────────────────────── */
.ebr-result-heading {
    font-size: 18px;
    font-weight: 800;
    color: var(--ebr-primary);
    text-align: center;
    padding: 0 0 18px;
    letter-spacing: -.3px;
    position: relative;
}
.ebr-result-heading::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--ebr-primary), var(--ebr-accent));
    border-radius: 3px;
    margin: 10px auto 0;
}

/* ── Info table ─────────────────────────────────────────────── */
.ebr-info-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    border: 1px solid var(--ebr-border);
    margin-bottom: 22px;
}
.ebr-info-table tr:not(:last-child) td { border-bottom: 1px solid var(--ebr-border); }
.ebr-info-table td { padding: 10px 13px; vertical-align: middle; }

.ebr-info-table td.ebr-lbl {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ebr-muted);
    background: var(--ebr-bg);
    width: 20%;
    white-space: nowrap;
}
.ebr-info-table td:not(.ebr-lbl) {
    color: var(--ebr-text);
    font-weight: 500;
    background: var(--ebr-card);
    width: 30%;
    font-family: 'Hind Siliguri', sans-serif;
}
.ebr-val-bold {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: var(--ebr-primary) !important;
    font-family: 'Sora', sans-serif !important;
}
.ebr-val-pass {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: var(--ebr-success) !important;
}
.ebr-val-fail {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: var(--ebr-danger) !important;
}

/* ── Grade heading ──────────────────────────────────────────── */
.ebr-grade-heading {
    font-size: 14px;
    font-weight: 700;
    color: var(--ebr-text);
    padding: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.ebr-grade-heading::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--ebr-primary), var(--ebr-accent));
    border-radius: 2px;
}

/* ── Grade table ────────────────────────────────────────────── */
.ebr-grade-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    border: 1px solid var(--ebr-border);
}
.ebr-grade-table th {
    background: var(--ebr-primary);
    font-weight: 700;
    padding: 11px 14px;
    text-align: left;
    color: #fff;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.ebr-grade-table th:last-child { text-align: center; }
.ebr-grade-table td {
    padding: 9px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--ebr-border);
    font-family: 'Hind Siliguri', sans-serif;
    transition: background .12s;
}
.ebr-grade-table td:last-child { text-align: center; }
.ebr-grade-table tr:last-child td { border-bottom: none; }
.ebr-grade-table tr.ebr-row-odd  td { background: var(--ebr-card); }
.ebr-grade-table tr.ebr-row-even td { background: #f8faff; }

/* ── Grade badges ───────────────────────────────────────────── */
.ebr-grade-badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    min-width: 40px;
    text-align: center;
    font-family: 'Sora', sans-serif;
}
.ebr-grade-Aplus   { background: #d1fae5; color: #065f46; }
.ebr-grade-A       { background: #dbeafe; color: #1434A4; }
.ebr-grade-Aminus  { background: #e0e7ff; color: #3730a3; }
.ebr-grade-B       { background: #fef9c3; color: #713f12; }
.ebr-grade-C       { background: #f3e8ff; color: #581c87; }
.ebr-grade-D       { background: #ffedd5; color: #7c2d12; }
.ebr-grade-F       { background: #fee2e2; color: #7f1d1d; }
.ebr-grade-default { background: var(--ebr-border); color: var(--ebr-muted); }

/* ── Result actions ─────────────────────────────────────────── */
.ebr-result-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-top: 20px;
    flex-wrap: wrap;
}
.ebr-print-btn {
    font-family: var(--ebr-font);
    font-size: 13px;
    font-weight: 600;
    background: var(--ebr-card);
    color: var(--ebr-primary);
    border: 2px solid var(--ebr-primary);
    padding: 9px 26px;
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all .2s ease;
}
.ebr-print-btn:hover {
    background: var(--ebr-primary);
    color: #fff;
    transform: translateY(-1px);
}

/* ── Search again ───────────────────────────────────────────── */
.ebr-search-again {
    text-align: center;
    padding-top: 16px;
}
.ebr-search-again-btn {
    font-family: var(--ebr-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--ebr-primary);
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color .15s;
    padding: 0;
}
.ebr-search-again-btn:hover { color: var(--ebr-primary-dk); }

/* ── Footer ─────────────────────────────────────────────────── */
.ebr-footer {
    background: var(--ebr-bg);
    border-top: 1px solid var(--ebr-border);
}
.ebr-footer-inner {
    padding: 10px 28px;
    font-size: 11.5px;
    color: var(--ebr-muted);
    text-align: center;
    line-height: 1.6;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 560px) {
    .ebr-header-inner { padding: 14px 16px; gap: 12px; }
    .ebr-logo-cell { width: 60px; height: 60px; }
    .ebr-logo-cell img { width: 44px; height: 44px; }
    .ebr-site-title { font-size: 15px; }
    .ebr-content-box { padding: 18px 14px; }
    .ebr-info-table td.ebr-lbl { font-size: 10px; width: 26%; }
    .ebr-grade-table td, .ebr-grade-table th { padding: 8px 9px; font-size: 12px; }
    .ebr-result-heading { font-size: 15px; }
    .ebr-submit-btn { padding: 11px 30px; font-size: 14px; }
}

/* ── Print — fit result to ONE page ─────────────────────────── */
@media print {
    /* Hide everything except the result card */
    .ebr-header,
    .ebr-form,
    .ebr-btn-row,
    .ebr-result-actions,
    .ebr-search-again,
    .ebr-footer,
    .ebr-message { display: none !important; }

    /* Reset wrapper for print */
    .ebr-wrap {
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        background: #fff !important;
    }
    .ebr-content-box {
        padding: 0 !important;
    }

    /* Print header — show a compact letterhead */
    .ebr-result-section::before {
        content: 'Bangladesh Education Board — Result Marksheet';
        display: block;
        text-align: center;
        font-size: 13pt;
        font-weight: 800;
        color: #1434A4;
        padding-bottom: 8pt;
        border-bottom: 2pt solid #1434A4;
        margin-bottom: 10pt;
    }

    /* Fit everything on one page */
    @page {
        size: A4 portrait;
        margin: 12mm 14mm;
    }

    /* Result heading */
    .ebr-result-heading {
        font-size: 14pt !important;
        padding-bottom: 10pt !important;
        color: #1434A4 !important;
    }
    .ebr-result-heading::after { display: none; }

    /* Info table */
    .ebr-info-table {
        font-size: 9pt !important;
        margin-bottom: 10pt !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    .ebr-info-table td {
        padding: 5pt 7pt !important;
    }
    .ebr-info-table td.ebr-lbl {
        background: #e6eaf8 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 8pt !important;
    }

    /* Grade section */
    .ebr-grade-heading {
        font-size: 10pt !important;
        padding-bottom: 5pt !important;
    }
    .ebr-grade-heading::before { display: none; }

    .ebr-grade-table {
        font-size: 9pt !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    .ebr-grade-table th {
        background: #1434A4 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 5pt 8pt !important;
        font-size: 8pt !important;
    }
    .ebr-grade-table td {
        padding: 4pt 8pt !important;
        font-size: 8.5pt !important;
    }
    .ebr-grade-badge {
        font-size: 8pt !important;
        padding: 1pt 6pt !important;
        border-radius: 3pt !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .ebr-grade-Aplus   { background: #d1fae5 !important; color: #065f46 !important; }
    .ebr-grade-A       { background: #dbeafe !important; color: #1434A4 !important; }
    .ebr-grade-Aminus  { background: #e0e7ff !important; color: #3730a3 !important; }
    .ebr-grade-B       { background: #fef9c3 !important; color: #713f12 !important; }
    .ebr-grade-C       { background: #f3e8ff !important; color: #581c87 !important; }
    .ebr-grade-D       { background: #ffedd5 !important; color: #7c2d12 !important; }
    .ebr-grade-F       { background: #fee2e2 !important; color: #7f1d1d !important; }
    .ebr-grade-default { background: #f1f5f9 !important; color: #64748b !important; }

    /* Zebra rows for print */
    .ebr-grade-table tr.ebr-row-even td {
        background: #edf0f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
