/* =============================================
   Income & Expense Management System
   Main Stylesheet
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  /* Admin Theme - Deep Navy */
  --admin-primary: #1a2744;
  --admin-accent: #f0a500;
  --admin-light: #e8f0fe;

  /* SubAdmin Theme - Teal */
  --subadmin-primary: #0d6e6e;
  --subadmin-accent: #00d4aa;
  --subadmin-light: #e0f7f5;

  /* Mentor Theme - Purple */
  --mentor-primary: #4a1d96;
  --mentor-accent: #a78bfa;
  --mentor-light: #ede9fe;

  --income-color: #10b981;
  --expense-color: #ef4444;
  --pending-color: #f59e0b;

  --bg: #f0f2f7;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Hind Siliguri', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s;
}

.sidebar-admin    { background: var(--admin-primary); }
.sidebar-subadmin { background: var(--subadmin-primary); }
.sidebar-mentor   { background: var(--mentor-primary); }

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo .logo-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  background: rgba(255,255,255,0.15);
  color: white;
}
.sidebar-logo .logo-text { color: white; }
.sidebar-logo .logo-text h3 { font-size: 15px; font-weight: 600; line-height: 1.2; }
.sidebar-logo .logo-text span { font-size: 11px; opacity: 0.6; }

.sidebar-nav { padding: 16px 0; flex: 1; overflow-y: auto; }

.nav-section { padding: 8px 20px 4px; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,0.4); font-weight: 600; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  margin: 2px 0;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; border-left-color: rgba(255,255,255,0.3); }
.nav-item.active { background: rgba(255,255,255,0.12); color: white; border-left-color: white; }
.nav-item.active-admin    { border-left-color: var(--admin-accent); }
.nav-item.active-subadmin { border-left-color: var(--subadmin-accent); }
.nav-item.active-mentor   { border-left-color: var(--mentor-accent); }
.nav-item .icon { width: 20px; text-align: center; font-size: 16px; }

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.user-info .user-name { color: white; font-size: 13px; font-weight: 600; }
.user-info .user-role { color: rgba(255,255,255,0.5); font-size: 11px; }
.user-info a { color: rgba(255,255,255,0.5); font-size: 11px; text-decoration: none; }
.user-info a:hover { color: #ff6b6b; }

/* ---- Main Content ---- */
.main-content { margin-left: 260px; flex: 1; display: flex; flex-direction: column; }

.topbar {
  background: white;
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.topbar h1 { font-size: 18px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.notif-btn {
  position: relative;
  background: var(--bg);
  border: none; cursor: pointer;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--text-muted);
  transition: background 0.2s;
}
.notif-btn:hover { background: var(--border); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--expense-color); color: white;
  font-size: 9px; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.page-body { padding: 28px; flex: 1; }

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 22px; }

/* ---- Stats Cards ---- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.1); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.income  { background: #d1fae5; color: var(--income-color); }
.stat-icon.expense { background: #fee2e2; color: var(--expense-color); }
.stat-icon.balance { background: #dbeafe; color: #3b82f6; }
.stat-icon.pending { background: #fef3c7; color: var(--pending-color); }

.stat-info .label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-info .value { font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.stat-info .value.income  { color: var(--income-color); }
.stat-info .value.expense { color: var(--expense-color); }
.stat-info .value.balance { color: #3b82f6; }
.stat-info .change { font-size: 11px; margin-top: 2px; color: var(--text-muted); }

/* ---- Grid ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  background: #f8fafc; padding: 12px 14px;
  text-align: left; font-size: 12px;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.table-empty { text-align: center; padding: 40px !important; color: var(--text-muted); font-size: 14px; }

/* ---- Badges ---- */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-income   { background: #d1fae5; color: #065f46; }
.badge-expense  { background: #fee2e2; color: #991b1b; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-admin    { background: #dbeafe; color: #1e40af; }
.badge-subadmin { background: #d1fae5; color: #065f46; }
.badge-mentor   { background: #ede9fe; color: #5b21b6; }
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f1f5f9; color: #64748b; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; text-decoration: none;
  transition: all 0.2s; font-family: inherit;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-primary { background: var(--admin-primary); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-success { background: var(--income-color); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-danger  { background: var(--expense-color); color: white; }
.btn-danger:hover  { opacity: 0.9; }
.btn-warning { background: var(--pending-color); color: white; }
.btn-outline { background: white; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: #94a3b8; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px;
  color: var(--text); background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus { outline: none; border-color: #94a3b8; box-shadow: 0 0 0 3px rgba(148,163,184,0.15); }
select.form-control { cursor: pointer; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border-left: 4px solid; }
.alert-success { background: #d1fae5; color: #065f46; border-color: var(--income-color); }
.alert-error   { background: #fee2e2; color: #991b1b; border-color: var(--expense-color); }
.alert-warning { background: #fef3c7; color: #92400e; border-color: var(--pending-color); }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #3b82f6; }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a2744 0%, #0d6e6e 50%, #4a1d96 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 30px;
}
.login-logo .logo-circle {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #1a2744, #4a1d96);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; color: white;
  margin-bottom: 12px;
}
.login-logo h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 13px; color: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 992px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-260px); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 16px; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ---- Misc ---- */
.text-income  { color: var(--income-color); }
.text-expense { color: var(--expense-color); }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

.amount-font { font-family: 'JetBrains Mono', monospace; font-weight: 600; }

/* Progress Bar */
.progress { background: var(--border); border-radius: 10px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 10px; transition: width 0.5s ease; }
.progress-bar.income  { background: var(--income-color); }
.progress-bar.expense { background: var(--expense-color); }

/* Month filter */
.filter-bar {
  display: flex; gap: 12px; align-items: center;
  background: white; padding: 14px 20px;
  border-radius: var(--radius); border: 1px solid var(--border);
  margin-bottom: 24px; flex-wrap: wrap;
}
.filter-bar label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
