/* =====================================================================
   BCF College of Nursing - Admission System
   ===================================================================== */

:root {
    --green:      #0b5c4b;
    --green-dark: #084337;
    --green-soft: #e6f2ef;
    --ink:        #1f2937;
    --muted:      #6b7280;
    --line:       #e5e7eb;
    --bg:         #f4f6f8;
    --white:      #ffffff;
    --red:        #b91c1c;
    --red-soft:   #fef2f2;
    --amber:      #b45309;
    --amber-soft: #fffbeb;
    --blue:       #1d4ed8;
    --blue-soft:  #eff6ff;
    --radius:     8px;
    --shadow:     0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }

/* A class-level `display` beats the browser's built-in [hidden] rule, so
   anything the JavaScript hides needs this to actually disappear. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.wrap      { max-width: 900px;  margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.page      { padding-top: 24px; padding-bottom: 48px; }
.muted     { color: var(--muted); }

/* ---------- Header ---------- */
.site-header, .admin-header { background: var(--green); color: #fff; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 62px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    background: #fff; color: var(--green); font-weight: 800; letter-spacing: .5px;
    padding: 6px 9px; border-radius: 6px; font-size: 14px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { opacity: .8; font-size: 12px; }

.admin-nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a {
    color: #fff; text-decoration: none; padding: 7px 12px; border-radius: 6px;
    font-size: 14px; opacity: .85;
}
.admin-nav a:hover  { background: rgba(255,255,255,.12); opacity: 1; }
.admin-nav a.active { background: rgba(255,255,255,.2); opacity: 1; font-weight: 600; }
.logout-form { display: flex; align-items: center; gap: 10px; margin-left: 12px; }
.who { font-size: 13px; opacity: .85; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--line); background: var(--white);
    padding: 20px 0; font-size: 13px; color: var(--muted);
}
.site-footer p { margin: 2px 0; }

/* ---------- Hero ---------- */
.hero { margin-bottom: 20px; }
.hero h1 { font-size: 24px; margin: 0 0 6px; color: var(--green-dark); }
.hero p  { margin: 0; color: var(--muted); }

