/* ═══════════════════════════════════════════════════════════
   Sacred Heart College ERP — Stylesheet
   ═══════════════════════════════════════════════════════════ */
:root {
    --primary: #8B0000;
    --primary-dark: #6B0000;
    --primary-light: #fef2f2;
    --accent: #b91c1c;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #2563eb;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #1e1b2e;
    --sidebar-hover: #2d2a3e;
    --sidebar-active: #3d3a50;
    --sidebar-text: #c4c0d4;
    --sidebar-text-active: #ffffff;
    --text: #1e293b;
    --text-soft: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
    --sidebar-w: 250px;
    --topbar-h: 56px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Login page ──────────────────────────────────────────── */
.erp-login-page {
    min-height: 100vh; display: grid; place-items: center;
    background: linear-gradient(135deg, #1e1b2e 0%, #3d1a1a 50%, #1e1b2e 100%);
    padding: 20px;
}
.erp-login-box {
    background: #fff; border-radius: var(--radius); padding: 36px 32px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.erp-login-box h1 { font-size: 20px; color: var(--primary); margin-bottom: 4px; text-align: center; }
.erp-login-sub { text-align: center; color: var(--text-soft); font-size: 13px; margin-bottom: 20px; }

/* ── App layout ──────────────────────────────────────────── */
.erp-app { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.erp-sidebar {
    width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transition: transform .25s ease;
    overflow-y: auto;
}
.erp-sidebar-header {
    padding: 18px 16px; display: flex; gap: 10px; align-items: center;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.erp-logo { font-size: 28px; }
.erp-brand strong { font-size: 14px; color: #fff; display: block; line-height: 1.2; }
.erp-brand small { font-size: 9px; color: var(--sidebar-text); opacity: .7; display: block; margin-top: 2px; line-height: 1.3; }

.erp-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.erp-nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 18px;
    color: var(--sidebar-text); font-size: 13px; font-weight: 600; transition: all .15s; cursor: pointer;
    text-decoration: none; border-left: 3px solid transparent;
}
.erp-nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.erp-nav-item.active {
    background: var(--sidebar-active); color: var(--sidebar-text-active);
    border-left-color: var(--primary);
}
.erp-nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.erp-nav-badge {
    margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
    padding: 1px 7px; border-radius: 10px;
}
.erp-sidebar-footer { padding: 8px 0; border-top: 1px solid rgba(255,255,255,.06); }

/* ── Main area ───────────────────────────────────────────── */
.erp-main {
    flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh;
}
.erp-topbar {
    height: var(--topbar-h); background: var(--bg-card); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px; padding: 0 20px;
    position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow);
}
.erp-menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px; }
.erp-topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.erp-topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.erp-topbar-notif {
    background: var(--primary-light); color: var(--primary); padding: 4px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600; text-decoration: none;
}
.erp-topbar-name { color: var(--text); font-weight: 500; }
.erp-topbar-name:hover { color: var(--primary); text-decoration: none; }

.erp-content { flex: 1; padding: 20px; }
.erp-footer {
    padding: 14px 20px; text-align: center; font-size: 11px; color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ── Cards ────────────────────────────────────────────────── */
.erp-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.erp-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; flex-wrap: wrap; gap: 8px;
}
.erp-card-header h2, .erp-card-header h3 { margin: 0; font-size: 16px; }

/* ── Stats ────────────────────────────────────────────────── */
.erp-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.erp-stat {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.erp-stat--success { border-left-color: var(--success); }
.erp-stat--danger  { border-left-color: var(--danger); }
.erp-stat--warn    { border-left-color: var(--warning); }
.erp-stat--info    { border-left-color: var(--info); }
.erp-stat-icon { font-size: 28px; }
.erp-stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.erp-stat-label { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

/* ── Grid helpers ─────────────────────────────────────────── */
.erp-grid { display: grid; gap: 16px; }
.erp-grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.erp-grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ── Tables ───────────────────────────────────────────────── */
.erp-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.erp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.erp-table th {
    background: var(--bg); font-weight: 600; text-align: left; padding: 10px 12px;
    border-bottom: 2px solid var(--border); white-space: nowrap; font-size: 11px;
    text-transform: uppercase; letter-spacing: .03em; color: var(--text-soft);
}
.erp-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.erp-table tr:last-child td { border-bottom: 0; }
.erp-table tr:hover td { background: var(--primary-light); }
.erp-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.erp-table .actions { white-space: nowrap; text-align: right; }

/* ── Forms ────────────────────────────────────────────────── */
.erp-form-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px;
}
.erp-form-row { margin-bottom: 14px; }
.erp-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.erp-input, .erp-select, .erp-textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; font-size: 13px; background: #fff; transition: border-color .15s;
}
.erp-input:focus, .erp-select:focus, .erp-textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139,0,0,.08);
}
.erp-textarea { resize: vertical; min-height: 60px; }
.erp-help { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Buttons ──────────────────────────────────────────────── */
.erp-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
    background: #fff; color: var(--text); transition: all .15s; text-decoration: none;
    white-space: nowrap;
}
.erp-btn:hover { background: var(--bg); border-color: #cbd5e1; text-decoration: none; }
.erp-btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.erp-btn-primary:hover { background: var(--primary-dark); }
.erp-btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.erp-btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.erp-btn-danger:hover { background: var(--danger); color: #fff; }
.erp-btn-sm { padding: 4px 10px; font-size: 12px; }
.erp-btn-block { width: 100%; justify-content: center; }

/* ── Badges ───────────────────────────────────────────────── */
.erp-badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.erp-badge--ok      { background: #dcfce7; color: #166534; }
.erp-badge--err     { background: #fee2e2; color: #991b1b; }
.erp-badge--warn    { background: #fef3c7; color: #92400e; }
.erp-badge--info    { background: #dbeafe; color: #1e40af; }
.erp-badge--neutral { background: #f1f5f9; color: #475569; }

/* ── Flash messages ───────────────────────────────────────── */
.flash {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px;
    font-size: 13px; border-left: 4px solid;
}
.flash-ok   { background: #dcfce7; border-color: var(--success); color: #166534; }
.flash-err  { background: #fee2e2; border-color: var(--danger);  color: #991b1b; }
.flash-warn { background: #fef3c7; border-color: var(--warning); color: #92400e; }
.flash-info { background: #dbeafe; border-color: var(--info);    color: #1e40af; }
.flash code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 3px; font-size: 12px; }

/* ── Empty state ──────────────────────────────────────────── */
.erp-empty { text-align: center; padding: 30px 16px; color: var(--text-muted); }
.erp-empty-icon { font-size: 40px; margin-bottom: 8px; }

/* ── Search bar ───────────────────────────────────────────── */
.erp-search-bar {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: end;
}
.erp-search-bar .erp-input, .erp-search-bar .erp-select { flex: 1; min-width: 140px; }
/* Magnifier glyph on text/search inputs inside any search bar */
.erp-search-bar input[type="text"], .erp-search-bar input[type="search"], .erp-search-bar input:not([type]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 10px center; background-size: 15px; padding-left: 32px;
}

/* ── Pager ────────────────────────────────────────────────── */
.erp-pager {
    display: flex; gap: 8px; align-items: center; justify-content: center; padding: 14px 0; font-size: 13px;
}
.erp-pager a { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; }
.erp-pager a:hover { background: var(--bg); }
.erp-pager .current { color: var(--text-soft); }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .erp-sidebar { transform: translateX(-100%); }
    .erp-sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
    .erp-main { margin-left: 0; }
    .erp-menu-toggle { display: block; }
    .erp-topbar-user .erp-badge { display: none; }
    .erp-content { padding: 14px; }
    .erp-form-grid { grid-template-columns: 1fr; }
    .erp-stats { grid-template-columns: 1fr 1fr; }
    .erp-grid-2, .erp-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .erp-stats { grid-template-columns: 1fr; }
    .erp-search-bar { flex-direction: column; }
    .erp-search-bar .erp-input, .erp-search-bar .erp-select { width: 100%; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
    .erp-sidebar, .erp-topbar, .erp-footer, .erp-menu-toggle, .erp-btn { display: none !important; }
    .erp-main { margin-left: 0; }
    .erp-content { padding: 0; }
    .erp-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
