/* ============================
   COLLEGE MANAGEMENT SYSTEM
   Main Stylesheet
   ============================ */

:root {
  --sidebar-bg: #0B1437;
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --accent: #4F46E5;
  --accent-light: #6366F1;
  --accent-hover: #4338CA;
  --coral: #F97316;
  --emerald: #10B981;
  --sky: #0EA5E9;
  --rose: #F43F5E;
  --amber: #F59E0B;
  --bg: #F1F5F9;
  --card-bg: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s ease;
}

[data-theme="dark"] {
  --bg: #0F172A;
  --card-bg: #1E293B;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: #334155;
  --sidebar-bg: #020817;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  transition: var(--transition);
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ LAYOUT ============ */
.app-wrapper { display: flex; height: 100vh; overflow: hidden; }

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: 72px;
}

.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), #7C3AED);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-text { overflow: hidden; white-space: nowrap; }
.brand-text h6 { color: #fff; font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand-text small { color: rgba(255,255,255,.45); font-size: 11px; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section-label {
  color: rgba(255,255,255,.3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 16px 18px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  margin: 1px 8px;
  border-radius: 8px;
}

.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }

.nav-item.active {
  background: linear-gradient(90deg, rgba(79,70,229,.35), rgba(79,70,229,.1));
  color: #fff;
  border-left: 3px solid var(--accent-light);
  padding-left: 15px;
}

.nav-item .nav-icon { font-size: 18px; flex-shrink: 0; width: 22px; text-align: center; }
.nav-item .nav-label { overflow: hidden; transition: opacity 0.2s; }
.sidebar.collapsed .nav-label { opacity: 0; pointer-events: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; margin: 1px 4px; }
.sidebar.collapsed .nav-item.active { border-left: none; border-radius: 8px; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* Tooltip on collapse */
.sidebar.collapsed .nav-item { position: relative; }
.nav-tooltip {
  position: absolute;
  left: calc(100% + 12px);
  background: #1E293B;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 999;
  box-shadow: var(--shadow);
}
.sidebar.collapsed .nav-item:hover .nav-tooltip { opacity: 1; }

/* ============ MAIN CONTENT ============ */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ============ TOP NAV ============ */
.topnav {
  height: 72px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.topnav-toggle {
  width: 38px; height: 38px;
  border: none;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: var(--transition);
  flex-shrink: 0;
}
.topnav-toggle:hover { background: var(--border); color: var(--text-primary); }

.topnav-title { font-weight: 700; font-size: 18px; color: var(--text-primary); flex: 1; }

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 14px;
  gap: 8px;
  width: 260px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
}
.search-box i { color: var(--text-muted); }

.topnav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  border: none;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--border); color: var(--text-primary); }

.badge-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--coral);
  border-radius: 50%;
  border: 2px solid var(--card-bg);
}

.avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7C3AED);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* ============ PAGE CONTENT ============ */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ============ PAGE SECTIONS ============ */
.page-section { display: none; }
.page-section.active { display: block; }

/* ============ CARDS ============ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: var(--transition);
}

.card-hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

/* ============ STAT CARDS ============ */
.stat-card {
  border-radius: var(--radius);
  padding: 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: -30px; right: 20px;
  width: 70px; height: 70px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
}

