* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #222;
}

/* ---------- Login page ---------- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 320px;
}

.login-box h2 {
    margin-bottom: 20px;
    text-align: center;
    color: #1a3c6e;
}

.login-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.login-box button {
    width: 100%;
    padding: 10px;
    background: #29abc4;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
}

.login-box button:hover { background: #228fa5; }

.error-msg {
    background: #fdecea;
    color: #b71c1c;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

.success-msg {
    background: #e6f4ea;
    color: #1e7e34;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* ---------- Top bar ---------- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 55px;
    background: #29abc4;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

.topbar-logo {
    background: #fff;
    color: #29abc4;
    padding: 5px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
    margin-right: 20px;
}

.topbar-school {
    font-size: 15px;
    font-weight: bold;
}

.topbar-right {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-right a {
    color: #fff;
    text-decoration: none;
    opacity: 0.9;
}

.topbar-right a:hover { opacity: 1; text-decoration: underline; }

.topbar-user {
    border-left: 1px solid rgba(255,255,255,0.4);
    padding-left: 20px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-bar select {
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: #888;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 55px;
    left: 0;
    bottom: 0;
    width: 210px;
    background: #1e2a38;
    padding-top: 10px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #cfd8e3;
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: #29384a;
    color: #fff;
}

.sidebar-link.active {
    background: #29384a;
    color: #29abc4;
    border-left: 3px solid #29abc4;
}

.sidebar-section {
    border-left: 3px solid transparent;
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #cfd8e3;
    font-size: 14px;
    cursor: pointer;
    list-style: none;
}

.sidebar-section-title::-webkit-details-marker { display: none; }

.sidebar-section-title:hover {
    background: #29384a;
    color: #fff;
}

.sidebar-section[open] > .sidebar-section-title {
    color: #29abc4;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 20px 9px 34px;
    color: #9fb0c3;
    text-decoration: none;
    font-size: 13px;
}

.sidebar-sublink:hover {
    background: #29384a;
    color: #fff;
}

.soon-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #566577;
    flex-shrink: 0;
}

.sidebar-icon {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0;
    display: inline-block;
}

.sidebar-logout {
    border-top: 1px solid #2c3b4d;
    margin-top: 10px;
}

/* ---------- Main content ---------- */
.main-content {
    margin-left: 210px;
    margin-top: 55px;
    padding: 25px 30px;
}

