@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Sora:wght@500;600;700&display=swap');
@import url('./icons/bootstrap-icons.min.css');

:root {
    --ink: #1e3437;
    --muted: #617579;
    --forest: #145e59;
    --forest-dark: #113f40;
    --coral: #be6250;
    --surface: #fff;
    --line: #d6e4df;
    --canvas: #f1f6f2;
}

body {
    background: var(--canvas);
    color: var(--ink);
    font-family: 'DM Sans', 'Trebuchet MS', sans-serif;
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6, .sidebar-brand, .brand {
    font-family: 'Sora', 'Trebuchet MS', sans-serif;
    letter-spacing: 0;
}

body .text-muted { color: var(--muted) !important; }
body .text-primary { color: var(--forest) !important; }
body .btn-primary, body .btn-primary:hover, body .btn-primary:focus {
    background: var(--forest);
    border-color: var(--forest);
    color: #fff;
}
body .btn-primary:hover, body .btn-primary:focus { background: var(--forest-dark); }
body .btn-outline-primary { border-color: var(--forest); color: var(--forest); }
body .btn-outline-primary:hover { background: var(--forest); color: #fff; }
body .btn { font-weight: 600; border-radius: 6px; }
body .btn:focus-visible, body a:focus-visible, body summary:focus-visible {
    outline: 3px solid var(--coral);
    outline-offset: 2px;
}
body .form-control, body .form-select {
    border-color: var(--line);
    border-radius: 6px;
    min-height: 44px;
}
body .form-control:focus, body .form-select:focus {
    border-color: var(--forest);
    box-shadow: 0 0 0 .2rem rgba(20, 94, 89, .14);
}
body .table { --bs-table-bg: transparent; color: var(--ink); }
body .table th { border-bottom-color: var(--line); font-weight: 700; }
body .table td { border-bottom-color: #eaf0ed; }
body .alert { border-radius: 6px; }
body .site-credit { border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; padding: 1rem; text-align: center; }
body .site-credit { border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; padding: 1rem; text-align: center; }
body.admin-login-page { display: flex; flex-direction: column; min-height: 100vh; }
body.admin-login-page .login-page { flex: 1; min-height: 0; }
body.auth-page { display: flex; flex-direction: column; }
body.auth-page .auth-shell { flex: 1; width: 100%; }
body .pagination .page-link { color: var(--forest); }
body .pagination .active .page-link { background: var(--forest); border-color: var(--forest); color: #fff; }
body .card, body .module-card, body .teacher-card, body .roster-card, body .guardian-panel,
body .inbox-item, body .application-panel, body .result-card, body .assessment-card,
body .form-panel, body .question, body .result, body .login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 7px 26px rgba(17, 63, 64, .045);
}
body .admin-sidebar { background: var(--forest-dark); }
body .admin-page { background: var(--canvas); }
body .topbar { background: #fff; border-bottom: 1px solid var(--line); }
body .admin-page > .topbar, body .guardian-top { position: sticky; top: 0; z-index: 1025; }
body .admin-sidebar .menu-group { border-bottom: 1px solid rgba(234, 247, 250, .16); padding-bottom: .25rem; }
body .teacher-sidebar-nav > a, body .teacher-sidebar-nav > details,
body .student-nav > a, body .guardian-nav > a { border-bottom: 1px solid rgba(234, 247, 250, .16); border-radius: 0; padding-bottom: .85rem; }
body .main-content { max-width: 1500px; }
body .site-navbar { background: var(--forest-dark); }
.public-nav-links { align-items: center; display: flex; gap: .4rem; }
.portal-link { border-radius: 5px; color: #e3f4ee; font-size: .86rem; font-weight: 600; padding: .45rem .6rem; text-decoration: none; }
.portal-link:hover, .portal-link:focus { background: rgba(255, 255, 255, .13); color: #fff; }
body .admission-hero { min-height: min(64vh, 600px); }
body .application-intro, body .module-hero, body .result-hero, body .cbt-header {
    background: linear-gradient(115deg, var(--forest-dark), var(--forest));
    border-radius: 6px;
}
body .application-intro:after, body .module-hero:after { display: none; }
body .application-progress span { border-radius: 6px; }
body .site-navbar .brand-logo, body .sidebar-logo { object-fit: contain; }

.responsive-menu-toggle, .responsive-menu-backdrop { display: none; }

.auth-page {
    min-height: 100vh;
    background: linear-gradient(125deg, #e8f2ed, #f8f8f5 65%, #eaf3f2);
}
.auth-shell { max-width: 490px; margin: auto; padding: min(11vh, 100px) 1rem 3rem; }
.auth-panel { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: clamp(1.5rem, 4vw, 2.5rem); box-shadow: 0 20px 55px rgba(17, 63, 64, .09); }
.auth-panel h1 { font-size: 1.65rem; font-weight: 700; }
.auth-mark, .brand-square { align-items: center; background: var(--forest); color: white; display: inline-flex; font-family: 'Sora', sans-serif; font-weight: 700; justify-content: center; }
.auth-mark { border-radius: 6px; margin-bottom: 1.5rem; padding: .4rem .75rem; }
.auth-mark span { color: #bde7d7; }
.brand-square { border-radius: 5px; height: 40px; width: 40px; }
body .brand-square { background: #fff url('../img/logo-warm.png') center / contain no-repeat; color: transparent; font-size: 0; }

body .portal-top, body .portal-header { background: var(--forest-dark); color: #fff; }
.portal-top-inner, .portal-header .container { align-items: center; display: flex; justify-content: space-between; gap: 1rem; min-height: 75px; }
.portal-brand { align-items: center; display: flex; gap: .8rem; }
.portal-brand strong, .portal-brand small { display: block; }
.portal-brand small { color: #c5e5df; font-size: .78rem; }
.portal-content { max-width: 1080px; padding: 2.5rem 1rem 5rem; }
.page-intro { border-bottom: 1px solid var(--line); margin-bottom: 1.75rem; padding-bottom: 1.5rem; }
.page-intro h1 { font-size: clamp(1.65rem, 3vw, 2.3rem); font-weight: 700; }
.page-intro p:last-child { color: var(--muted); margin-bottom: 0; }
.eyebrow { color: var(--forest); font-size: .69rem; font-weight: 700; margin: 0 0 .4rem; text-transform: uppercase; }
.empty-state { background: #fff; border: 1px dashed var(--line); padding: 2rem; text-align: center; }
.portal-section { border-bottom: 1px solid var(--line); padding: 1.5rem 0; }
.portal-section h2 { font-size: 1.15rem; font-weight: 700; }
.portal-section .table { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 0; }
.portal-section .table th, .portal-section .table td { padding: .75rem; }
.message-item { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: .65rem; overflow-wrap: anywhere; padding: 1rem; }
.conversation { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 1rem; padding: clamp(1rem, 3vw, 1.5rem); }
.conversation-heading { align-items: flex-start; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; padding-bottom: .8rem; }
.conversation-heading h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.conversation-heading p:last-child { color: var(--muted); margin: .2rem 0 0; }
.status-pill { border-radius: 4px; font-size: .74rem; font-weight: 700; padding: .2rem .5rem; }
.status-open { background: #dff3e8; color: #225e48; }
.status-blocked { background: #fae8e2; color: #884c3a; }
.chat-history { display: grid; gap: .65rem; padding: 1.25rem 0; }
.chat-row { display: flex; }
.chat-out { justify-content: flex-end; }
.chat-bubble { background: #eff4f1; border-radius: 6px; max-width: min(80%, 620px); overflow-wrap: anywhere; padding: .7rem .9rem; }
.chat-out .chat-bubble { background: #e0f1eb; }
.chat-bubble small { color: var(--muted); display: block; font-size: .72rem; margin-bottom: .3rem; }
.chat-bubble p { margin: 0; }
.chat-compose { align-items: end; display: flex; gap: .5rem; }
.chat-compose textarea { min-width: 0; resize: vertical; }
.chat-compose button { min-height: 44px; width: 48px; }
.block-notice { align-items: start; background: #fff2ed; border-left: 3px solid var(--coral); color: #633e35; display: flex; overflow-wrap: anywhere; padding: .75rem 1rem; }
.block-notice p { margin: .15rem 0 0; }
.block-controls { margin-top: .9rem; }
.block-controls summary { color: #8d493d; cursor: pointer; font-size: .86rem; font-weight: 600; }

/* Shared front/back ID card presentation. */
.id-card-spread {
    align-items: flex-start;
    background: #e7f4ea;
    border: 1px solid #c5e3cf;
    border-radius: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 1.35rem;
    justify-content: center;
    padding: 1.25rem;
}
.staff-id-card, .student-id-card {
    background: #fff;
    border: 2px solid #087b55;
    border-radius: 8px;
    box-sizing: border-box;
    height: 2.125in;
    overflow: hidden;
    padding: .12in;
    width: 3.375in;
}
.staff-id-card .id-card-header, .student-id-card .id-card-header {
    align-items: center;
    border-bottom: 1px solid #dbe8df;
    display: flex;
    gap: .12in;
    padding-bottom: .07in;
}
.staff-id-card .id-card-header img, .student-id-card .id-card-header img {
    height: .28in;
    object-fit: contain;
    width: .28in;
}
.staff-id-card .id-card-header strong, .student-id-card .id-card-header strong {
    display: block;
    font-size: .7rem;
    line-height: 1.1;
}
.staff-id-card .id-card-header small, .student-id-card .id-card-header small {
    color: #5d7469;
    display: block;
    font-size: .46rem;
}
.staff-id-card .id-card-body, .student-id-card .id-card-body {
    display: flex;
    gap: .14in;
    padding-top: .12in;
}
.staff-id-card .id-card-photo, .student-id-card .id-card-photo {
    border-radius: 4px;
    height: 1in;
    object-fit: cover;
    width: .82in;
}
.staff-id-card .id-card-initial, .student-id-card .id-card-initial {
    align-items: center;
    background: #087b80;
    color: #fff;
    display: flex;
    font-size: 1.5rem;
    justify-content: center;
}
.staff-id-card .id-card-details, .student-id-card .id-card-details {
    font-size: .52rem;
    margin: 0;
    width: 100%;
}
.staff-id-card .id-card-details dt, .student-id-card .id-card-details dt {
    border-bottom: 1px solid #e2ece5;
    color: #567064;
    float: left;
    font-weight: 700;
    padding: .045in 0;
    width: 43%;
}
.staff-id-card .id-card-details dd, .student-id-card .id-card-details dd {
    border-bottom: 1px solid #e2ece5;
    margin: 0;
    overflow: hidden;
    padding: .045in 0;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.staff-id-card .id-card-footer, .student-id-card .id-card-footer {
    border-top: 1px solid #dbe8df;
    color: #5d7469;
    font-size: .48rem;
    margin-top: .08in;
    padding-top: .05in;
}
.staff-id-card.id-card-back, .student-id-card.id-card-back { text-align: center; }
.staff-id-card .id-card-qr, .student-id-card .id-card-qr {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: .06in;
    padding-top: .08in;
}
.staff-id-card .id-card-qr svg, .student-id-card .id-card-qr svg {
    height: .9in;
    width: .9in;
}
.staff-id-card .id-card-qr small, .student-id-card .id-card-qr small {
    color: #5d7469;
    font-size: .48rem;
}

@media print {
    body { background: #fff; }
    body:has(.id-card-spread) .portal-section, body:has(.id-card-spread) .page-intro, body:has(.id-card-spread) nav,
    body:has(.id-card-spread) .teacher-page > .portal-top, body:has(.id-card-spread) .student-page > .portal-top { display: none !important; }
    .id-card-spread { background: #fff; border: 0; padding: 0; }
    .id-card-spread .btn, .id-card-spread .w-100 { display: none; }
}

@media (max-width: 700px) {
    .portal-content { padding-top: 1.5rem; }
    .portal-top-inner { flex-wrap: wrap; padding: .75rem 0; }
    .portal-top-inner > nav { flex-wrap: wrap; width: 100%; }
    .portal-top-inner > nav .btn { font-size: .8rem; }
    .portal-top-inner > nav form { margin: 0; }
    .chat-bubble { max-width: 92%; }
    body .admission-hero { min-height: 60vh; }
    body .sidebar-brand { font-size: 1.1rem; }
    .portal-link { font-size: .74rem; padding: .3rem; }
    .public-nav-links { gap: .1rem; }
}

@media (max-width: 991.98px) {
    .admin-sidebar, .teacher-sidebar, .student-sidebar, .guardian-sidebar {
        height: 100vh;
        height: 100dvh;
        left: 0;
        max-width: min(84vw, 320px);
        overflow-x: hidden;
        position: fixed;
        top: 0;
        transform: translateX(-105%);
        transition: transform .22s ease;
        z-index: 1050;
    }
    .admin-sidebar.open, .teacher-sidebar.open, .student-sidebar.open, .guardian-sidebar.open {
        transform: translateX(0);
    }
    .admin-page, .teacher-page, .student-page, .guardian-page { margin-left: 0 !important; }
    .responsive-menu-toggle {
        align-items: center;
        background: var(--forest-dark);
        border: 1px solid rgba(255,255,255,.24);
        border-radius: 0 0 8px 0;
        box-shadow: 0 3px 12px rgba(17,63,64,.2);
        color: #fff;
        display: inline-flex;
        font-size: 1.2rem;
        height: 46px;
        justify-content: center;
        left: 0;
        padding: 0;
        position: fixed;
        top: 0;
        width: 48px;
        z-index: 1030;
    }
    .responsive-menu-toggle:hover, .responsive-menu-toggle:focus { background: var(--forest); color: #fff; }
    .admin-page .mobile-menu { display: inline-flex; }
    .responsive-menu-backdrop.visible {
        background: rgba(9, 31, 32, .48);
        border: 0;
        display: block;
        inset: 0;
        padding: 0;
        position: fixed;
        z-index: 1035;
    }
    body.navigation-open { overflow: hidden; }
    .topbar { padding-left: 3.5rem !important; }
    .teacher-page > .portal-top, .student-page > .portal-top { padding-left: 3rem; }
    .guardian-top { padding-left: 3.25rem; }
}

@media (max-width: 575.98px) {
    .main-content { padding: .75rem !important; }
    .portal-content { padding: 1rem .75rem 3rem; }
    .page-intro { margin-bottom: 1.15rem; padding-bottom: 1rem; }
    .page-intro h1 { font-size: clamp(1.4rem, 7vw, 1.9rem); overflow-wrap: anywhere; }
    .portal-section { padding: 1rem 0; }
    .conversation, .portal-section .conversation { padding: .85rem; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .table-responsive > .table { min-width: 620px; }
    .row.g-3 { --bs-gutter-y: .85rem; }
    .btn { white-space: normal; }
    .responsive-menu-toggle { height: 44px; width: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *:before, *:after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.staff-id-card .id-card-header { justify-content: center; text-align: center; }
.staff-id-card .id-card-header > div { text-align: center; }
.staff-id-card .id-card-body > div:first-child { flex: 0 0 .82in; text-align: center; }
.staff-id-card .id-card-body > div:first-child > strong { line-height: 1.15; margin-top: .06in; overflow-wrap: anywhere; text-align: center; }
.staff-id-card .id-card-details dt:first-child { text-align: center; }