/* ============================================================
   AGBTH — Design System
   ============================================================ */

/* --- Tokens --- */
:root {
  /* Palette */
  --c-primary:    #4f46e5;
  --c-primary-h:  #4338ca;
  --c-primary-l:  #eef2ff;
  --c-accent:     #0ea5e9;
  --c-accent-h:   #0284c7;
  --c-success:    #16a34a;
  --c-success-l:  #f0fdf4;
  --c-warning:    #d97706;
  --c-warning-l:  #fffbeb;
  --c-danger:     #dc2626;
  --c-danger-l:   #fef2f2;

  /* Neutrals */
  --c-bg:         #f1f5f9;
  --c-surface:    #ffffff;
  --c-border:     #e2e8f0;
  --c-border-h:   #cbd5e1;
  --c-text:       #0f172a;
  --c-text-2:     #475569;
  --c-text-3:     #94a3b8;
  --c-muted:      #f8fafc;

  /* Sidebar */
  --sidebar-bg:   #0f172a;
  --sidebar-w:    264px;
  --sidebar-item: #1e293b;

  /* Elevation */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.05);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --dur: .2s;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  transition: transform .3s var(--ease);
  z-index: 1000;
  border-right: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
}

.sidebar.collapsed { transform: translateX(calc(var(--sidebar-w) * -1)); }

.sidebar-header {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.nav-section { margin-bottom: 6px; }

.nav-section-title {
  padding: 8px 20px;
  font-size: .7rem;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
  letter-spacing: .08em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: color var(--dur) var(--ease);
}

.nav-section-title:hover { color: #94a3b8; }

.nav-section-title.dropdown-toggle { cursor: pointer; }

.dropdown-arrow {
  font-size: .6rem;
  transition: transform .25s var(--ease);
  color: #475569;
}

.nav-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease-out;
}

.nav-dropdown.open {
  max-height: 600px;
  transition: max-height .4s ease-in;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  color: #94a3b8;
  text-decoration: none;
  transition: all var(--dur) var(--ease);
  border-left: 3px solid transparent;
  font-size: .875rem;
  gap: 10px;
}

.nav-item:hover {
  background: var(--sidebar-item);
  color: #e2e8f0;
  border-left-color: var(--c-primary);
}

.nav-item.active {
  background: var(--sidebar-item);
  color: #fff;
  border-left-color: var(--c-primary);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label { flex: 1; }

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 14px 18px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
  color: #fff;
}

.user-details { flex: 1; min-width: 0; }

.user-name {
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: .7rem;
  color: #64748b;
  text-transform: capitalize;
}

.nav-item.logout { color: #f87171; }
.nav-item.logout:hover { background: rgba(239,68,68,.12); color: #fca5a5; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left .3s var(--ease);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* Header */
.top-header {
  background: var(--c-surface);
  padding: 16px 28px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.sidebar-toggle-btn {
  background: var(--c-muted);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 0;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-2);
  font-size: 1.15rem;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--c-border);
  color: var(--c-text);
}

.sidebar-toggle-btn:active { transform: scale(.93); }

.toggle-icon {
  display: block;
  transition: transform .3s var(--ease);
}

.sidebar.collapsed ~ .main-content .toggle-icon {
  transform: rotate(90deg);
}

.top-header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--c-text);
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Content Area */
.content-wrapper {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
  transition: box-shadow var(--dur) var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }

.card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--c-text);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -.01em;
}

/* Action card (quick actions on dashboards) */
.action-card {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 20px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .25s var(--ease);
}

.action-card:hover {
  border-color: var(--c-primary-l);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.action-card .action-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
  line-height: 1;
}

.action-card h3 {
  margin: 0 0 4px 0;
  font-size: 1rem;
  color: var(--c-text);
}

.action-card p {
  color: var(--c-text-3);
  margin: 0;
  font-size: .8rem;
  line-height: 1.4;
}

/* ============================================================
   GRID
   ============================================================ */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  background: var(--c-surface);
  font-size: .875rem;
}

th, td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
}

