/* ============================================================
   AcadLog — Master Stylesheet  (by Theofco)
   ============================================================ */

:root {
  --primary:       #1e3a5f;
  --primary-light: #2a5298;
  --primary-dark:  #142847;
  --accent:        #f0a500;
  --accent-dark:   #d4920d;
  --success:       #10B981;
  --danger:        #EF4444;
  --warning:       #F59E0B;
  --info:          #3B82F6;
  --purple:        #8B5CF6;
  --teal:          #06B6D4;
  --orange:        #F97316;

  --bg:            #f0f4f8;
  --card-bg:       #ffffff;
  --sidebar-bg:    #1e3a5f;
  --sidebar-text:  rgba(255,255,255,0.85);
  --sidebar-active:#f0a500;
  --topbar-bg:     #ffffff;
  --text:          #1a202c;
  --text-muted:    #718096;
  --border:        #e2e8f0;

  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:     0 10px 40px rgba(0,0,0,0.15);
  --transition:    all 0.25s ease;
  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }
img { max-width: 100%; }
button { cursor: pointer; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2a5298 50%, #1e3a5f 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(240,165,0,0.08);
  top: -200px; right: -200px;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  bottom: -150px; left: -100px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
  position: relative;
  z-index: 10;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(30,58,95,0.35);
}
.login-logo h1 { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.login-logo p { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text-muted); font-size: 0.8rem;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: var(--transition);
  overflow-x: hidden;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--primary-dark); font-weight: 800;
  flex-shrink: 0;
}
.sidebar-brand .brand-name { font-size: 1rem; font-weight: 700; color: #fff; }
.sidebar-brand .brand-sub { font-size: 0.7rem; color: rgba(255,255,255,0.5); }
.sidebar-user {
  padding: 16px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { overflow: hidden; }
.user-info .user-name { font-size: 0.85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .user-role { font-size: 0.7rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.35);
  padding: 16px 20px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  font-size: 0.87rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
  cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
  background: rgba(240,165,0,0.15);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 20px;
  font-weight: 700;
}

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

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.topbar-title { flex: 1; font-size: 1.1rem; font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar-title span { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}
.topbar-btn:hover { background: var(--bg); color: var(--primary); }
.topbar-btn .badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger);
  color: #fff; font-size: 0.6rem;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ── Page Body ── */
.page-body { padding: 24px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.page-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb span { color: var(--text-muted); }
.breadcrumb a { color: var(--primary-light); }
.breadcrumb a:hover { color: var(--accent); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.card-header h3 { font-size: 1rem; font-weight: 600; color: var(--text); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: #fafbfc; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
  border-left: 4px solid transparent;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-card.blue .stat-icon   { background: #eff6ff; color: var(--info); }
.stat-card.blue               { border-left-color: var(--info); }
.stat-card.green .stat-icon  { background: #f0fdf4; color: var(--success); }
.stat-card.green              { border-left-color: var(--success); }
.stat-card.orange .stat-icon { background: #fff7ed; color: var(--orange); }
.stat-card.orange             { border-left-color: var(--orange); }
.stat-card.purple .stat-icon { background: #f5f3ff; color: var(--purple); }
.stat-card.purple             { border-left-color: var(--purple); }
.stat-card.gold .stat-icon   { background: #fffbeb; color: var(--warning); }
.stat-card.gold               { border-left-color: var(--warning); }
.stat-card.teal .stat-icon   { background: #ecfeff; color: var(--teal); }
.stat-card.teal               { border-left-color: var(--teal); }
.stat-info .stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-info .stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.stat-info .stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 3px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}
.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(42,82,152,0.1); }
.form-control::placeholder { color: #a0aec0; }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid { border-color: var(--success); }
.invalid-feedback { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .input-group-text {
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 40px; }
.input-icon-wrap .input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.95rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem; font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
  font-family: inherit; line-height: 1.4;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: #fff; }
.btn-accent { background: var(--accent); color: var(--primary-dark); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); color: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #0da674; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; }
.btn-info { background: var(--info); color: #fff; border-color: var(--info); }
.btn-info:hover { background: #2563eb; }
.btn-secondary { background: #f1f5f9; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-outline-primary { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table thead th {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.data-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td { padding: 12px 16px; vertical-align: middle; color: var(--text); }
.data-table .actions { display: flex; gap: 6px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-primary  { background: #eff6ff; color: var(--info); }
.badge-success  { background: #f0fdf4; color: #15803d; }
.badge-danger   { background: #fef2f2; color: #b91c1c; }
.badge-warning  { background: #fffbeb; color: #92400e; }
.badge-purple   { background: #f5f3ff; color: #6d28d9; }
.badge-info     { background: #ecfeff; color: #0e7490; }
.badge-gray     { background: #f1f5f9; color: #475569; }
.badge-orange   { background: #fff7ed; color: #c2410c; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 600px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s ease;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  margin: auto;
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-sm .modal { max-width: 420px; }
.modal-lg .modal { max-width: 800px; }
.modal-xl .modal { max-width: 1060px; }
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h4 { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--bg); border: none; color: var(--text-muted);
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}

/* ============================================================
   TABS
   ============================================================ */
.tab-nav {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.tab-btn {
  padding: 10px 18px;
  font-size: 0.87rem; font-weight: 600;
  color: var(--text-muted);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer; transition: var(--transition);
  white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.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; }

/* ============================================================
   CALENDAR
   ============================================================ */
.calendar-wrapper { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--primary);
  color: #fff;
}
.calendar-nav h2 { font-size: 1.1rem; font-weight: 700; }
.cal-nav-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,0.15); border: none;
  color: #fff; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.cal-nav-btn:hover { background: rgba(255,255,255,0.25); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day-header {
  text-align: center; padding: 10px;
  font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.cal-day {
  min-height: 90px; padding: 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative; cursor: pointer; transition: var(--transition);
}
.cal-day:hover { background: #f8fafc; }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.other-month .cal-date { color: #cbd5e1; }
.cal-day.today .cal-date {
  background: var(--primary); color: #fff;
  border-radius: 50%; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.cal-date { font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.cal-event {
  font-size: 0.68rem; font-weight: 600;
  padding: 2px 5px; border-radius: 3px;
  margin-bottom: 2px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  color: #fff; cursor: pointer;
}
.calendar-legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ============================================================
   PROFILE CARD
   ============================================================ */
.profile-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.profile-cover {
  height: 100px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}
.profile-info { padding: 0 24px 24px; }
.profile-avatar-wrap { margin-top: -40px; margin-bottom: 12px; }
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%; object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: #fff; font-weight: 700;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.profile-title { font-size: 0.85rem; color: var(--text-muted); }
.profile-badge { margin-top: 6px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.profile-meta-item { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); }
.profile-meta-item i { color: var(--primary-light); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.88rem; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-danger   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-warning  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info     { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.alert-dismiss { margin-left: auto; background: none; border: none; cursor: pointer; opacity: 0.6; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .topbar, .no-print, .modal-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  body { background: #fff !important; font-size: 12pt; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
  .print-header { display: block !important; }
  .print-footer { display: block !important; }
  a { color: inherit !important; text-decoration: none !important; }

  .print-page { page-break-after: always; }
  @page { margin: 2cm; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; page-break-after: auto; }
  thead { display: table-header-group; }
}
.print-header, .print-footer { display: none; }

/* ============================================================
   MISC
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fs-sm { font-size: 0.82rem; }
.fs-xs { font-size: 0.72rem; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  min-width: 180px; z-index: 1500;
  display: none; overflow: hidden;
}
.dropdown-menu.show { display: block; animation: fadeDown 0.15s ease; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 0.87rem; color: var(--text);
  cursor: pointer; transition: var(--transition); border: none;
  background: none; width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--bg); color: var(--primary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #fef2f2; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Progress */
.progress-bar-wrap { background: var(--border); border-radius: 20px; height: 7px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; transition: width 0.5s ease; }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--primary-dark); color: #fff;
  font-size: 0.72rem; padding: 4px 10px; border-radius: 5px;
  white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity 0.15s ease; z-index: 3000;
}
[data-tooltip]:hover::after { opacity: 1; }

/* Animations */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateX(-10px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.fade-in { animation: fadeIn 0.3s ease; }
.slide-in { animation: slideIn 0.3s ease; }

/* ============================================================
   SHARED RESPONSIVE ROW GRIDS
   Use these instead of inline grid-template-columns so the
   @media rules below can collapse them on small screens.
   ============================================================ */
.row-2col { display: grid; grid-template-columns: 1fr 170px; gap: 10px; }
.row-3col { display: grid; grid-template-columns: 1fr 140px 140px; gap: 10px; }
.row-4col { display: grid; grid-template-columns: 140px 1fr 130px 130px; gap: 10px; }

/* Mobile sidebar backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}

/* Responsive */
@media (max-width: 992px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-260px); width: 260px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-backdrop,
  .sidebar.open + .sidebar-backdrop { display: block; }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .row-2col, .row-3col, .row-4col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .row-2col, .row-3col, .row-4col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .mobile-hide { display: none !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 1.05rem; border-radius: 10px; }
  .stat-info .stat-value { font-size: 1.35rem; }
  .stat-info .stat-label { font-size: 0.7rem; line-height: 1.25; margin-top: 2px; }
  .stat-info .stat-sub { font-size: 0.65rem; }
  .page-body { padding: 16px; }
  .card-body { padding: 16px; }
  .modal { margin: 0; border-radius: 16px 16px 0 0; max-height: 100vh; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-body { padding: 16px; }
  .modal-header, .modal-footer { padding: 12px 16px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 1rem; }
  .topbar-title span { display: none; }
  .topbar > div[style*="margin-right"] { display: none; }
  .card-header { padding: 14px 16px; }
  .data-table thead th, .data-table tbody td { padding: 10px 12px; font-size: 0.82rem; }
  .btn-group { width: 100%; }
  .btn-group .btn { flex: 1; justify-content: center; }
  .checkbox-grid { grid-template-columns: repeat(auto-fill,minmax(140px,1fr)) !important; }

  /* Calendar */
  .calendar-wrapper { overflow-x: auto; }
  .calendar-grid { min-width: 560px; }
  .cal-day { min-height: 60px; padding: 4px; }
  .cal-day-header { padding: 6px 2px; font-size: 0.65rem; }
  .cal-date { font-size: 0.75rem; margin-bottom: 2px; }
  .cal-event { font-size: 0.6rem; padding: 1px 3px; margin-bottom: 1px; }
  .calendar-nav { padding: 12px 14px; }
  .calendar-nav h2 { font-size: 0.95rem; }
  .calendar-legend { padding: 12px 14px; gap: 8px; }
}

/* Generic safety-net: collapse common inline 2/3/4-column grids on small
   screens for pages that haven't been converted to .form-row / .row-Ncol yet. */
@media (max-width: 700px) {
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3,1fr)"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns:200px 1fr"],
  [style*="grid-template-columns:220px 1fr"],
  [style*="grid-template-columns:160px 1fr"],
  [style*="grid-template-columns:320px 1fr"],
  [style*="grid-template-columns:1fr 280px"],
  [style*="grid-template-columns:1fr 300px"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns:1fr 350px"] {
    grid-template-columns: 1fr !important;
  }
}

/* Notification dropdown */
.notif-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  width: 320px; max-width: calc(100vw - 24px); z-index: 1500;
  display: none; overflow: hidden;
}
.notif-dropdown.show { display: block; animation: fadeDown 0.15s ease; }
.notif-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-header strong { font-size: 0.9rem; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); transition: var(--transition); cursor: pointer; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #eff6ff; }
.notif-item:last-child { border-bottom: none; }
.notif-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0; }
.notif-text { font-size: 0.82rem; color: var(--text); }
.notif-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 3px; }

/* Diary Entry Cards */
.diary-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
  background: #fff;
}
.diary-card:hover { border-color: var(--primary-light); box-shadow: 0 2px 12px rgba(42,82,152,0.08); }
.diary-type-badge { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 20px; }

/* Teaching Plan Progress */
.plan-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.plan-row:last-child { border-bottom: none; }
.plan-week { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); min-width: 55px; }
.plan-topic { flex: 1; font-size: 0.88rem; font-weight: 600; }
.plan-status { flex-shrink: 0; }

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

/* Rich section titles */
.section-title {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; width: 3px; height: 14px;
  background: var(--primary); border-radius: 2px; display: block;
}
