/* =========================================================================
   School Admissions Portal — custom styles (Bootstrap 5.3 companion)
   ====================================================================== */
:root {
    --brand: #1746ff;
    --accent: #f23845;
    --accent-50: #feecee;
    --brand-600: #0f36d6;
    --brand-700: #0b2aa8;
    --brand-50: #edf1ff;
    --brand-100: #dbe4ff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --bg: #f5f6fa;
    --sidebar-bg: #0f172a;
    --sidebar-ink: #cbd5e1;
    --sidebar-hover: #1e293b;
    --radius: 14px;
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);

    --bs-body-font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: #ffffff; /* cards, inputs and menus are white; the page background is set on body */
    --bs-primary: #1746ff;
    --bs-primary-rgb: 23, 70, 255;
    --bs-link-color: #0f36d6;
    --bs-link-color-rgb: 15, 54, 214;
    --bs-link-hover-color: #0b2aa8;
    --bs-border-color: var(--line);
    --bs-border-radius: .6rem;

    /* Status palette */
    --st-submitted: #475569;          --st-submitted-bg: #f1f5f9;
    --st-under_review: #1d4ed8;       --st-under_review-bg: #dbeafe;
    --st-documents_verified: #0e7490; --st-documents_verified-bg: #cffafe;
    --st-counselor_review: #6d28d9;   --st-counselor_review-bg: #ede9fe;
    --st-accepted: #15803d;           --st-accepted-bg: #dcfce7;
    --st-rejected: #b91c1c;           --st-rejected-bg: #fee2e2;
    --st-waitlisted: #b45309;         --st-waitlisted-bg: #fef3c7;
}

body { -webkit-font-smoothing: antialiased; }
.min-w-0 { min-width: 0; }
.fw-800 { font-weight: 800; }
.text-primary { color: var(--brand) !important; }
.bg-primary-subtle { background-color: var(--brand-50) !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; letter-spacing: .04em; }

.skip-link { position: absolute; top: .5rem; left: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: .5rem; box-shadow: var(--shadow-soft); }
main:focus { outline: none; }