th {
  background: var(--c-muted);
  font-weight: 600;
  color: var(--c-text-2);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

tbody tr { transition: background var(--dur) var(--ease); }
tbody tr:hover { background: var(--c-muted); }

/* Honor row highlight */
tr.honor-row {
  background-color: #f0fdf4;
  border-left: 4px solid var(--c-success);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  border: none;
  background: var(--c-primary);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: .835rem;
  transition: all var(--dur) var(--ease);
  text-align: center;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover {
  background: var(--c-primary-h);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn.secondary, .btn-secondary {
  background: var(--c-surface);
  color: var(--c-text-2);
  border: 1px solid var(--c-border);
}

.btn.secondary:hover, .btn-secondary:hover {
  background: var(--c-muted);
  border-color: var(--c-border-h);
  color: var(--c-text);
}

.btn.danger, .btn-danger {
  background: var(--c-danger);
  color: #fff;
  border: none;
}

.btn.danger:hover, .btn-danger:hover { background: #b91c1c; }

.btn-success { background: var(--c-success); color: #fff; border: none; }
.btn-success:hover { background: #15803d; }

.btn-warning { background: var(--c-warning); color: #fff; border: none; }
.btn-warning:hover { background: #b45309; }

.btn-outline-primary {
  background: transparent;
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
}
.btn-outline-primary:hover { background: var(--c-primary-l); }

.btn-sm {
  padding: 5px 12px;
  font-size: .78rem;
  border-radius: var(--r-sm);
}

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-h); }

/* Button groups */
.btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================
   FORMS
   ============================================================ */
form label, .form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--c-text-2);
  font-size: .82rem;
}

form input, form select, form textarea, 
select, .form-control, .form-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  margin-bottom: 14px;
  font-size: .875rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  background: var(--c-surface);
  color: var(--c-text);
  line-height: 1.5;
}

/* Dropdown selects (not multi-line) get a custom chevron */
select:not([size]),
.form-select:not([size]),
select[size="1"],
.form-select[size="1"] {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 34px;
  cursor: pointer;
}

select:not([size]):hover,
.form-select:not([size]):hover {
  border-color: #cbd5e1;
}

form input:focus, form select:focus, form textarea:focus,
select:focus, .form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

form textarea {
  resize: vertical;
  min-height: 100px;
}

input::placeholder, textarea::placeholder {
  color: var(--c-text-3);
}

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.form-check-input { width: auto; margin-bottom: 0; accent-color: var(--c-primary); }
.form-check-label { margin-bottom: 0; font-weight: 500; }

/* Row / Col compat (Bootstrap-inspired grid) */
.row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.row.g-3 { gap: 0; margin: 0 -8px -16px; }
.row.g-3 > [class*="col-md-"] { padding: 0 8px; margin-bottom: 16px; }
.col-md-1, .col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-12 { padding: 0 10px; }
.col-md-1  { flex: 0 0 8.33%; max-width: 8.33%; }
.col-md-3  { flex: 0 0 25%; max-width: 25%; }
.col-md-4  { flex: 0 0 33.33%; max-width: 33.33%; }
.col-md-6  { flex: 0 0 50%; max-width: 50%; }
.col-md-8  { flex: 0 0 66.66%; max-width: 66.66%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  font-weight: 500;
  animation: alertIn .3s var(--ease);
}

@keyframes alertIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert.success, .alert-success {
  background: var(--c-success-l);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert.error, .alert-danger {
  background: var(--c-danger-l);
  color: #b91c1c;
  border: 1px solid #fecdd3;
}

.alert.warning, .alert-warning {
  background: var(--c-warning-l);
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert.fade-out {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: .72rem;
  font-weight: 600;
  background: #e2e8f0;
  color: var(--c-text-2);
  line-height: 1.5;
  white-space: nowrap;
}

.badge.success, .badge-success   { background: #dcfce7; color: #166534; }
.badge.danger,  .badge-danger    { background: #fee2e2; color: #991b1b; }
.badge.info,    .badge-info      { background: #dbeafe; color: #1e40af; }
.badge.warning, .badge-warning   { background: #fef3c7; color: #92400e; }
.badge-secondary                 { background: #e2e8f0; color: var(--c-text-2); }

/* ============================================================
   STATS CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  color: #fff;
  padding: 22px 24px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

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

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

.stat-card h3 {
  margin: 0 0 6px 0;
  font-size: .78rem;
  opacity: .85;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: inherit;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -.02em;
}

.stat-card.purple  { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.stat-card.pink    { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.stat-card.blue    { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.stat-card.green   { background: linear-gradient(135deg, #22c55e, #14b8a6); }
.stat-card.orange  { background: linear-gradient(135deg, #f59e0b, #ef4444); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--c-muted);
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  margin-bottom: 20px;
}

.filter-bar .row.g-3 {
  align-items: flex-end;
  margin-bottom: 0;
}

.filter-bar .row.g-3 > [class*="col-md-"] {
  margin-bottom: 0;
}

.filter-bar .form-label {
  margin-bottom: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--c-text-2);
  white-space: nowrap;
}

.filter-bar .form-select,
.filter-bar .form-control {
  margin-bottom: 0;
}

.filter-bar .btn {
  margin-bottom: 0;
}

/* Ensure action column (buttons) aligns with bottom of inputs */
.filter-bar .d-flex.align-items-center {
  padding-bottom: 0;
  min-height: 38px;
}

/* Remove extra bottom margins inside filter bar */
.filter-bar .mb-3 {
  margin-bottom: 0 !important;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-text-3);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: .5;
}

.empty-state p {
  margin: 0 0 16px 0;
  font-size: .95rem;
}

/* ============================================================
   MIGRATION / INFO BANNERS
   ============================================================ */
.info-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.info-banner h3 { color: #1e40af; font-size: 1rem; margin-bottom: 8px; }
.info-banner p  { color: #1e40af; margin: 0 0 12px 0; font-size: .85rem; }

/* ============================================================
   UTILITIES (Bootstrap-like helpers used in pages)
   ============================================================ */
.mb-0 { margin-bottom: 0 !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 20px !important; }
.mt-3 { margin-top: 12px !important; }
.p-4  { padding: 20px !important; }
.text-secondary { color: var(--c-text-3) !important; }
.text-muted { color: var(--c-text-3) !important; }
.text-center { text-align: center; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.d-inline-block { display: inline-block; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.ws-nowrap { white-space: nowrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.flex-column { flex-direction: column; }
.align-items-end { align-items: flex-end; }

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

.page-header .page-title { margin: 0; }
.page-header .page-desc  { color: var(--c-text-3); font-size: .85rem; margin: 2px 0 0 0; }

/* Table responsive */
.table { width: 100%; }
.table-striped tbody tr:nth-child(even) { background: var(--c-muted); }
.table-hover tbody tr:hover { background: #f1f5f9; }

/* Student photo placeholder */
.avatar-placeholder {
  width: 42px;
  height: 42px;
  background: var(--c-border);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-3);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.avatar-img {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  object-fit: cover;
}

/* Searchable select — combined input + listbox */
.searchable-select {
  position: relative;
}

.searchable-select input[type="text"] {
  margin-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  border-bottom: none;
  padding-left: 12px;
  background: var(--c-surface);
}

.searchable-select input[type="text"]:focus {
  z-index: 1;
  border-color: var(--c-primary);
  border-bottom: none;
  box-shadow: 0 -2px 0 0 rgba(79,70,229,.12), -3px 0 0 0 rgba(79,70,229,.12), 3px 0 0 0 rgba(79,70,229,.12);
}

.searchable-select select {
  max-height: 150px;
  overflow-y: auto;
  border-radius: 0 0 var(--r-md) var(--r-md);
  border-top: 1px solid var(--c-border);
  margin-bottom: 14px;
  cursor: pointer;
  padding: 0;
}

.searchable-select select option {
  padding: 8px 12px;
  font-size: .84rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background var(--dur) var(--ease);
}

.searchable-select select option:last-child {
  border-bottom: none;
}

.searchable-select select option:hover {
  background: #eef2ff;
}

.searchable-select select option:checked {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  color: var(--c-primary);
  font-weight: 600;
}

/* Searchable select count badge */
.searchable-select .select-count {
  display: block;
  font-size: .72rem;
  color: var(--c-text-3);
  margin-top: 2px;
  margin-bottom: 8px;
}

/* Custom scrollbar for searchable select */
.searchable-select select::-webkit-scrollbar {
  width: 6px;
}

.searchable-select select::-webkit-scrollbar-track {
  background: var(--c-muted);
  border-radius: 0 0 var(--r-md) 0;
}

.searchable-select select::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: var(--r-full);
}

.searchable-select select::-webkit-scrollbar-thumb:hover {
  background: var(--c-text-3);
}

/* Small help text below searchable-select */
.searchable-select .form-text {
  font-size: .75rem;
  display: block;
  margin-top: -8px;
  margin-bottom: 8px;
}

/* Inline display helpers */
.d-inline { display: inline !important; }
.d-none { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .col-md-1  { flex: 0 0 auto; max-width: none; }
  .col-md-3  { flex: 0 0 50%; max-width: 50%; }
  .col-md-4  { flex: 0 0 50%; max-width: 50%; }
  .col-md-8  { flex: 0 0 100%; max-width: 100%; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(var(--sidebar-w) * -1));
    position: fixed;
    z-index: 1001;
  }

  .sidebar:not(.collapsed) {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .sidebar:not(.collapsed) ~ .main-content::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1000;
    backdrop-filter: blur(2px);
  }

  .main-content { margin-left: 0; }

  .content-wrapper { padding: 16px; }

  .top-header { padding: 12px 16px; }
  .top-header h1 { font-size: 1.2rem; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .col-md-1, .col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .row.g-3 { margin: 0 -5px -10px; }
  .row.g-3 > [class*="col-md-"] { padding: 0 5px; margin-bottom: 10px; }

  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn-group { flex-direction: column; width: 100%; }
  .btn-group .btn { width: 100%; }
}

/* Old header compatibility */
header { display: none; }

.container {
  max-width: 100%;
  margin: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.show { display: flex; animation: fadeIn .2s var(--ease); }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  padding: 0;
  max-width: 620px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp .3s var(--ease);
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--c-border);
}

.modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-text);
}

.modal-close {
  background: var(--c-muted);
  border: 1px solid var(--c-border);
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--c-text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur) var(--ease);
  line-height: 1;
}

.modal-close:hover { background: var(--c-border); color: var(--c-text); }

.modal-body { padding: 20px 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--c-border);
  background: var(--c-muted);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ============================================================
   GRADES TABLE
   ============================================================ */
.grades-table { border-collapse: collapse; width: 100%; }

.grades-table th {
  background: var(--c-muted);
  font-weight: 600;
  border: 1px solid var(--c-border);
}

.grades-table td {
  border: 1px solid var(--c-border);
  padding: 8px 10px;
}

.grades-table input[type="number"] {
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 7px;
  text-align: center;
  transition: border-color var(--dur) var(--ease);
  width: 80px;
}

.grades-table input[type="number"]:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.grades-table input[type="text"] {
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 6px;
  width: 100%;
  font-size: .78rem;
}

.grades-table input[type="text"]:focus {
  outline: none;
  border-color: var(--c-primary);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  top: -200px;
  right: -100px;
}

.login-container::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: rgba(255,255,255,.03);
  border-radius: 50%;
  bottom: -150px;
  left: -80px;
}

.login-card {
  background: var(--c-surface);
  padding: 40px 36px;
  border-radius: var(--r-xl);
  box-shadow: 0 25px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-card h2 {
  margin: 0 0 6px 0;
  color: var(--c-text);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.login-card p {
  color: var(--c-text-3);
  margin-bottom: 28px;
  font-size: .9rem;
}

.login-card .btn {
  width: 100%;
  padding: 12px;
  font-size: .95rem;
  margin-top: 8px;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
}

.login-footer a {
  color: var(--c-text-3);
  text-decoration: none;
  font-size: .82rem;
  transition: color var(--dur) var(--ease);
}

.login-footer a:hover { color: var(--c-primary); }

/* ============================================================
   PRINT
   ============================================================ */
/* ============================================================
   ADDITIONAL UTILITIES
   ============================================================ */

/* Sticky column for wide tables */
.sticky-col {
  position: sticky;
  left: 0;
  background: var(--c-surface);
  z-index: 2;
}

thead .sticky-col { z-index: 3; }

/* Table row variants */
.table-white { background: var(--c-surface); }
.table-light { background: var(--c-muted); }

/* Card header (for periodes year groups) — counteract parent card padding */
.card > .card-header:first-child {
  margin: -24px -24px 0;
  background: var(--c-muted);
  border-bottom: 2px solid var(--c-border);
  padding: 16px 24px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.card-header h4 { margin: 0; font-size: 1rem; }

.card > .card-body:last-child {
  margin: 0 -24px -24px;
  padding: 20px 24px;
}

/* Info banner color variants */
.info-banner.warning {
  border-left-color: #d97706;
  background: #fffbeb;
  border-color: #fde68a;
}

.info-banner.warning h3 { color: #92400e; }
.info-banner.warning p  { color: #92400e; }

/* Max-width utility */
.max-w-badge { max-width: 500px; }

/* Min-width utilities for grades table */
.min-w-name { min-width: 200px; }
.min-w-grade { min-width: 60px; }

/* Inline list for instructions */
.instruction-list {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding-left: 0;
}

.instruction-list li {
  margin-bottom: 4px;
  font-size: .85rem;
}

/* Form control small variant */
.form-control-sm {
  padding: 5px 8px;
  font-size: .78rem;
}

/* Grades column header */
.grade-col-header {
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.grade-col-coeff {
  font-size: .72rem;
  color: var(--c-text-3);
}

/* Visually hidden (screen reader only) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.fw-500 { font-weight: 500; }
.modal-lg { max-width: 700px; }
.modal-scroll { max-height: 400px; overflow-y: auto; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .top-header, .sidebar-toggle-btn, .btn, .filter-bar, .modal { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .content-wrapper { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
