:root {
    --primary: #2563eb;
    --accent: #0ea5e9;
    --card: #ffffff;
    --text: #0f172a;
    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;
}

/* No rounded corners anywhere */
.exam-result-search-container,
.exam-result-search-form,
.exam-result-search-form input[type="text"],
.exam-result-search-form select,
.exam-result-search-form input[type="submit"],
.exam-result,
.print-button,
.exam-result-not-found {
    border-radius: 0 !important;
}

/* Main container */
.exam-result-search-container {
    max-width: 1100px;
    margin: 32px auto;
    padding: 24px;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

/* Search form card */
.exam-result-search-form {
    background: var(--card);
    padding: 22px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

/* Desktop: even smaller and shorter input fields */
.exam-result-search-form p {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin: 0;
}

.exam-result-search-form .form-group {
    flex: 0 1 110px;     /* prevent growing, max width ~110px */
    min-width: 100px;    /* but not too small */
}

/* One field (Semester/Term/Unit/Monthly) has a longer label than the fixed
   110px column comfortably fits on one line at this font size/weight.
   Scoped to just this field so every other field's column width and
   nowrap label behavior stays exactly as before. Mobile breakpoints below
   already override .form-group generically (flex:auto, label wraps), so
   this desktop-only sizing doesn't need its own mobile override. */
.exam-result-search-form .form-group.form-group-wide {
    flex: 0 1 170px;
    min-width: 150px;
}

.exam-result-search-form .form-group.form-group-wide label {
    white-space: normal;
    line-height: 1.15;
}

.exam-result-search-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 700;
    color: var(--text);
    font-size: 0.8rem;
    white-space: nowrap;
}

.exam-result-search-form input[type="text"],
.exam-result-search-form select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 0.8rem;
    box-sizing: border-box;
}

.exam-result-search-form input[type="submit"],
.print-button {
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    font-size: 0.8rem;
    white-space: nowrap;
}

.exam-result-search-form input[type="submit"]:hover,
.exam-result-search-form input[type="submit"]:focus-visible,
.print-button:hover,
.print-button:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

/* ================= RESULT CARD ================= */
.exam-result {
    margin: 24px 0;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    overflow-x: auto;
}

.exam-result h3 {
    margin: 0 0 15px;
    color: var(--primary);
    font-size: 1.4rem;
}

/* ===== INSTITUTE HEADER (logo + name + tagline) ===== */
.exam-result-institute-header img {
    object-fit: contain;
}

.exam-result-institute-name {
    line-height: 1.3;
}

.exam-result-institute-tagline {
    line-height: 1.3;
}

.exam-result-institute-description {
    line-height: 1.3;
}

@media (max-width: 480px) {
    /* Cap an oversized configured gap on small screens; otherwise respect
       the admin's chosen Logo-Title Gap setting (no forced override here). */
    .exam-result-institute-header {
        max-width: 100%;
    }
}

.exam-result p {
    margin: 0.4rem 0;
    line-height: 1.4;
}

/* ===== CRITICAL: TABLE RESPONSIVENESS ===== */
.exam-result .table-responsive {
    overflow-x: auto;
    width: 100%;
    margin: 15px 0;
}

.exam-result table {
    width: 100%;
    border-collapse: collapse;
    min-width: 550px;
}

.exam-result th,
.exam-result td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.exam-result th {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
}

@media (max-width: 480px) {
    .exam-result th,
    .exam-result td {
        white-space: normal;
        word-break: break-word;
    }
    .exam-result table {
        min-width: auto;
    }
}

/* ===== GRADE COLOR-CODING ===== */
/* Matched by the subject-wise Grade cell and the Overall Grade line, via
   PHP-rendered data-grade="<letter>" attributes. Grade letters remain as
   visible text in every case -- color is a supplementary visual cue only,
   never the sole way grade information is conveyed. */
.exam-result [data-grade] {
    font-weight: 700;
}
.exam-result [data-grade="A+"],
.exam-result [data-grade="A"] {
    color: var(--success);
}
.exam-result [data-grade="F"] {
    color: var(--danger);
}

.required-field::after {
    content: " *";
    color: var(--danger);
}

/* ===== MOBILE & TABLET ===== */
@media (max-width: 768px) {
    .exam-result-search-form p {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .exam-result-search-form .form-group {
        flex: auto;
        min-width: auto;
    }
    .exam-result-search-form .form-group:last-child {
        grid-column: span 2;
    }
    .exam-result {
        padding: 15px;
    }
    .exam-result-search-container {
        padding: 16px;
    }
    .exam-result-search-form {
        padding: 16px;
    }
    .exam-result h3 {
        margin-bottom: 10px;
    }
    .exam-result-search-form label {
        white-space: normal;
    }
}

@media (max-width: 480px) {
    .exam-result-search-form p {
        grid-template-columns: 1fr;
    }
    .exam-result-search-form .form-group:last-child {
        grid-column: span 1;
    }
    .print-button {
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }
}
