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

:root {
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-50: #eff6ff;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --purple-600: #9333ea;
  --purple-100: #f3e8ff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--slate-800);
  background: var(--slate-50);
  line-height: 1.5;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Auth View */
#auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--slate-900) 100%);
}

.auth-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--slate-900);
  text-align: center;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--slate-500);
  margin-bottom: 24px;
  font-size: 14px;
}

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--slate-200);
}

.tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab.active {
  color: var(--blue-600);
  border-bottom-color: var(--blue-600);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-card input {
  padding: 10px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.auth-card input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-card button[type="submit"] {
  padding: 10px;
  background: var(--blue-600);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.auth-card button[type="submit"]:hover {
  background: var(--blue-700);
}

.error {
  background: var(--red-100);
  color: var(--red-600);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 8px;
}

/* Dashboard Layout */
#dashboard-view {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--slate-900);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--slate-700);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-header .school-name {
  font-size: 13px;
  color: var(--slate-400);
  display: block;
  margin-top: 4px;
}

.nav-list {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--slate-400);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
}

.nav-list a:hover {
  color: white;
  background: var(--slate-800);
}

.nav-list a.active {
  color: white;
  background: var(--slate-800);
}

.nav-list .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 16px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--slate-700);
}

#logout-btn {
  background: none;
  border: none;
  color: var(--slate-400);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

#logout-btn:hover {
  color: white;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--slate-900);
}

.page-header p {
  color: var(--slate-500);
  font-size: 14px;
  margin-top: 4px;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 13px;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 700;
  color: var(--slate-900);
  margin-top: 4px;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Config Block */
.config-block {
  background: var(--slate-900);
  color: var(--slate-100);
  border-radius: var(--radius);
  padding: 16px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  position: relative;
}

.config-block .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--slate-700);
  border: none;
  color: var(--slate-300);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.config-block .copy-btn:hover {
  background: var(--slate-600);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--blue-600);
  color: white;
}

.btn-primary:hover {
  background: var(--blue-700);
}

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
}

.btn-secondary:hover {
  background: var(--slate-200);
}

.btn-danger {
  background: none;
  color: var(--red-600);
  padding: 4px 8px;
  font-size: 13px;
}

.btn-danger:hover {
  background: var(--red-100);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--slate-200);
}

.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--slate-100);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-green {
  background: var(--green-100);
  color: var(--green-600);
}

.badge-amber {
  background: var(--amber-100);
  color: var(--amber-600);
}

.badge-red {
  background: var(--red-100);
  color: var(--red-600);
}

.badge-purple {
  background: var(--purple-100);
  color: var(--purple-600);
}

.badge-slate {
  background: var(--slate-100);
  color: var(--slate-600);
}

/* Toggle */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--slate-300);
  border-radius: 11px;
  transition: background 0.2s;
}

.toggle .slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .slider {
  background: var(--green-600);
}

.toggle input:checked + .slider::before {
  transform: translateX(18px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
}

.modal h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-600);
}

.form-group input,
.form-group select {
  padding: 8px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group .help-text {
  font-size: 12px;
  color: var(--slate-400);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* Content list */
.content-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-100);
}

.content-item:last-child {
  border-bottom: none;
}

.content-item .item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.content-item .item-title {
  font-weight: 600;
  font-size: 15px;
}

.content-item .item-body {
  color: var(--slate-600);
  font-size: 14px;
  line-height: 1.5;
}

.content-item .item-meta {
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 6px;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.filter-bar select {
  padding: 6px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  font-size: 14px;
  background: white;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--slate-400);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}

/* Info box */
.info-box {
  background: var(--blue-50);
  border: 1px solid var(--blue-600);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--slate-700);
  margin-bottom: 16px;
}
