/* ═══════════════════════════════════════════════
   MIS Records Manager — Global Styles
   ═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
    --primary:    #2563eb;
    --primary-dk: #1d4ed8;
    --success:    #16a34a;
    --danger:     #dc2626;
    --warning:    #d97706;
    --bg:         #f0f4f8;
    --surface:    #ffffff;
    --border:     #d1d5db;
    --text:       #1e293b;
    --muted:      #64748b;
    --radius:     8px;
    --shadow:     0 2px 8px rgba(0,0,0,.10);
    --shadow-lg:  0 4px 20px rgba(0,0,0,.13);
}

body {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────── */
.site-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    padding: 0 2rem;
    box-shadow: var(--shadow-lg);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
}
.brand { font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.brand-icon { font-size: 1.4rem; }
.brand strong { font-weight: 700; }
.program-badge {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    padding: .25rem .85rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
}

/* ── Container ────────────────────────────────── */
.container {
    width: 100%;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 0 2rem;
    flex: 1;
}

/* ── Navigation ───────────────────────────────── */
.nav {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    background: var(--surface);
    padding: .6rem .8rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: .75rem;
}
.nav a {
    text-decoration: none;
    padding: .4rem .9rem;
    border-radius: 6px;
    font-weight: 500;
    color: var(--muted);
    transition: background .15s, color .15s;
}
.nav a:hover { background: #eff6ff; color: var(--primary); }
.nav a.active { background: var(--primary); color: #fff; }

.sub-nav a { font-size: .85rem; }

/* ── Search Bar ───────────────────────────────── */
.search-bar {
    background: var(--surface);
    padding: .75rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: .75rem;
}
.search-bar form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.search-bar input[type="text"] {
    flex: 1; min-width: 220px;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .9rem;
    outline: none;
    transition: border .15s;
}
.search-bar input[type="text"]:focus { border-color: var(--primary); }
.search-bar button {
    padding: .5rem 1.1rem;
    background: var(--primary);
    color: #fff; border: none;
    border-radius: 6px; cursor: pointer;
    font-weight: 600; font-size: .9rem;
    transition: background .15s;
}
.search-bar button:hover { background: var(--primary-dk); }
.btn-reset {
    padding: .5rem 1rem;
    background: #e2e8f0;
    color: var(--muted);
    border-radius: 6px;
    text-decoration: none;
    font-size: .9rem;
    transition: background .15s;
}
.btn-reset:hover { background: #cbd5e1; }

/* ── Stats Bar ────────────────────────────────── */
.stats-bar {
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: .75rem;
    padding: 0 .25rem;
}

/* ── Table ────────────────────────────────────── */
.table-wrap {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: #1e3a8a; color: #fff; }
th { padding: .65rem .85rem; text-align: left; white-space: nowrap; font-weight: 600; font-size: .78rem; letter-spacing: .04em; }
td { padding: .6rem .85rem; border-bottom: 1px solid #f0f4f8; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #eff6ff; }
.no-records { text-align: center; color: var(--muted); padding: 2rem !important; }
.action-cell { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Buttons ──────────────────────────────────── */
.btn-edit, .btn-courses, .btn-delete, .btn-back, .btn-save, .btn-cancel {
    display: inline-block; text-decoration: none;
    padding: .3rem .75rem; border-radius: 5px;
    font-size: .8rem; font-weight: 600; cursor: pointer; border: none;
    transition: opacity .15s, background .15s;
}
.btn-edit    { background: #dbeafe; color: #1d4ed8; }
.btn-edit:hover { background: #bfdbfe; }
.btn-courses { background: #d1fae5; color: #065f46; }
.btn-courses:hover { background: #a7f3d0; }
.btn-delete  { background: #fee2e2; color: #b91c1c; }
.btn-delete:hover { background: #fecaca; }
.btn-back    { background: #f1f5f9; color: var(--muted); font-size: .85rem; }
.btn-back:hover { background: #e2e8f0; }
.btn-save    { background: var(--success); color: #fff; padding: .5rem 1.4rem; font-size: .9rem; }
.btn-save:hover { opacity: .88; }
.btn-cancel  { background: #f1f5f9; color: var(--muted); padding: .5rem 1rem; font-size: .9rem; }
.btn-cancel:hover { background: #e2e8f0; }

/* ── Page Top ─────────────────────────────────── */
.page-top {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1rem;
}
.page-title { font-size: 1.2rem; font-weight: 700; }

/* ── Card ─────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    background: #1e3a8a;
    color: #fff;
    padding: .75rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
}
.card-body { padding: 1.25rem; }
.record-id { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }

/* ── Edit Form ────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.form-group input, .form-group select {
    padding: .48rem .7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .9rem;
    background: #f8fafc;
    transition: border .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px #bfdbfe55;
    background: #fff;
}
.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Inline Form (courses add) ────────────────── */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.form-group-btn { justify-content: flex-end; }
.form-note { margin-top: .75rem; font-size: .8rem; color: var(--muted); }

/* ── Student info bar ─────────────────────────── */
.student-info-bar {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: .65rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: .88rem;
    margin-bottom: 1rem;
    color: #1e3a8a;
}

/* ── Alerts ───────────────────────────────────── */
.alert {
    padding: .7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Footer ───────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 1rem;
    font-size: .8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ── Payments & Status Badges ─────────────────── */
.btn-payments { background: #fef3c7; color: #d97706; }
.btn-payments:hover { background: #fde68a; }
.btn-approve  { background: #dcfce7; color: #15803d; }
.btn-approve:hover { background: #bbf7d0; }

.status-badge {
    display: inline-block;
    padding: .25rem .65rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    border: 1px solid transparent;
}
.status-paid    { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.status-pending { background: #fef3c7; color: #d97706; border-color: #fde68a; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 640px) {
    .container { padding: 0 .75rem; }
    .header-inner { padding: 0; }
    .form-grid { grid-template-columns: 1fr; }
}