/* =============================================
   EduPortal - Universal Stylesheet
   ============================================= */

:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --primary-dark: #0d1660;
  --secondary: #ff6f00;
  --secondary-light: #ffa040;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #f57f17;
  --info: #01579b;
  --white: #ffffff;
  --bg: #f0f2f8;
  --text: #1a1a2e;
  --text-muted: #666;
  --border: #e0e4f0;
  --shadow: 0 2px 16px rgba(26,35,126,0.10);
  --shadow-lg: 0 8px 32px rgba(26,35,126,0.15);
  --radius: 10px;
  --radius-lg: 16px;
  --sidebar-w: 260px;
  --header-h: 64px;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--secondary); }
img { max-width: 100%; }
ul { list-style: none; }

/* ── Layout ── */
.portal-wrapper { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%); position: fixed; top: 0; left: 0; height: 100vh; z-index: 1000; display: flex; flex-direction: column; transition: transform 0.3s; overflow-y: auto; }
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; width: calc(100% - var(--sidebar-w)); transition: margin 0.3s; }
.topbar { background: var(--white); height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 900; }
.page-body { padding: 24px; flex: 1; }

/* ── Sidebar ── */
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.sidebar-logo .logo-text h2 { color: #fff; font-size: 16px; font-weight: 700; line-height: 1.3; }
.sidebar-logo .logo-text p { color: rgba(255,255,255,0.55); font-size: 11px; }
.sidebar-logo .logo-icon { width: 44px; height: 44px; background: var(--secondary); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 10px; }
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section-title { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.35); letter-spacing: 1.5px; text-transform: uppercase; padding: 12px 20px 4px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: rgba(255,255,255,0.75); font-size: 13.5px; font-weight: 500; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.1); color: #fff; border-left-color: var(--secondary); }
.sidebar-nav a .nav-icon { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.sidebar-nav a:hover .nav-icon, .sidebar-nav a.active .nav-icon { background: rgba(255,111,0,0.25); color: var(--secondary); }
.sidebar-nav a .badge { margin-left: auto; background: var(--secondary); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 20px; font-weight: 700; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer .user-info { display: flex; align-items: center; gap: 10px; }
.sidebar-footer .user-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--secondary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.sidebar-footer .user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-footer .user-role { color: rgba(255,255,255,0.5); font-size: 11px; }
.sidebar-footer .logout-btn { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: rgba(255,255,255,0.6); font-size: 12px; padding: 6px 0; }
.sidebar-footer .logout-btn:hover { color: #ff6b6b; }

/* ── Topbar ── */
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 8px; color: var(--text-muted); font-size: 18px; transition: background 0.2s; }
.sidebar-toggle:hover { background: var(--bg); }
.page-title { font-size: 17px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge { background: var(--bg); border-radius: 8px; padding: 6px 14px; font-size: 12px; font-weight: 600; color: var(--primary); }

/* ── Cards ── */
.card { background: var(--white); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 2px solid var(--bg); }
.card-title { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary); }

/* ── Stat Cards ── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.blue { background: #e8eaf6; color: var(--primary); }
.stat-icon.orange { background: #fff3e0; color: var(--secondary); }
.stat-icon.green { background: #e8f5e9; color: var(--success); }
.stat-icon.red { background: #ffebee; color: var(--danger); }
.stat-icon.purple { background: #f3e5f5; color: #7b1fa2; }
.stat-icon.teal { background: #e0f2f1; color: #00695c; }
.stat-val { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
table th { background: var(--primary); color: #fff; padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; white-space: nowrap; }
table th:first-child { border-radius: 8px 0 0 0; }
table th:last-child { border-radius: 0 8px 0 0; }
table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
table tr:hover td { background: #f8f9ff; }
table tr:last-child td { border-bottom: none; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; white-space: nowrap; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-light); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #388e3c; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e53935; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline-danger { background: transparent; border: 2px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-white { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn-icon { padding: 6px 10px; }

/* ── Forms ── */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-group label .req { color: var(--danger); }
.form-control { width: 100%; padding: 9px 13px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13.5px; color: var(--text); font-family: inherit; background: #fff; transition: border 0.2s, box-shadow 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(57,73,171,0.12); }
.form-control:read-only { background: #f5f5f5; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 11px; color: var(--text-muted); }
.form-section { background: var(--bg); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }
.form-section-title { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; border-bottom: 2px solid var(--border); padding-bottom: 8px; }

/* ── Upload area ── */
.upload-box { border: 2px dashed var(--border); border-radius: 8px; padding: 16px; text-align: center; cursor: pointer; transition: border 0.2s; background: #fafbff; }
.upload-box:hover { border-color: var(--primary-light); }
.upload-box input[type=file] { display: none; }
.upload-box label { cursor: pointer; display: block; }
.upload-box .up-icon { font-size: 28px; color: var(--primary); opacity: 0.5; }
.upload-box .up-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.upload-preview { margin-top: 8px; }
.upload-preview img { max-height: 80px; border-radius: 6px; border: 2px solid var(--border); }
.upload-preview a { font-size: 12px; color: var(--primary); }

/* ── Alerts ── */
.alert { padding: 12px 18px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #2e7d32; }
.alert-danger { background: #ffebee; color: #c62828; border-left: 4px solid #c62828; }
.alert-warning { background: #fff8e1; color: #f57f17; border-left: 4px solid #f57f17; }
.alert-info { background: #e3f2fd; color: #01579b; border-left: 4px solid #01579b; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-warning { background: #fff8e1; color: #e65100; }
.badge-info { background: #e3f2fd; color: #01579b; }
.badge-primary { background: #e8eaf6; color: var(--primary); }
.badge-secondary { background: #fff3e0; color: var(--secondary); }

/* ── Modal ── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9000; align-items: center; justify-content: center; }
.modal-backdrop.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg); width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn 0.25s ease; }
.modal-lg { max-width: 840px; }
.modal-xl { max-width: 1100px; }
@keyframes modalIn { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Tabs ── */
.tab-nav { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab-btn { padding: 10px 20px; font-size: 13px; font-weight: 600; color: var(--text-muted); background: none; border: none; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; white-space: nowrap; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Breadcrumb ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary); }
.breadcrumb span { color: var(--text-muted); }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.page-btn { padding: 7px 13px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--primary); background: var(--white); border: 1.5px solid var(--border); transition: all 0.2s; }
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Login Page ── */
.login-page { min-height: 100vh; background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-circle { width: 72px; height: 72px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 0 auto 12px; }
.login-logo h2 { font-size: 22px; font-weight: 800; color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 13px; }
.login-type { display: inline-block; background: var(--secondary); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 20px; letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; }

/* ── Confirm dialog ── */
.confirm-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999; align-items: center; justify-content: center; }
.confirm-overlay.show { display: flex; }
.confirm-box { background: #fff; border-radius: 16px; padding: 32px; width: 90%; max-width: 400px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.confirm-icon { font-size: 48px; margin-bottom: 16px; }
.confirm-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.confirm-msg { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.confirm-btns { display: flex; gap: 12px; justify-content: center; }

/* ── Search bar ── */
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-bar .form-control { min-width: 200px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; opacity: 0.25; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── ID Card ── */
.id-card { width: 340px; min-height: 200px; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; border-radius: 16px; padding: 20px; position: relative; overflow: hidden; }
.id-card::before { content:''; position:absolute; top:-40px; right:-40px; width:150px; height:150px; background:rgba(255,255,255,0.05); border-radius:50%; }

/* ── Fee slip ── */
.fee-slip { border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fee-slip-header { background: var(--primary); color: #fff; padding: 16px 20px; }
.fee-slip-body { padding: 20px; }
.fee-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.fee-row:last-child { border-bottom: none; }
.fee-total { background: var(--bg); border-radius: 8px; padding: 12px 16px; margin-top: 12px; display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; color: var(--primary); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .page-body { padding: 16px; }
  .card { padding: 16px; }
}
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