.stat-icon {
  width: 48px; height: 48px;
  background: rgba(255,255,255,.2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.stat-value { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; opacity: .8; font-weight: 500; }
.stat-change { font-size: 12px; margin-top: 8px; opacity: .9; }
.stat-change i { font-size: 10px; }

.bg-indigo { background: linear-gradient(135deg, #4F46E5, #7C3AED); }
.bg-sky { background: linear-gradient(135deg, #0EA5E9, #0284C7); }
.bg-emerald { background: linear-gradient(135deg, #10B981, #059669); }
.bg-coral { background: linear-gradient(135deg, #F97316, #EA580C); }
.bg-rose { background: linear-gradient(135deg, #F43F5E, #E11D48); }
.bg-amber { background: linear-gradient(135deg, #F59E0B, #D97706); }

/* ============ TABLE ============ */
.table-card { padding: 0; overflow: hidden; }
.table-card .table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.table-card h6 { font-size: 15px; font-weight: 700; color: var(--text-primary); }

.table-responsive { overflow-x: auto; }

table.cms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.cms-table th {
  padding: 11px 16px;
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.cms-table td {
  padding: 13px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cms-table tr:last-child td { border-bottom: none; }
.cms-table tbody tr:hover { background: var(--bg); }

/* ============ BADGES ============ */
.badge {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-block;
}

.badge-success { background: rgba(16,185,129,.12); color: #059669; }
.badge-danger { background: rgba(244,63,94,.12); color: #E11D48; }
.badge-warning { background: rgba(245,158,11,.12); color: #D97706; }
.badge-info { background: rgba(14,165,233,.12); color: #0284C7; }
.badge-secondary { background: rgba(100,116,139,.12); color: #475569; }
.badge-primary { background: rgba(79,70,229,.12); color: #4338CA; }

/* ============ BUTTONS ============ */
.btn-primary-cms {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.btn-primary-cms:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-icon {
  width: 32px; height: 32px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: var(--transition);
}
.btn-icon-view { background: rgba(14,165,233,.12); color: #0284C7; }
.btn-icon-view:hover { background: rgba(14,165,233,.25); }
.btn-icon-edit { background: rgba(245,158,11,.12); color: #D97706; }
.btn-icon-edit:hover { background: rgba(245,158,11,.25); }
.btn-icon-delete { background: rgba(244,63,94,.12); color: #E11D48; }
.btn-icon-delete:hover { background: rgba(244,63,94,.25); }

/* ============ FORM CONTROLS ============ */
.form-control-cms {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  width: 100%;
}
.form-control-cms:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }

.search-input-group {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  gap: 8px;
}
.search-input-group input {
  border: none; background: transparent; outline: none;
  padding: 8px 0; font-size: 13.5px; color: var(--text-primary); width: 100%;
}
.search-input-group i { color: var(--text-muted); font-size: 15px; }

/* ============ SECTION HEADER ============ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.section-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ============ CHART CONTAINER ============ */
.chart-container { position: relative; }

/* ============ FACULTY CARDS ============ */
.faculty-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}
.faculty-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

.faculty-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 12px;
}

/* ============ QUICK ACTIONS ============ */
.quick-action {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.quick-action:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-action .qa-icon { font-size: 26px; margin-bottom: 8px; }
.quick-action p { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }

/* ============ NOTICE CARD ============ */
.notice-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.notice-item:last-child { border-bottom: none; padding-bottom: 0; }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notice-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.notice-meta { font-size: 11.5px; color: var(--text-muted); }

/* ============ AVATAR INITIALS ============ */
.avatar-sm {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.25s;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
}
.modal-overlay.open .modal-box { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; }

.modal-close {
  width: 32px; height: 32px;
  background: var(--bg);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--border); }

/* ============ TOAST ============ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  font-size: 13.5px;
  min-width: 280px;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast i { font-size: 18px; }
.toast.success i { color: var(--emerald); }
.toast.danger i { color: var(--rose); }
.toast.info i { color: var(--sky); }

/* ============ PROGRESS ============ */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s ease;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* ============ GRID UTILITIES ============ */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ============ SPACING ============ */
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ============ LOGIN PAGE ============ */
.login-page {
  min-height: 100vh;
  display: flex;
}
.login-left {
  width: 45%;
  background: linear-gradient(145deg, #0B1437 0%, #1a1f5e 50%, #0B1437 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(79,70,229,.15);
  border-radius: 50%;
  top: -100px; left: -100px;
}
.login-left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(124,58,237,.1);
  border-radius: 50%;
  bottom: -80px; right: -80px;
}
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--bg);
}
.login-form-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

/* ============ REPORT CARDS ============ */
.report-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: var(--transition);
}
.report-card:hover { box-shadow: var(--shadow); }
.report-card .report-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}

/* ============ SETTINGS ============ */
.settings-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.settings-section h6 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--text-muted); }

/* Toggle Switch */
.toggle-switch {
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-switch.on { background: var(--accent); }
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform 0.25s;
  box-shadow: var(--shadow-sm);
}
.toggle-switch.on::after { transform: translateX(20px); }

/* Color picker dots */
.color-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}
.color-dot.selected { border-color: var(--text-primary); transform: scale(1.15); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .search-box { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    height: 100%;
    transition: left 0.3s ease, width 0.3s ease;
  }
  .sidebar.mobile-open { left: 0; }
  .page-content { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-page { display: block; }
  .login-right { padding: 24px; min-height: 100vh; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .topnav { padding: 0 12px; gap: 8px; }
  .topnav-title { font-size: 15px; }
}
