/* ============================================================
   ADMIN PANEL STYLESHEET
   ============================================================ */
:root {
    --ap-primary: #1e5aa8;
    --ap-dark: #16213f;
    --ap-accent: #f5a623;
    --ap-danger: #e74c3c;
    --ap-success: #27ae60;
    --ap-bg: #f1f4fa;
    --ap-text: #4b5568;
    --ap-heading: #232b3d;
    --ap-border: #e6ebf4;
    --ap-shadow: 0 4px 20px rgba(30, 60, 120, .08);
    --ap-radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Poppins', sans-serif; background: var(--ap-bg); color: var(--ap-text); font-size: .92rem; }
a { text-decoration: none; color: var(--ap-primary); }
ul { list-style: none; }
h1,h2,h3,h4 { color: var(--ap-heading); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #16213f 0%, #1e5aa8 60%, #2f7bd4 100%); padding: 20px; position: relative; overflow: hidden; }
.login-wrap::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.1) 1.5px, transparent 1.5px); background-size: 30px 30px; }
.login-card { background: #fff; border-radius: 22px; padding: 40px; width: min(420px, 100%); box-shadow: 0 30px 80px rgba(10,25,55,.5); position: relative; animation: popIn .5s ease; }
@keyframes popIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo { width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, #1e5aa8, #2f7bd4); display: grid; place-items: center; color: #fff; font-size: 1.8rem; margin: 0 auto 16px; box-shadow: 0 10px 24px rgba(30,90,168,.35); }
.login-card h1 { text-align: center; font-size: 1.3rem; margin-bottom: 4px; }
.login-card .login-sub { text-align: center; color: var(--ap-text); font-size: .86rem; margin-bottom: 26px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: .84rem; margin-bottom: 6px; color: var(--ap-heading); }
.form-control { width: 100%; padding: 12px 14px; border: 1.5px solid var(--ap-border); border-radius: 10px; font-family: inherit; font-size: .95rem; transition: .2s; }
.form-control:focus { outline: 0; border-color: var(--ap-primary); box-shadow: 0 0 0 3px rgba(30,90,168,.12); }
.btn-ap {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, #1e5aa8, #2f7bd4); color: #fff; border: 0;
    padding: 12px 22px; border-radius: 10px; font-family: inherit; font-weight: 600;
    font-size: .92rem; cursor: pointer; transition: .25s; width: 100%;
}
.btn-ap:hover { opacity: .92; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30,90,168,.3); }
.btn-ap.btn-danger { background: linear-gradient(135deg, #e74c3c, #f07a6a); }
.btn-ap.btn-success { background: linear-gradient(135deg, #27ae60, #5fc47f); }
.btn-ap.btn-accent { background: linear-gradient(135deg, #f5a623, #f7c04a); color: #5a3d00; }
.btn-ap.btn-sm { width: auto; padding: 8px 14px; font-size: .82rem; }
.btn-ap.btn-outline { background: #fff; color: var(--ap-primary); box-shadow: inset 0 0 0 2px var(--ap-border); }
.btn-ap.btn-outline:hover { box-shadow: inset 0 0 0 2px var(--ap-primary); }
.btn-ap.btn-ghost { background: #eef2f9; color: var(--ap-text); }
.btn-ap.btn-ghost:hover { background: #e2e9f5; }
.link-btn { background: none; border: 0; color: var(--ap-primary); cursor: pointer; font-family: inherit; font-size: .84rem; font-weight: 600; }
.link-btn.danger { color: var(--ap-danger); }
.link-btn.ghost { color: var(--ap-text); }

/* ---------- Layout ---------- */
.ap-flex { display: flex; min-height: 100vh; }
.ap-sidebar {
    width: 250px; background: var(--ap-dark); color: #aeb9d4; flex-shrink: 0;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    transition: transform .3s;
}
.ap-sidebar .ap-brand { display: flex; align-items: center; gap: 10px; padding: 20px; color: #fff; font-weight: 700; }
.ap-brand-icon { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #f5a623, #f7c04a); display: grid; place-items: center; color: #5a3d00; font-size: 1.2rem; overflow: hidden; }
.ap-brand-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.ap-brand span { font-size: .95rem; }
.ap-nav { flex: 1; padding: 10px; }
.ap-nav .nav-head { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: #5f6f96; padding: 14px 12px 6px; }
.ap-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #aeb9d4; font-size: .88rem; margin-bottom: 2px; transition: .2s; }
.ap-nav a i { width: 20px; text-align: center; font-size: .95rem; }
.ap-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.ap-nav a.active { background: linear-gradient(135deg, #1e5aa8, #2f7bd4); color: #fff; }
.ap-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-topbar {
    background: #fff; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 2px 12px rgba(20,50,100,.06); position: sticky; top: 0; z-index: 100;
}
.ap-topbar h2 { font-size: 1.1rem; }
.ap-user { display: flex; align-items: center; gap: 14px; }
.ap-user-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #1e5aa8, #2f7bd4); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .95rem; }
.ap-content { padding: 24px; flex: 1; }
.ap-burger { display: none; background: none; border: 1px solid var(--ap-border); border-radius: 10px; width: 42px; height: 42px; cursor: pointer; color: var(--ap-heading); font-size: 1.1rem; }

@media (max-width: 900px) {
    .ap-burger { display: block; }
    .ap-sidebar { position: fixed; left: 0; top: 0; z-index: 500; transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0,0,0,.2); }
    .ap-sidebar.open { transform: translateX(0); }
    .ap-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(10,20,40,.5); z-index: 490; }
    .ap-main { width: 100%; }
}
@media (min-width: 901px) { .ap-sidebar-overlay { display: none !important; } }

/* ---------- Dashboard cards ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.dash-card { background: #fff; border-radius: var(--ap-radius); padding: 22px; box-shadow: var(--ap-shadow); display: flex; align-items: center; gap: 16px; transition: transform .25s; border-bottom: 3px solid transparent; }
.dash-card:hover { transform: translateY(-4px); }
.dash-card.dc-blue { border-bottom-color: #1e5aa8; } .dc-blue .dc-icon { background: rgba(30,90,168,.12); color: #1e5aa8; }
.dash-card.dc-gold { border-bottom-color: #f5a623; } .dc-gold .dc-icon { background: rgba(245,166,35,.14); color: #d98d0b; }
.dash-card.dc-green { border-bottom-color: #27ae60; } .dc-green .dc-icon { background: rgba(39,174,96,.12); color: #27ae60; }
.dash-card.dc-red { border-bottom-color: #e74c3c; } .dc-red .dc-icon { background: rgba(231,76,60,.12); color: #e74c3c; }
.dash-card.dc-purple { border-bottom-color: #8e44ad; } .dc-purple .dc-icon { background: rgba(142,68,173,.12); color: #8e44ad; }
.dash-card.dc-pink { border-bottom-color: #e74c8c; } .dc-pink .dc-icon { background: rgba(231,76,140,.12); color: #e74c8c; }
.dc-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.dc-info strong { font-size: 1.5rem; color: var(--ap-heading); display: block; }
.dc-info span { font-size: .8rem; color: var(--ap-text); }
.dc-info small { font-size: .7rem; color: var(--ap-text); opacity: .8; }

/* ---------- Tables & cards ---------- */
.ap-card { background: #fff; border-radius: var(--ap-radius); box-shadow: var(--ap-shadow); margin-bottom: 22px; overflow: hidden; }
.ap-card-head { padding: 18px 22px; border-bottom: 1px solid var(--ap-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ap-card-head h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.ap-card-body { padding: 22px; }
.table-wrap { overflow-x: auto; }
table.ap-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.ap-table th { text-align: left; padding: 13px 18px; background: #f7f9fd; color: var(--ap-heading); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--ap-border); white-space: nowrap; }
.ap-table td { padding: 13px 18px; border-bottom: 1px solid #f0f3fa; vertical-align: middle; }
.ap-table tr:hover td { background: #fbfcff; }
.ap-table .thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 8px; display: block; background: #eef2f9; }
.ap-table .thumb-empty { display: flex; align-items: center; justify-content: center; color: #9fb3d4; font-size: 1.1rem; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.row-actions .btn-ap { width: auto; padding: 6px 10px; font-size: .76rem; }
.student-thumb { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; }

/* ---------- Status badges ---------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: 30px; font-size: .74rem; font-weight: 600; }
.badge-success { background: #e8f7ee; color: #17723f; }
.badge-danger { background: #fdebec; color: #a0262a; }
.badge-warn { background: #fdf3e3; color: #9c6a12; }
.badge-info { background: #e8f0fd; color: #1d55a0; }
.badge-blue { background: #e8f0fd; color: #1d55a0; }
.badge-accent { background: #fdf3e3; color: #9c6a12; }

/* School calendar */
.cal-badge { display: inline-block; padding: 2px 10px; border-radius: 30px; font-size: .72rem; font-weight: 600; }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cat-chip { border: 1px solid var(--cc, #ccc); color: var(--cc, #333); padding: 6px 12px; border-radius: 30px; font-size: .76rem; font-weight: 600; cursor: pointer; transition: .15s; }
.cat-chip:hover { filter: brightness(.92); }

/* ---------- Form helpers ---------- */
.ap-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
@media (max-width: 720px) { .ap-form-grid { grid-template-columns: 1fr; } }
.ap-form-grid .full { grid-column: 1 / -1; }
.lof-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 22px; }
.lof-grid .ap-card { margin-bottom: 0; }
@media (max-width: 900px) { .lof-grid { grid-template-columns: 1fr; } }
.form-label { display: block; font-weight: 600; font-size: .84rem; margin-bottom: 6px; color: var(--ap-heading); }
.form-label .req { color: var(--ap-danger); }
textarea.form-control { min-height: 130px; resize: vertical; }
.form-hint { font-size: .78rem; color: #8b93a7; margin-top: 4px; }
.form-row-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.checkbox-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--ap-heading); font-size: .88rem; }
.checkbox-switch input { width: 18px; height: 18px; accent-color: var(--ap-primary); }

/* preview thumb */
.preview-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--ap-border); }

/* sort order hint */
.drag-note { font-size: .8rem; color: #8b93a7; }

/* file dropzone */
.file-drop { border: 2px dashed #c6d4ec; border-radius: 12px; padding: 26px; text-align: center; color: var(--ap-text); cursor: pointer; transition: .2s; background: #f9fbff; }
.file-drop:hover, .file-drop.hover { border-color: var(--ap-primary); background: #f0f5ff; }
.file-drop i { font-size: 1.8rem; color: var(--ap-primary); margin-bottom: 8px; }
.file-drop input[type="file"] { display: none; }

/* ---------- Pagination ---------- */
.ap-pagination { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 16px 22px; font-size: .84rem; }
.ap-pagination a, .ap-pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: #f2f5fb; color: var(--ap-text); font-weight: 600; }
.ap-pagination a:hover { background: var(--ap-primary); color: #fff; }
.ap-pagination .current { background: linear-gradient(135deg, #1e5aa8, #2f7bd4); color: #fff; }

/* ---------- Filters ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input { padding: 9px 12px; border: 1.5px solid var(--ap-border); border-radius: 9px; font-family: inherit; font-size: .86rem; }

/* ---------- Alerts ---------- */
.ap-alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 18px; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.ap-alert.success { background: #e8f7ee; color: #17723f; border: 1px solid #b9e8cd; }
.ap-alert.error { background: #fdebec; color: #a0262a; border: 1px solid #f5c4c6; }
.ap-alert.info { background: #e8f0fd; color: #1d55a0; border: 1px solid #c2d6f5; }

/* modal.confirm as inline form row */
.inline-form { display: inline; }

/* reply textarea for anthem */
.monospace { font-family: 'Consolas', monospace; }