/* Buttons */
.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: 23, 70, 255;
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600);
    --bs-btn-focus-shadow-rgb: 23, 70, 255;
}
.btn { font-weight: 500; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #9cb3ff; box-shadow: 0 0 0 .25rem rgba(23, 70, 255, .15);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 600; font-size: .88rem; color: #334155; margin-bottom: .4rem; letter-spacing: .01em; }
.form-control, .form-select { background-color: #ffffff; border: 1px solid #cbd5e1; color: var(--ink); font-weight: 400; padding-top: .55rem; padding-bottom: .55rem; }
.form-control:hover, .form-select:hover { border-color: #94a3b8; }
.form-control::placeholder { color: #94a3b8; opacity: 1; }
.form-control:disabled, .form-control[readonly] { background-color: #f1f5f9; color: var(--muted); }
.form-text { color: #64748b; font-size: .82rem; }
.apply-form { max-width: 920px; }
.required::after { content: " *"; color: var(--accent); }
.btn-accent {
    --bs-btn-color: #fff; --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #d92536; --bs-btn-hover-border-color: #d92536;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #bf1d2d; --bs-btn-active-border-color: #bf1d2d;
    --bs-btn-focus-shadow-rgb: 242, 56, 69;
}

/* Cards */
.card { border: 1px solid var(--line); border-radius: var(--radius); }
.shadow-soft { box-shadow: var(--shadow-soft); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 1rem 1.25rem; }
.card-header h2, .card-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.section-title { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Brand */
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 700; }
.brand-mark {
    width: 2.1rem; height: 2.1rem; border-radius: .65rem; display: inline-grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), #f23845); color: #fff; font-size: 1.05rem; flex-shrink: 0;
}
.brand-text { line-height: 1.15; }

/* =========================================================================
   Public layout
   ====================================================================== */
.public-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.public-main { flex: 1 0 auto; }
.public-nav { background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; }
.public-nav .nav-link { color: var(--ink); font-weight: 500; }
.public-nav .nav-link:hover { color: var(--brand); }
.public-footer { border-top: 1px solid var(--line); background: #fff; padding: 1.25rem 0; color: var(--muted); font-size: .9rem; }
.public-footer a { color: var(--muted); text-decoration: none; }
.public-footer a:hover { color: var(--brand); }

.hero {
    background:
        radial-gradient(1000px 400px at 10% -10%, rgba(242, 56, 69, .18), transparent 60%),
        radial-gradient(800px 400px at 100% 0%, rgba(23, 70, 255, .18), transparent 60%),
        linear-gradient(180deg, #ffffff, var(--bg));
    padding: 4.5rem 0 3.5rem;
}
.hero h1 { font-weight: 800; letter-spacing: -.02em; }
.hero .lead { color: var(--muted); }
.eyebrow { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 999px; background: var(--accent-50); color: var(--accent); font-weight: 600; font-size: .8rem; }

.portal-card { transition: transform .15s ease, box-shadow .15s ease; height: 100%; }
.portal-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(15, 23, 42, .10); }
.portal-icon { width: 3rem; height: 3rem; border-radius: .9rem; display: grid; place-items: center; font-size: 1.4rem; }
.portal-icon.student { background: #dbe4ff; color: #0f36d6; }
.portal-icon.counselor { background: #ede9fe; color: #6d28d9; }
.portal-icon.admin { background: #dcfce7; color: #15803d; }
.portal-icon.track { background: #fef3c7; color: #b45309; }

.step-card { position: relative; padding-left: 3.25rem; }
.step-num { position: absolute; left: 0; top: 0; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: grid; place-items: center; }

.auth-wrap { min-height: calc(100vh - 140px); display: flex; align-items: center; padding: 2.5rem 0; }
.auth-card { max-width: 460px; width: 100%; margin: 0 auto; }

/* =========================================================================
   Portal layout
   ====================================================================== */
.portal-body { background: var(--bg); }
.portal-shell { display: flex; min-height: 100vh; }
.portal-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.portal-content { padding: 1.5rem; flex: 1 0 auto; max-width: 1400px; width: 100%; }
.portal-footer { padding: 1rem 1.5rem; color: var(--muted); font-size: .85rem; }

.portal-topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; justify-content: space-between;
    background: var(--sidebar-bg); padding: .65rem 1rem;
}
.portal-topbar .brand { color: #fff; }

.sidebar-col { flex: 0 0 auto; }
.sidebar { color: var(--sidebar-ink); }
.sidebar.offcanvas-lg { background: var(--sidebar-bg); --bs-offcanvas-width: 280px; }
.sidebar .offcanvas-header { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar .offcanvas-header .brand { color: #fff; }
.sidebar-inner { display: flex; flex-direction: column; width: 100%; min-height: 100%; padding: 1.25rem 1rem; }
.sidebar-inner > .brand { color: #fff; padding: 0 .5rem 1.25rem; }
.sidebar-role { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #8ea6ff; padding: 0 .75rem .5rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar-link {
    display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: .6rem;
    color: var(--sidebar-ink); text-decoration: none; font-weight: 500; font-size: .94rem;
}
.sidebar-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: .85; }
.sidebar-link:hover, .sidebar-link:focus-visible { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(23, 70, 255, .35); }
.sidebar-link.active i { opacity: 1; }
.sidebar-footer { margin-top: auto; padding: 1rem .5rem 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-muted { color: #94a3b8; }
.avatar { width: 2.4rem; height: 2.4rem; border-radius: 50%; background: #1a2c8c; color: #d3ddff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }

@media (min-width: 992px) {
    .sidebar-col { width: 264px; background: var(--sidebar-bg); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
    .sidebar-col .sidebar, .sidebar-col .offcanvas-body { height: 100%; }
    .portal-content { padding: 2rem 2.25rem; }
}

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-header .subtitle { color: var(--muted); margin: .25rem 0 0; }

/* Stat cards */
.stat-card { padding: 1.15rem 1.25rem; height: 100%; }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat-card .stat-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-icon { width: 2.6rem; height: 2.6rem; min-width: 2.6rem; border-radius: .75rem; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; line-height: 1; }
.stat-icon .bi { line-height: 1; }
/* Stat cards: icon on top, label underneath, then the number */
.stat-card > .d-flex:first-child { flex-direction: column-reverse; align-items: flex-start !important; justify-content: flex-start !important; gap: .75rem; }
.stat-card .stat-label { line-height: 1.3; }

/* Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; border-bottom-width: 1px; white-space: nowrap; background: #f8fafc; }
.table > tbody td { vertical-align: middle; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8fafc; }
.table-card { overflow: hidden; }
.table-card .table > :not(caption) > * > * { padding: .8rem 1rem; }

/* Status badges */
.status-badge {
    display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .76rem;
    padding: .38rem .65rem; border-radius: 999px; white-space: nowrap;
}
.status-badge.lg { font-size: .95rem; padding: .5rem .9rem; }
.status-submitted { --st: var(--st-submitted); --st-bg: var(--st-submitted-bg); }
.status-under_review { --st: var(--st-under_review); --st-bg: var(--st-under_review-bg); }
.status-documents_verified { --st: var(--st-documents_verified); --st-bg: var(--st-documents_verified-bg); }
.status-counselor_review { --st: var(--st-counselor_review); --st-bg: var(--st-counselor_review-bg); }
.status-accepted { --st: var(--st-accepted); --st-bg: var(--st-accepted-bg); }
.status-rejected { --st: var(--st-rejected); --st-bg: var(--st-rejected-bg); }
.status-waitlisted { --st: var(--st-waitlisted); --st-bg: var(--st-waitlisted-bg); }
.status-badge[class*="status-"] { color: var(--st); background: var(--st-bg); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; padding: 0 0 1.5rem 2.75rem; }
.timeline-item::before { content: ""; position: absolute; left: .95rem; top: 2rem; bottom: .25rem; width: 2px; background: var(--line); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: absolute; left: 0; top: 0; width: 2rem; height: 2rem; border-radius: 50%;
    display: grid; place-items: center; font-size: .9rem; color: var(--st); background: var(--st-bg);
    border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.timeline-item.is-current .timeline-dot { box-shadow: 0 0 0 3px var(--st-bg), 0 0 0 4px var(--st); }
.timeline-body { padding-top: .2rem; }
.timeline-note { background: #f8fafc; border: 1px solid var(--line); border-left: 3px solid var(--st); border-radius: .5rem; padding: .6rem .8rem; font-size: .9rem; }

/* Progress steps */
.progress-steps { list-style: none; padding: 0; margin: 0; display: flex; gap: .5rem; counter-reset: step; }
.progress-steps .step { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; gap: .4rem; min-width: 0; }
.progress-steps .step:not(:last-child)::after {
    content: ""; position: absolute; top: 1rem; left: calc(50% + 1.25rem); right: calc(-50% + 1.25rem); height: 2px; background: var(--line);
}
.progress-steps .step.done:not(:last-child)::after { background: var(--brand); }
.step-marker { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: #fff; border: 2px solid var(--line); color: var(--muted); position: relative; z-index: 1; }
.step.done .step-marker { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.current .step-marker { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); }
.step.current.decision-accepted .step-marker { background: var(--st-accepted); border-color: var(--st-accepted); color: #fff; box-shadow: 0 0 0 4px var(--st-accepted-bg); }
.step.current.decision-rejected .step-marker { background: var(--st-rejected); border-color: var(--st-rejected); color: #fff; box-shadow: 0 0 0 4px var(--st-rejected-bg); }
.step.current.decision-waitlisted .step-marker { background: var(--st-waitlisted); border-color: var(--st-waitlisted); color: #fff; box-shadow: 0 0 0 4px var(--st-waitlisted-bg); }
.step-label { font-size: .78rem; font-weight: 500; color: var(--muted); }
.step.current .step-label, .step.done .step-label { color: var(--ink); }
@media (max-width: 575.98px) {
    .progress-steps { flex-direction: column; gap: .75rem; }
    .progress-steps .step { flex-direction: row; text-align: left; }
    .progress-steps .step:not(:last-child)::after { display: none; }
}

/* Acknowledgement display */
.ack-box { border: 2px dashed #9cb3ff; background: var(--brand-50); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.ack-number { font-size: clamp(1.5rem, 5vw, 2.4rem); font-weight: 800; color: var(--brand-700); letter-spacing: .06em; word-break: break-all; }

/* Empty / loading states */
.empty-icon { width: 3.5rem; height: 3.5rem; margin: 0 auto; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-size: 1.5rem; }
.btn .spinner-border { width: 1rem; height: 1rem; border-width: .15em; }
.is-loading { pointer-events: none; opacity: .85; }

/* Detail lists */
.detail-list { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: .55rem 1rem; margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 500; font-size: .88rem; }
.detail-list dd { margin: 0; word-break: break-word; }
@media (max-width: 575.98px) {
    .detail-list { grid-template-columns: 1fr; gap: .1rem; }
    .detail-list dd { margin-bottom: .6rem; }
}
.statement { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: .6rem; padding: 1rem; max-height: 420px; overflow: auto; }

.doc-item { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: .6rem; background: #fff; }
.doc-item + .doc-item { margin-top: .5rem; }
.doc-icon { width: 2.25rem; height: 2.25rem; border-radius: .5rem; display: grid; place-items: center; background: #fef2f2; color: #dc2626; flex-shrink: 0; }
.doc-icon.img { background: #ecfeff; color: #0e7490; }

.note-item { border: 1px solid var(--line); border-radius: .6rem; padding: .75rem .9rem; background: #fffbeb; }
.note-item + .note-item { margin-top: .6rem; }

.report-bar { height: .5rem; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.report-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

.filter-card .form-label { font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }

/* =========================================================================
   Printable acknowledgement slip
   ====================================================================== */
.slip-body { background: #e9ecf3; }
.slip { max-width: 800px; margin: 2rem auto; background: #fff; border-radius: 12px; padding: 2.5rem; box-shadow: var(--shadow-soft); }
.slip-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.slip table th { width: 38%; color: var(--muted); font-weight: 500; }

@media print {
    @page { margin: 14mm; }
    body, .slip-body, .portal-body { background: #fff !important; }
    .no-print, .sidebar-col, .portal-topbar, .public-nav, .public-footer, .portal-footer, .btn, .alert { display: none !important; }
    .slip { box-shadow: none; margin: 0; padding: 0; max-width: none; }
    .card { box-shadow: none !important; }
    a { text-decoration: none; color: inherit; }
    .portal-content { padding: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