/* ---------- Cards / sections ---------- */
.card {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.form { padding: 0; overflow: hidden; }
.fieldset { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.fieldset:last-child { border-bottom: 0; }
.fieldset h2 {
    font-size: 16px; margin: 0 0 16px; color: var(--green-dark);
    display: flex; align-items: center; gap: 10px;
}
.step {
    background: var(--green-soft); color: var(--green-dark);
    width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}

/* ---------- Grid + fields ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.span2 { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .grid, .grid-3 { grid-template-columns: 1fr; }
    .span2 { grid-column: auto; }
}

.field { display: flex; flex-direction: column; }
.field label { font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field small { font-size: 12px; color: var(--muted); margin-top: 4px; }
.req { color: var(--red); }

input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=number], input[type=password], input[type=file], select, textarea {
    width: 100%; padding: 9px 11px; font: inherit; font-size: 14px;
    border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,92,75,.12);
}
input[readonly] { background: #f3f4f6; color: var(--muted); }
input:disabled, select:disabled { background: #f3f4f6; cursor: not-allowed; }
textarea { min-height: 84px; resize: vertical; }

.field.has-error input, .field.has-error select { border-color: var(--red); }
.field-error { color: var(--red); font-size: 12px; margin: 5px 0 0; }

.hint { font-size: 13px; color: var(--muted); margin: 6px 0 14px; }
.check-inline { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check-inline input { margin-top: 3px; width: 16px; height: 16px; flex: none; }

/* Honeypot - hidden from people, present for bots */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

#comm-fields.mirrored { opacity: .72; }

/* ---------- Marks ---------- */
.marks-box {
    margin-top: 18px; padding: 16px; background: #fafafa;
    border: 1px solid var(--line); border-radius: var(--radius);
}
.marks-note { margin: 0 0 12px; font-size: 13px; }
.calc {
    display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px;
    padding: 12px; background: var(--green-soft); border-radius: 6px;
}
.calc > div { display: flex; flex-direction: column; padding: 0 14px; }
.calc span { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--green-dark); opacity: .8; }
.calc strong { font-size: 17px; color: var(--green-dark); }
.calc .calc-main { margin-left: auto; text-align: right; }
.calc .calc-main strong { font-size: 22px; }

/* ---------- Documents ---------- */
.doc-row {
    display: grid; grid-template-columns: 240px 1fr auto; gap: 10px;
    align-items: center; margin-bottom: 10px;
}
@media (max-width: 640px) { .doc-row { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block; font: inherit; font-size: 14px; font-weight: 600;
    padding: 9px 16px; border-radius: 6px; border: 1px solid transparent;
    cursor: pointer; text-decoration: none; text-align: center; line-height: 1.3;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-outline { background: #fff; color: var(--green-dark); border-color: var(--green); }
.btn-ghost   { background: transparent; color: inherit; border-color: rgba(0,0,0,.18); }
.admin-header .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 15px; border-radius: 6px; margin-bottom: 16px;
    border: 1px solid; font-size: 14px;
}
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-error, .alert-danger { background: var(--red-soft);   border-color: #fecaca; color: #7f1d1d; }
.alert-success             { background: #ecfdf5;            border-color: #a7f3d0; color: #065f46; }
.alert-info                { background: var(--blue-soft);   border-color: #bfdbfe; color: #1e3a8a; }
.alert-warning             { background: var(--amber-soft);  border-color: #fde68a; color: #78350f; }

/* ---------- Centred pages (login, success) ---------- */
.centered-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.centered-main { width: 100%; max-width: 400px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; color: var(--green-dark); }
.login-card .field { margin-bottom: 14px; }

.result-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px; text-align: center; }
.result-icon { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.result-card h1 { font-size: 22px; margin: 0 0 8px; color: var(--green-dark); }
.app-no {
    display: inline-block; margin: 14px 0; padding: 10px 20px;
    background: var(--green-soft); color: var(--green-dark);
    border-radius: 6px; font-size: 19px; font-weight: 700; letter-spacing: .5px;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fcfcfd; }
table.data a { color: var(--green-dark); font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
    text-transform: uppercase; letter-spacing: .3px;
}
.badge-pending_approval  { background: var(--amber-soft); color: var(--amber); }
.badge-payment_pending   { background: var(--blue-soft);  color: var(--blue); }
.badge-payment_submitted { background: #f5f3ff;           color: #6d28d9; }
.badge-payment_verified  { background: #ecfdf5;           color: #047857; }
.badge-rejected          { background: var(--red-soft);   color: var(--red); }
.badge-auto              { background: #ecfdf5;           color: #047857; }
.badge-manual            { background: var(--amber-soft); color: var(--amber); }
.badge-sent, .badge-logged, .badge-verified { background: #ecfdf5; color: #047857; }
.badge-failed            { background: var(--red-soft);   color: var(--red); }
.badge-queued, .badge-submitted { background: var(--blue-soft); color: var(--blue); }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; text-decoration: none; color: inherit; display: block;
}
.stat:hover { border-color: var(--green); }
.stat .n { font-size: 24px; font-weight: 700; color: var(--green-dark); line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ---------- Filters ---------- */
.filters {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 16px;
}
.filters .field { min-width: 150px; flex: 1 1 150px; }

/* ---------- Detail panels ---------- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.panel h3 {
    margin: 0; padding: 13px 18px; font-size: 14px; color: var(--green-dark);
    border-bottom: 1px solid var(--line); background: #f9fafb;
    border-radius: var(--radius) var(--radius) 0 0;
}
.panel-body { padding: 16px 18px; }
dl.kv { margin: 0; display: grid; grid-template-columns: 190px 1fr; gap: 8px 14px; font-size: 14px; }
@media (max-width: 640px) { dl.kv { grid-template-columns: 1fr; gap: 2px 0; } dl.kv dd { margin-bottom: 10px; } }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; }

.rule-box { padding: 14px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.rule-box.auto   { background: #ecfdf5; border: 1px solid #a7f3d0; }
.rule-box.manual { background: var(--amber-soft); border: 1px solid #fde68a; }
.rule-box strong { display: block; margin-bottom: 4px; }

.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span {
    padding: 6px 11px; border: 1px solid var(--line); border-radius: 6px;
    background: #fff; text-decoration: none; color: var(--ink); font-size: 13px;
}
.pagination .current { background: var(--green); color: #fff; border-color: var(--green); }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; margin: 0; color: var(--green-dark); }
.page-head .spacer { margin-left: auto; }

.back-link { display: inline-block; margin-bottom: 12px; font-size: 13px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--green-dark); }

code.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: #f3f4f6; padding: 1px 5px; border-radius: 4px; word-break: break-all; }
