@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  --purple: #7C3AED;
  --purple-light: #A855F7;
  --purple-pale: #EDE9FE;
  --orange: #F97316;
  --orange-light: #FB923C;
  --orange-pale: #FFF7ED;
  --green: #10B981;
  --green-light: #34D399;
  --green-pale: #ECFDF5;
  --pink: #EC4899;
  --pink-pale: #FDF2F8;
  --blue: #3B82F6;
  --blue-pale: #EFF6FF;
  --yellow: #F59E0B;
  --yellow-pale: #FFFBEB;
  --sidebar-bg: #1E1B4B;
  --sidebar-hover: rgba(255,255,255,0.1);
  --sidebar-active: rgba(255,255,255,0.18);
  --bg: #F5F3FF;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #1F2937;
  --text-muted: #6B7280;
  --grad-purple: linear-gradient(135deg, #7C3AED, #A855F7);
  --grad-orange: linear-gradient(135deg, #F97316, #FBBF24);
  --grad-green: linear-gradient(135deg, #10B981, #34D399);
  --grad-pink: linear-gradient(135deg, #EC4899, #F472B6);
  --grad-blue: linear-gradient(135deg, #3B82F6, #60A5FA);
  --grad-sidebar: linear-gradient(180deg, #1E1B4B 0%, #312E81 100%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Poppins', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

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

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--grad-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s;
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 44px; height: 44px;
  background: var(--grad-purple);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
  box-shadow: 0 4px 12px rgba(124,58,237,0.4);
}

.sidebar-logo-text { color: white; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.sidebar-logo-sub { color: rgba(255,255,255,0.5); font-size: 11px; font-weight: 400; display: block; }

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

.nav-section-label {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 24px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 24px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 0;
  font-size: 14px; font-weight: 500;
  position: relative;
  margin: 2px 12px;
  border-radius: 10px;
}

.nav-item:hover { background: var(--sidebar-hover); color: white; }

.nav-item.active {
  background: var(--sidebar-active);
  color: white;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 60%;
  background: var(--purple-light);
  border-radius: 0 4px 4px 0;
}

.nav-item i { width: 20px; text-align: center; font-size: 15px; }

.nav-badge {
  margin-left: auto;
  background: var(--pink);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

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

.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.07);
  cursor: pointer;
}

.sidebar-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--grad-purple);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { color: white; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,0.45); font-size: 11px; }

.sidebar-logout { color: rgba(255,255,255,0.45); font-size: 14px; cursor: pointer; transition: color 0.2s; }
.sidebar-logout:hover { color: #F87171; }

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

/* Mobile hamburger + sidebar overlay */
.hamburger-btn {
  display: none;
  background: none;
  border: 2px solid var(--border);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.hamburger-btn:hover { border-color: var(--purple); color: var(--purple); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
}

/* Top Header */
.topbar {
  background: white;
  padding: 16px 32px;
  display: flex; align-items: center; gap: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title { flex: 1; }
.topbar-title h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.topbar-title p { font-size: 13px; color: var(--text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted);
  font-size: 16px; transition: all 0.2s;
  position: relative;
}
.topbar-btn:hover { border-color: var(--purple); color: var(--purple); }

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: var(--pink);
  border-radius: 50%; border: 2px solid white;
}

/* Page Content */
.page-content {
  padding: 32px;
  flex: 1;
}

/* Sections */
.section { display: none; }
.section.active { display: block; }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.card-title { font-size: 16px; font-weight: 700; color: var(--text); }
.card-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

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

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
}

.stat-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: white;
  flex-shrink: 0;
}

.stat-icon.purple { background: var(--grad-purple); box-shadow: 0 4px 14px rgba(124,58,237,0.35); }
.stat-icon.orange { background: var(--grad-orange); box-shadow: 0 4px 14px rgba(249,115,22,0.35); }
.stat-icon.green  { background: var(--grad-green);  box-shadow: 0 4px 14px rgba(16,185,129,0.35); }
.stat-icon.pink   { background: var(--grad-pink);   box-shadow: 0 4px 14px rgba(236,72,153,0.35); }
.stat-icon.blue   { background: var(--grad-blue);   box-shadow: 0 4px 14px rgba(59,130,246,0.35); }

.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 12px; margin-top: 4px; font-weight: 500; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: #EF4444; }

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

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

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.2s;
}

.btn-primary { background: var(--grad-purple); color: white; box-shadow: 0 4px 12px rgba(124,58,237,0.3); }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-orange  { background: var(--grad-orange); color: white; box-shadow: 0 4px 12px rgba(249,115,22,0.3); }
.btn-green   { background: var(--grad-green);  color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-outline { background: white; color: var(--purple); border: 2px solid var(--purple); }
.btn-outline:hover { background: var(--purple-pale); }
.btn-danger  { background: #FEF2F2; color: #DC2626; border: 2px solid #FECACA; }
.btn-danger:hover { background: #DC2626; color: white; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 2px solid var(--border); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 8px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 8px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: #FAFAFA; }
tbody td { padding: 14px 16px; font-size: 14px; color: var(--text); }
tbody tr:last-child { border-bottom: none; }

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-green  { background: var(--green-pale);  color: var(--green); }
.badge-orange { background: var(--orange-pale); color: var(--orange); }
.badge-purple { background: var(--purple-pale); color: var(--purple); }
.badge-red    { background: #FEF2F2; color: #DC2626; }
.badge-gray   { background: #F3F4F6; color: var(--text-muted); }
.badge-blue   { background: var(--blue-pale);   color: var(--blue); }

/* Avatar */
.avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.purple { background: var(--grad-purple); }
.avatar.orange { background: var(--grad-orange); }
.avatar.green  { background: var(--grad-green); }
.avatar.pink   { background: var(--grad-pink); }
.avatar.blue   { background: var(--grad-blue); }

.user-cell { display: flex; align-items: center; gap: 12px; }
.user-cell-name { font-weight: 600; font-size: 14px; }
.user-cell-sub  { font-size: 12px; color: var(--text-muted); }

/* Search & Filter Bar */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}

.search-box {
  display: flex; align-items: center; gap: 10px;
  background: white; border: 2px solid var(--border);
  border-radius: 10px; padding: 9px 14px;
  flex: 1; min-width: 200px; max-width: 360px;
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: var(--purple); }
.search-box i { color: var(--text-muted); font-size: 14px; }
.search-box input { border: none; outline: none; font-family: 'Poppins', sans-serif; font-size: 14px; color: var(--text); width: 100%; background: transparent; }

.filter-select {
  padding: 10px 14px; border: 2px solid var(--border); border-radius: 10px;
  font-family: 'Poppins', sans-serif; font-size: 13px; color: var(--text);
  background: white; cursor: pointer; outline: none;
  transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--purple); }

/* Form Styles */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group-modal { margin-bottom: 16px; }
.form-group-modal label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 11px 14px;
  border: 2px solid var(--border); border-radius: 10px;
  font-family: 'Poppins', sans-serif; font-size: 13px; color: var(--text);
  background: white; outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--purple); }
.form-input[readonly] { background: var(--bg); color: var(--text-muted); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.show { display: flex; }

.modal {
  background: white; border-radius: var(--radius);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 24px 24px 0;
  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; border-radius: 8px;
  border: 2px solid var(--border); background: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); font-size: 14px;
  transition: all 0.2s;
}
.modal-close:hover { border-color: #EF4444; color: #EF4444; }

.modal-body { padding: 0 24px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* Toast */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}
.toast {
  padding: 14px 18px;
  border-radius: 12px; background: white;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500;
  animation: toastIn 0.3s ease;
  min-width: 260px; max-width: 380px;
  border-left: 4px solid var(--green);
}
.toast.error { border-left-color: #EF4444; }
.toast.warning { border-left-color: var(--yellow); }
.toast i { font-size: 18px; }
.toast.success i { color: var(--green); }
.toast.error   i { color: #EF4444; }
.toast.warning i { color: var(--yellow); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Empty State */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* Loading Spinner */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center { display: flex; justify-content: center; padding: 40px; }

/* Tabs */
.tab-bar {
  display: flex; gap: 4px;
  background: var(--bg); border-radius: 12px;
  padding: 4px; margin-bottom: 24px;
}
.tab-btn {
  flex: 1; padding: 9px 16px;
  border: none; background: transparent;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--grad-purple); color: white;
  box-shadow: 0 4px 12px rgba(124,58,237,0.25);
}

/* Timetable */
.tt-table th { text-align: center; min-width: 100px; }
.tt-table td { text-align: center; min-width: 100px; padding: 8px; }
.tt-cell { padding: 6px 10px; border-radius: 8px; font-size: 12px; }
.tt-lesson { background: var(--purple-pale); color: var(--purple); font-weight: 500; }
.tt-break  { background: var(--orange-pale); color: var(--orange); font-weight: 500; }
.tt-empty  { color: var(--text-muted); font-size: 11px; }

/* Announcement Card */
.announce-card {
  padding: 16px; border-radius: 12px;
  border: 2px solid var(--border);
  margin-bottom: 12px; transition: border-color 0.2s;
}
.announce-card:hover { border-color: var(--purple-light); }
.announce-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.announce-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; flex-shrink: 0; margin-top: 2px; }
.announce-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.announce-body { font-size: 13px; color: var(--text-muted); }
.announce-meta { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

/* Progress Bar */
.progress-bar { height: 8px; background: var(--border); border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 20px; transition: width 0.5s ease; }
.progress-fill.purple { background: var(--grad-purple); }
.progress-fill.green  { background: var(--grad-green); }
.progress-fill.orange { background: var(--grad-orange); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }
