/* ════════════════════════════════════════════════════════════
   add-class.css  |  EduTrack – Class Management
   Dark industrial aesthetic · Syne + DM Mono
═══════════════════════════════════════════════════════════════ */

/* ── Design tokens ─────────────────────────────────────── */
:root {
  --bg:          #0a0b0f;
  --bg-2:        #111318;
  --bg-3:        #181c24;
  --border:      #252a36;
  --border-hi:   #3a4255;
  --accent:      #4f8ef7;
  --accent-dim:  #1e3a6e;
  --accent-glow: rgba(79,142,247,.18);
  --danger:      #e05c5c;
  --danger-dim:  #5a1a1a;
  --success:     #4ecb7a;
  --warn:        #f5a623;
  --text-1:      #e8eaf0;
  --text-2:      #8a8fa8;
  --text-3:      #555a70;
  --mono:        'DM Mono', monospace;
  --sans:        'Syne', sans-serif;
  --radius:      10px;
  --sidebar-w:   240px;
  --transition:  200ms ease;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
svg { fill: currentColor; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input  { font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0 24px;
  z-index: 100;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 28px;
  border-bottom: 1px solid var(--border);
}
.sidebar__logo-icon { font-size: 1.5rem; }
.sidebar__logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--text-1);
}

.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 12px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: .875rem;
  font-weight: 600;
  transition: var(--transition);
}
.sidebar__link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar__link:hover { background: var(--bg-3); color: var(--text-1); }
.sidebar__link--active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--danger);
  font-size: .875rem;
  font-weight: 600;
  transition: var(--transition);
}
.sidebar__logout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar__logout:hover { background: var(--danger-dim); }

/* ── Main ──────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px;
  max-width: 1200px;
}

/* ── Page header ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
}
.page-header__eyebrow {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 6px;
}
.page-header__title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.01em;
}

.badge {
  display: inline-flex;
  align-items: center;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  color: var(--accent);
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  letter-spacing: .06em;
}

/* ── Content grid ──────────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

/* ── Card ──────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}
.card__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: 24px;
  color: var(--text-1);
}

/* ── Form ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: .9375rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input::placeholder { color: var(--text-3); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(224,92,92,.15); }
.form-hint {
  display: block;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-3);
  margin-top: 5px;
}

/* ── Preview pill ──────────────────────────────────────── */
.preview-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-3);
  border: 1px dashed var(--border-hi);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
}
.preview-pill__label {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.preview-pill__value {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
}

/* ── Form actions ──────────────────────────────────────── */
.form-actions { display: flex; gap: 10px; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: var(--radius);
  transition: all var(--transition);
  letter-spacing: .02em;
}
.btn svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  flex: 1;
  justify-content: center;
}
.btn--primary:hover { background: #6ba3f8; box-shadow: 0 4px 20px rgba(79,142,247,.35); }
.btn--primary:active { transform: scale(.97); }
.btn--ghost {
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn--ghost:hover { border-color: var(--border-hi); color: var(--text-1); }
.btn--danger {
  background: var(--danger);
  color: #fff;
}
.btn--danger:hover { background: #e87070; }
.btn--icon {
  padding: 7px;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
}
.btn--icon:hover { background: var(--bg-3); color: var(--text-1); }
.btn--icon.edit:hover { color: var(--accent); }
.btn--icon.delete:hover { color: var(--danger); }
.btn--sm { font-size: .8rem; padding: 7px 14px; }

/* ── List card header ──────────────────────────────────── */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.list-header .card__title { margin-bottom: 0; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 10px;
  width: 15px; height: 15px;
  fill: none; stroke: var(--text-3);
  stroke-width: 2; stroke-linecap: round;
}
.search-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  font-size: .85rem;
  padding: 8px 12px 8px 32px;
  width: 200px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { border-color: var(--accent); }

/* ── State boxes ───────────────────────────────────────── */
.state-box {
  padding: 32px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--text-2);
  font-size: .9rem;
}
.state-box--hidden { display: none; }
.empty-icon { font-size: 2.5rem; }

/* Skeleton */
.skeleton-row {
  width: 100%;
  height: 44px;
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
  margin-bottom: 8px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Table ─────────────────────────────────────────────── */
.class-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.class-table th {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.class-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
.class-table tr:last-child td { border-bottom: none; }
.class-table tbody tr {
  transition: background var(--transition);
}
.class-table tbody tr:hover { background: var(--bg-3); }

/* Row index */
.row-idx {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-3);
}

/* Class label chip */
.class-chip {
  display: inline-flex;
  align-items: center;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 500;
  padding: 4px 10px;
  letter-spacing: .04em;
}

/* Date */
.date-cell {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-2);
}

/* Action buttons group */
.action-group { display: flex; gap: 4px; }

/* ── Toast ─────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: .875rem;
  padding: 13px 18px;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  animation: toast-in .25s ease;
}
.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--danger);  }
.toast--warn    { border-left-color: var(--warn);    }
.toast__icon { font-size: 1.1rem; flex-shrink: 0; }
@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  transform: scale(.95);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal__icon { font-size: 2.5rem; margin-bottom: 12px; }
.modal__title { font-size: 1.25rem; font-weight: 700; margin-bottom: 12px; }
.modal__body { color: var(--text-2); font-size: .9rem; line-height: 1.65; margin-bottom: 28px; }
.modal__body strong { color: var(--text-1); }
.modal__actions { display: flex; gap: 10px; justify-content: center; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1000px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
  .main { padding: 28px 24px; }
}

@media (max-width: 700px) {
  .sidebar {
    width: 64px;
    padding: 20px 0;
  }
  .sidebar__logo-text,
  .sidebar__link span,
  .sidebar__logout span { display: none; }
  .sidebar__logo { padding: 0 0 20px; justify-content: center; }
  .sidebar__nav  { padding: 16px 8px; }
  .sidebar__link { justify-content: center; padding: 10px; }
  .sidebar__logout { justify-content: center; padding: 10px; margin: 0 8px; }
  .main { margin-left: 64px; padding: 20px 16px; }
  .page-header { flex-direction: column; gap: 12px; }
  .list-header { flex-direction: column; align-items: flex-start; }
  .search-input { width: 100%; }
  .class-table { font-size: .8rem; }
  .class-table th:nth-child(5),
  .class-table td:nth-child(5) { display: none; }
}