/* ---------- Impersonation ("Login as Student") banner ---------- */
.impersonation-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: #f0932b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 13px;
    z-index: 20;
}
.impersonation-banner a {
    color: #fff;
    font-weight: bold;
    text-decoration: underline;
}
body.impersonating .topbar { top: 32px; }
body.impersonating .sidebar { top: 87px; }
body.impersonating .main-content { margin-top: 87px; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 { font-size: 20px; color: #1e2a38; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #29abc4;
    color: #fff;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.btn:hover { background: #228fa5; }

.btn-danger { background: #d9455f; }
.btn-danger:hover { background: #b8364c; }

.btn-small { padding: 5px 10px; font-size: 13px; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

th { background: #1e2a38; color: #fff; }

tr:hover { background: #f9f9f9; }

.card {
    background: #fff;
    padding: 25px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    max-width: 500px;
}

.form-group { margin-bottom: 15px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: bold;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

/* ---------- Dashboard stat cards ---------- */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    border-radius: 4px;
    padding: 18px 20px;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.stat-card .number {
    font-size: 26px;
    font-weight: bold;
}

.stat-card .label {
    font-size: 12px;
    letter-spacing: 0.5px;
    margin-top: 4px;
    opacity: 0.9;
    text-transform: uppercase;
}

.stat-orange { background: #f0932b; }
.stat-blue   { background: #4a89dc; }
.stat-green  { background: #2ecc71; }
.stat-red    { background: #e74c3c; }
.stat-pink   { background: #e84393; }
.stat-dark   { background: #1e2a38; }
.stat-purple { background: #7c5cbf; }
.stat-teal   { background: #16a085; }

.chart-card {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.chart-card h3 {
    font-size: 14px;
    color: #444;
    margin-bottom: 15px;
    font-weight: normal;
}

/* ---------- Dependency-free CSS bar chart (Dashboard) ---------- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    height: 230px;
    padding: 10px 10px 0;
    overflow-x: auto;
}

.bar-chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.bar-chart-value {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
    font-weight: bold;
}

.bar-chart-bar {
    width: 36px;
    background: #29abc4;
    border-radius: 4px 4px 0 0;
    transition: height 0.2s;
}

.bar-chart-label {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
    text-align: center;
    white-space: nowrap;
}

/* ---------- Add Student page ---------- */
.add-student-actions {
    display: flex;
    gap: 10px;
}

.btn-orange { background: #f0932b; }
.btn-orange:hover { background: #d97e1c; }
.btn-green { background: #2ecc71; }
.btn-green:hover { background: #25b366; }
.btn-blue { background: #4a89dc; }
.btn-blue:hover { background: #3b73bf; }

.register-card {
    background: #fff;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.register-title {
    text-align: center;
    font-size: 18px;
    color: #333;
    font-weight: normal;
    margin-bottom: 25px;
}

.add-student-columns {
    display: flex;
    gap: 50px;
    flex-wrap: wrap;
}

.add-student-col {
    flex: 1;
    min-width: 280px;
}

.col-heading {
    text-align: center;
    font-size: 13px;
    color: #e07b39;
    font-weight: bold;
    margin-bottom: 18px;
}

.req-note { font-weight: normal; color: #d9455f; }
.req { color: #d9455f; }
.hint { font-weight: normal; color: #888; font-size: 12px; }

.register-submit {
    text-align: center;
    margin-top: 20px;
}

/* ---------- Students list page ---------- */
.btn-excel { background: #217346; }
.btn-excel:hover { background: #1a5c38; }

.list-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 20px;
}

.list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #555;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-field label {
    font-size: 12px;
    color: #666;
}

.filter-field select, .filter-field input[type="text"] {
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    min-width: 150px;
}

.list-toolbar {
    display: flex;
    gap: 20px;
    width: 100%;
    margin-top: 10px;
}

.table-scroll {
    overflow-x: auto;
    margin-top: 10px;
}

.table-scroll table { min-width: 1100px; }

.list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-size: 13px;
    color: #666;
}

.pagination {
    display: flex;
    gap: 4px;
}

.pagination a {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
}

.pagination a.active {
    background: #29abc4;
    color: #fff;
    border-color: #29abc4;
}

.pagination a.disabled {
    color: #ccc;
    pointer-events: none;
}

/* ---------- Student profile view page ---------- */
.view-layout {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.view-photo-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 25px;
    text-align: center;
    width: 220px;
    flex-shrink: 0;
    height: fit-content;
}

.student-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px;
    display: block;
}

.student-photo-placeholder {
    background: #29abc4;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
}

.view-photo-name { font-weight: bold; font-size: 15px; }
.view-photo-id { color: #888; font-size: 13px; margin-top: 4px; }

.view-details {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.view-section {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 20px 25px;
}

.view-section h3 {
    font-size: 14px;
    color: #1e2a38;
    margin-bottom: 12px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.view-field {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
}

.view-label { color: #777; }
.view-value { color: #222; font-weight: 500; }

/* ---------- Summary tabs ---------- */
.summary-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
}

.summary-tabs a {
    padding: 12px 20px;
    text-decoration: none;
    color: #666;
    font-size: 13px;
    border-bottom: 2px solid transparent;
}

.summary-tabs a:hover { color: #29abc4; }

.summary-tabs a.active {
    color: #29abc4;
    border-bottom: 2px solid #29abc4;
    font-weight: bold;
}

.migrate-bar {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #eef7fa; }

.photo-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.photo-thumb-placeholder {
    background: #29abc4;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

/* ---------- Toggle switch (Considered Sets) ---------- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    border-radius: 22px;
    transition: 0.2s;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #29abc4;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* ---------- Exam marks entry ---------- */
.marks-heading {
    text-align: center;
    margin: 20px 0;
    font-size: 15px;
    font-weight: normal;
    color: #333;
}

.hl-orange { color: #f0932b; font-weight: bold; }
.hl-green { color: #2ecc71; font-weight: bold; }
.hl-blue { color: #4a89dc; font-weight: bold; }

.mark-input {
    width: 100px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

/* ---------- Report Card ---------- */
.report-card {
    background: #fff;
    padding: 18px 22px;
    margin-bottom: 25px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    max-width: 900px;
    font-size: 12.5px;
}

.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 2px;
    margin-bottom: 0;
}

.report-logo { width: 75px; height: 75px; object-fit: contain; flex-shrink: 0; }
.report-student-photo {
    width: 90px;
    height: 105px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ccc;
    flex-shrink: 0;
}

.report-school-info { text-align: center; flex: 1; min-width: 0; }
.report-school-info h2 { color: #1a56db; font-size: 19px; margin-bottom: 3px; font-weight: bold; }
.report-school-info p { font-size: 12px; color: #333; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-contact-line { font-size: 11.5px !important; }

.report-title {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    margin: 2px 0 10px;
    border-bottom: 2px solid #1a56db;
    padding-bottom: 8px;
}

.report-value { color: #1a56db; font-weight: bold; }

.report-info-table, .report-marks-table, .report-legend-table, .report-comments-table, .report-dates-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 12px;
}

.report-info-table td, .report-marks-table th, .report-marks-table td,
.report-legend-table th, .report-legend-table td,
.report-comments-table td, .report-dates-table td {
    border: 1px solid #999;
    padding: 5px 7px;
}

.report-marks-table th { background: #1a56db; color: #fff; font-size: 11px; font-weight: bold; text-align: center; }
.report-marks-table td { text-align: center; }
.report-marks-table td:first-child { text-align: left; }
.report-totals-row td { font-weight: bold; background: #f0f0f0; text-align: center; }
.report-totals-row td:first-child { text-align: left; }

.report-legend-table th { background: #1a56db; color: #fff; font-size: 11px; }
.report-legend-table td { font-size: 11px; }

/* The horizontal D1-F9 grading strip used on the A-Level report */
.report-legend-uneb th, .report-legend-uneb td { text-align: center; }
.report-legend-uneb th { background: #f0f0f0; color: #222; width: 70px; }

.report-sign { width: 90px; text-align: left; color: #666; }

.report-footer-note {
    text-align: center;
    font-size: 11.5px;
    color: #666;
    margin: 5px 0;
}
.report-footer-warning { color: #d9455f; font-weight: bold; }

@media print {
    .no-print, .sidebar, .topbar { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .report-card { box-shadow: none; page-break-after: always; max-width: 100%; }
    @page { size: A4; margin: 12mm; }
}

/* ---------- E-Learning Center ---------- */
.btn-outline { background: #fff; color: #29abc4; border: 1px solid #29abc4; }
.btn-outline:hover { background: #eef9fb; }

.elearning-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.elearning-stat-card {
    display: flex;
    align-items: stretch;
    border-radius: 6px;
    overflow: hidden;
    flex: 1;
    min-width: 220px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.elearning-stat-icon {
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}
.elearning-stat-card > div:last-child {
    flex: 1;
    padding: 14px 16px;
    color: #fff;
}
.elearning-stat-number { font-size: 22px; font-weight: bold; }
.elearning-stat-label { font-size: 11px; letter-spacing: 0.5px; opacity: 0.9; }

.elearning-stat-green .elearning-stat-icon { background: #27ae60; }
.elearning-stat-green > div:last-child { background: #4cc785; }
.elearning-stat-blue .elearning-stat-icon { background: #2f7de1; }
.elearning-stat-blue > div:last-child { background: #5b9df0; }
.elearning-stat-teal .elearning-stat-icon { background: #1a8fa3; }
.elearning-stat-teal > div:last-child { background: #29abc4; }

.elearning-tabs {
    display: flex;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}
.elearning-tab {
    flex: 1;
    text-align: center;
    padding: 12px 10px;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    border-right: 1px solid #e5e5e5;
    background: #f7f9fa;
}
.elearning-tab:last-child { border-right: none; }
.elearning-tab.active { background: #fff; color: #29abc4; font-weight: bold; border-bottom: 2px solid #29abc4; }
.elearning-tabs + .list-card { border-radius: 0 0 6px 6px; margin-top: 0; }

.elearning-section-title { color: #27ae60; font-size: 16px; margin: 15px 0 10px; }
