/* ─── Self-eAssessment · Custom Component CSS ────────────────────────────────
   Pairs with Tailwind Play CDN + custom color config in layouts.
   ─────────────────────────────────────────────────────────────────────────── */

/* Reset / base */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid #2f3484; outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background-color: #2f3484;
  color: #fff;
  border-color: #2f3484;
}
.btn-primary:hover { background-color: #252a6a; border-color: #252a6a; }

.btn-secondary {
  background-color: #e2e8f0;
  color: #334155;
  border-color: #e2e8f0;
}
.btn-secondary:hover { background-color: #cbd5e1; }

.btn-danger {
  background-color: #d9282e;
  color: #fff;
  border-color: #d9282e;
}
.btn-danger:hover { background-color: #BE2329; }

.btn-outline {
  background-color: transparent;
  color: #2f3484;
  border-color: #2f3484;
}
.btn-outline:hover { background-color: #eef0fa; }

.btn-ghost {
  background-color: transparent;
  color: #64748b;
  border-color: transparent;
}
.btn-ghost:hover { background-color: #f1f5f9; color: #334155; }

.btn-success {
  background-color: #22c55e;
  color: #fff;
  border-color: #22c55e;
}
.btn-success:hover { background-color: #16a34a; }

.btn-warning {
  background-color: #f59e0b;
  color: #fff;
  border-color: #f59e0b;
}
.btn-warning:hover { background-color: #d97706; }

.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.625rem 1.5rem; font-size: 1rem; }
.btn-xl { padding: 0.875rem 2rem; font-size: 1.075rem; }
.btn-icon { padding: 0.5rem; border-radius: 0.375rem; }
.btn-icon.btn-sm { padding: 0.25rem; }

/* ─── Form Controls ───────────────────────────────────────────────────────── */
.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  margin-bottom: 0.25rem;
}
.label-required::after { content: ' *'; color: #d9282e; }

.input,
select.input,
textarea.input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #1e293b;
  background-color: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.input:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  border-color: #2f3484;
  box-shadow: 0 0 0 3px rgba(47,52,132,.12);
}
.input::placeholder { color: #94a3b8; }
.input[readonly] { background-color: #f8fafc; cursor: default; }
.input-sm { padding: 0.35rem 0.6rem; font-size: 0.8125rem; }
.input-error { border-color: #d9282e !important; }
.form-error { color: #d9282e; font-size: 0.8125rem; margin-top: 0.25rem; }
.form-hint  { color: #64748b;  font-size: 0.8125rem; margin-top: 0.25rem; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.card-title { font-size: 1rem; font-weight: 600; color: #1e293b; margin: 0; }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  background-color: #f8fafc;
  border-radius: 0 0 0.75rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  line-height: 1.2;
  white-space: nowrap;
}
.badge-primary   { background-color: #eef0fa; color: #2f3484; }
.badge-success   { background-color: #dcfce7; color: #15803d; }
.badge-warning   { background-color: #fef3c7; color: #92400e; }
.badge-danger    { background-color: #fee2e2; color: #991b1b; }
.badge-secondary { background-color: #f1f5f9; color: #475569; }
.badge-info      { background-color: #dbeafe; color: #1e40af; }
.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* ─── Table ───────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #334155;
}
.table tbody tr:hover { background-color: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.table-striped tbody tr:nth-child(even) { background-color: #f8fafc; }

/* ─── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; color: #1e293b; margin: 0; }
.page-description { font-size: 0.875rem; color: #64748b; margin-top: 0.25rem; }

/* ─── Nav ─────────────────────────────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .15s, color .15s;
  white-space: nowrap;
}
.nav-item-active   { background-color: #eef0fa; color: #2f3484; }
.nav-item-inactive { color: #64748b; }
.nav-item-inactive:hover { background-color: #f1f5f9; color: #334155; }

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 256px;
  height: 100vh;
  background-color: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 50;
  transition: transform .3s;
}
.sidebar-logo {
  height: 64px;
  flex-shrink: 0;
  padding: 0 1rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.sidebar-logo-inner { display: flex; align-items: center; gap: 0.75rem; }
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  /* Reserve space for absolute-positioned footer (~80px) */
  padding-bottom: 5rem;
}
.sidebar-section {
  font-size: 0.75rem; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: #94a3b8;
  padding: 1rem 0.75rem 0.5rem;
}
.sidebar-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
  background-color: #fff;
}

.main-content { margin-left: 256px; min-height: 100vh; display: flex; flex-direction: column; }
.main-topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem 0 2rem;
  gap: 0.5rem;
  position: sticky; top: 0; z-index: 40;
}
.main-body { flex: 1; padding: 1.5rem 2rem; }

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40;
}
.sidebar-backdrop.open { display: block; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ─── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 1.25rem; height: 1.25rem;
  border: 2px solid #e2e8f0;
  border-top-color: #2f3484;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-sm { width: .875rem; height: .875rem; }
.spinner-lg { width: 2rem;    height: 2rem; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background-color: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-content {
  background: #fff;
  border-radius: 0.875rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  width: 100%; max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-sm { max-width: 360px; }
.modal-lg { max-width: 680px; }
.modal-xl { max-width: 900px; }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-body   { padding: 1.25rem 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem;
  background-color: #f8fafc;
  border-radius: 0 0 0.875rem 0.875rem;
}

/* ─── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 0.875rem 1rem; border-radius: 0.5rem; font-size: 0.875rem;
  display: flex; align-items: flex-start; gap: 0.625rem; border: 1px solid transparent; }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.alert-success { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.alert-error   { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ─── Toast notifications ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 200; display: flex; flex-direction: column; gap: 0.625rem;
  pointer-events: none;
}
.toast {
  pointer-events: all;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 0.625rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.14);
  min-width: 260px; max-width: 380px;
  animation: slideInToast .25s ease;
}
.toast-success { background: #15803d; color: #fff; }
.toast-error   { background: #991b1b; color: #fff; }
.toast-info    { background: #2f3484; color: #fff; }
.toast-warning { background: #92400e; color: #fff; }
@keyframes slideInToast { from { opacity: 0; transform: translateY(10px); } }

/* ─── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar {
  height: 8px; background-color: #e2e8f0;
  border-radius: 9999px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background-color: #2f3484;
  border-radius: 9999px; transition: width .4s;
}
.progress-bar-success .progress-bar-fill { background-color: #22c55e; }
.progress-bar-danger  .progress-bar-fill { background-color: #d9282e; }

/* ─── Stats cards ─────────────────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.stat-value { font-size: 1.75rem; font-weight: 700; color: #1e293b; line-height: 1; }
.stat-label { font-size: 0.8125rem; color: #64748b; font-weight: 500; margin-top: 0.1rem; }

/* ─── Dropdown ────────────────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
  position: absolute; top: 100%; right: 0; z-index: 50;
  min-width: 160px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  padding: 0.25rem;
  display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem; color: #334155; font-weight: 400;
  border-radius: 0.375rem; cursor: pointer;
  text-decoration: none; white-space: nowrap; border: none; background: none; width: 100%;
  transition: background-color .1s;
}
.dropdown-item:hover { background-color: #f1f5f9; }
.dropdown-item.danger { color: #d9282e; }
.dropdown-item.danger:hover { background-color: #fee2e2; }
.dropdown-divider { border-top: 1px solid #e2e8f0; margin: 0.25rem 0; }

/* ─── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: #94a3b8;
}
.empty-state-icon { font-size: 3rem; margin-bottom: 0.75rem; opacity: .5; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: #64748b; }
.empty-state-desc  { font-size: 0.875rem; margin-top: 0.25rem; }

/* ─── Search/filter bar ───────────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 0.625rem;
  background: #fff; border: 1px solid #cbd5e1;
  border-radius: 0.5rem; padding: 0.4rem 0.75rem;
}
.search-bar:focus-within { border-color: #2f3484; box-shadow: 0 0 0 3px rgba(47,52,132,.1); }
.search-bar input {
  border: none; outline: none; background: transparent;
  font-size: 0.875rem; width: 100%; color: #1e293b;
}

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 0.375rem; }
.page-btn {
  min-width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0.375rem; font-size: 0.875rem; font-weight: 500;
  border: 1px solid #e2e8f0; background: #fff; color: #64748b;
  cursor: pointer; text-decoration: none; transition: all .15s;
}
.page-btn:hover { border-color: #2f3484; color: #2f3484; }
.page-btn.active { background: #2f3484; color: #fff; border-color: #2f3484; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ─── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; }
.tab-btn {
  padding: 0.625rem 1rem; font-size: 0.875rem; font-weight: 500;
  color: #64748b; border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s; white-space: nowrap;
}
.tab-btn:hover { color: #334155; }
.tab-btn.active { color: #2f3484; border-bottom-color: #2f3484; }

/* ─── Checkbox / Radio ────────────────────────────────────────────────────── */
.checkbox-label { display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.875rem; cursor: pointer; user-select: none; }
.checkbox-label input[type=checkbox],
.checkbox-label input[type=radio] { width: 16px; height: 16px; accent-color: #2f3484; cursor: pointer; }

/* ─── Misc utilities ──────────────────────────────────────────────────────── */
/* Aliases for legacy class names used in admin pages */
.form-input  { display: block; width: 100%; padding: .5rem .75rem; font-size: .875rem;
  color: #1e293b; background-color: #fff; border: 1px solid #cbd5e1; border-radius: .5rem;
  transition: border-color .15s, box-shadow .15s; appearance: none; }
.form-input:focus { outline: none; border-color: #2f3484; box-shadow: 0 0 0 3px rgba(47,52,132,.12); }
.form-input::placeholder { color: #94a3b8; }
.form-label  { display: block; font-size: .875rem; font-weight: 500; color: #334155; margin-bottom: .25rem; }
.text-muted { color: #94a3b8; }
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.75rem; }
.font-mono  { font-family: 'Fira Code', 'Cascadia Code', monospace; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visually-hidden { position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0); }
.divider      { border: none; border-top: 1px solid #e2e8f0; margin: 1rem 0; }
