/* ============================================================
   ExcellStudy Platform — Design System CSS
   Version: 1.0.0
   Comprehensive design tokens, component classes, animations,
   and utility styles for the ExcellStudy EdTech platform.
   ============================================================ */

/* ------------------------------------------------------------
   1. DESIGN TOKENS (CSS Custom Properties)
   ------------------------------------------------------------ */
:root {
  /* Primary palette */
  --primary: #534AB7;
  --primary-light: #6B63C7;
  --primary-dark: #3D3590;
  --primary-rgb: 83, 74, 183;

  /* Accent palette */
  --accent: #1D9E75;
  --accent-light: #25C290;
  --accent-rgb: 29, 158, 117;

  /* Highlight palette */
  --highlight: #BA7517;
  --highlight-light: #D4891E;

  /* Error palette */
  --error: #E05252;
  --error-light: #F07070;

  /* Backgrounds */
  --bg: #F8F7FF;
  --bg-card: #FFFFFF;
  --bg-dark: #1A1A2E;

  /* Text */
  --text-primary: #1A1A2E;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;

  /* Borders */
  --border: #E5E4F0;
  --border-light: #F0EFF5;

  /* Elevation */
  --shadow: 0 2px 12px rgba(83, 74, 183, 0.08);
  --shadow-hover: 0 8px 24px rgba(83, 74, 183, 0.15);
  --shadow-lg: 0 12px 40px rgba(83, 74, 183, 0.12);

  /* Border radii */
  --radius-card: 12px;
  --radius-input: 8px;
  --radius-pill: 20px;
  --radius-circle: 50%;

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Font sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
}

/* ------------------------------------------------------------
   2. RESET & BASE STYLES
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--primary-rgb), 0.25);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--primary-rgb), 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--primary-rgb), 0.25) var(--border-light);
}

/* ------------------------------------------------------------
   3. TYPOGRAPHY
   ------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

.text-muted { color: var(--text-muted); }
.text-primary-color { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-error { color: var(--error); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ------------------------------------------------------------
   4. CARD COMPONENT
   ------------------------------------------------------------ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.card--flat:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.card--primary {
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--primary), var(--primary-light)) 1;
  border-image-slice: 1;
}

.card--accent {
  border-left: 4px solid var(--accent);
}

.card--highlight {
  border-left: 4px solid var(--highlight);
}

.card--error {
  border-left: 4px solid var(--error);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card__title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.card__body {
  color: var(--text-secondary);
}

.card__footer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ------------------------------------------------------------
   5. BUTTON COMPONENT
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: var(--radius-input);
  font-family: 'Inter', sans-serif;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary {
  background: var(--primary);
  color: #FFFFFF;
}

.btn--primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}

.btn--accent {
  background: var(--accent);
  color: #FFFFFF;
}

.btn--accent:hover {
  background: #178A65;
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.35);
}

.btn--ghost {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn--ghost:hover {
  background: var(--primary);
  color: #FFFFFF;
}

.btn--danger {
  background: var(--error);
  color: #FFFFFF;
}

.btn--danger:hover {
  background: #C83E3E;
  box-shadow: 0 4px 14px rgba(224, 82, 82, 0.35);
}

.btn--outline-danger {
  background: transparent;
  border-color: var(--error);
  color: var(--error);
}

.btn--outline-danger:hover {
  background: var(--error);
  color: #FFFFFF;
}

.btn--pill {
  border-radius: var(--radius-pill);
}

.btn--sm {
  padding: 6px 14px;
  font-size: var(--text-xs);
}

.btn--lg {
  padding: 14px 28px;
  font-size: var(--text-base);
}

.btn--block {
  width: 100%;
}

.btn--icon {
  padding: 10px;
  border-radius: var(--radius-input);
}

.btn__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: var(--radius-circle);
  animation: spin 0.6s linear infinite;
}

/* ------------------------------------------------------------
   6. BADGE & PILL
   ------------------------------------------------------------ */
.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.badge--live {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}

.badge--live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-circle);
  background: var(--accent);
  animation: pulse 2s infinite;
}

.badge--pending {
  background: rgba(186, 117, 23, 0.12);
  color: var(--highlight);
}

.badge--rejected {
  background: rgba(224, 82, 82, 0.12);
  color: var(--error);
}

.badge--neutral {
  background: var(--border-light);
  color: var(--text-secondary);
}

.pill {
  background: var(--border-light);
  color: var(--text-secondary);
}

.pill--primary {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.pill--accent {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}

/* ------------------------------------------------------------
   7. FORM ELEMENTS
   ------------------------------------------------------------ */
.input,
.textarea,
.select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  font-family: 'Inter', sans-serif;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: var(--transition-fast);
  outline: none;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}

.input--error,
.textarea--error {
  border-color: var(--error);
}

.input--error:focus,
.textarea--error:focus {
  box-shadow: 0 0 0 3px rgba(224, 82, 82, 0.12);
}

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

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.form-hint {
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-error {
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--error);
}

/* Checkbox / Toggle */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

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

.toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #FFFFFF;
  border-radius: var(--radius-circle);
  transition: var(--transition);
}

.toggle input:checked + .toggle__slider {
  background: var(--primary);
}

.toggle input:checked + .toggle__slider::before {
  transform: translateX(20px);
}

/* ------------------------------------------------------------
   8. PROGRESS BAR
   ------------------------------------------------------------ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressFill 1s ease-out;
}

.progress-bar--green .progress-bar__fill {
  background: var(--accent);
}

.progress-bar--amber .progress-bar__fill {
  background: var(--highlight);
}

.progress-bar--red .progress-bar__fill {
  background: var(--error);
}

.progress-bar--lg {
  height: 12px;
}

.progress-bar--striped .progress-bar__fill {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
  animation: shimmer 1s linear infinite;
}

/* ------------------------------------------------------------
   9. TOAST NOTIFICATIONS
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: 14px 18px;
  border-radius: var(--radius-card);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  min-width: 320px;
  max-width: 480px;
  animation: slideInRight 0.3s ease-out;
  transition: var(--transition);
}

.toast--success {
  border-left-color: var(--accent);
}

.toast--error {
  border-left-color: var(--error);
}

.toast--warning {
  border-left-color: var(--highlight);
}

.toast--info {
  border-left-color: var(--primary);
}

.toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.toast__content {
  flex: 1;
}

.toast__title {
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: 2px;
}

.toast__message {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.toast__close:hover {
  color: var(--text-primary);
}

.toast--exit {
  animation: slideOutRight 0.3s ease-in forwards;
}

/* ------------------------------------------------------------
   10. SIDEBAR NAVIGATION
   ------------------------------------------------------------ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: width 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar--collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar__logo {
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

.sidebar__nav {
  flex: 1;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__section {
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
  padding-left: var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-input);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar__item:hover {
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--primary);
}

.sidebar__item--active {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-weight: 600;
}

.sidebar__item--active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.sidebar__item__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar__footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border-light);
}

/* ------------------------------------------------------------
   11. TABLE
   ------------------------------------------------------------ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-light);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table thead th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.03);
}

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

/* ------------------------------------------------------------
   12. CODE BLOCK
   ------------------------------------------------------------ */
.code-block {
  position: relative;
  background: var(--bg-dark);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: #E0DEF4;
}

.code-block__copy {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  padding: 6px 10px;
  border-radius: var(--radius-input);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  transition: var(--transition-fast);
  opacity: 0;
}

.code-block:hover .code-block__copy {
  opacity: 1;
}

.code-block__copy:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
}

.code-block__lang {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-md);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ------------------------------------------------------------
   13. AVATAR
   ------------------------------------------------------------ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-circle);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #FFFFFF;
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm {
  width: 28px;
  height: 28px;
  font-size: var(--text-xs);
}

.avatar--lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-lg);
}

.avatar--xl {
  width: 80px;
  height: 80px;
  font-size: var(--text-2xl);
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-card);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ------------------------------------------------------------
   14. DROPDOWN
   ------------------------------------------------------------ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  padding: var(--space-xs);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-fast);
}

.dropdown--open .dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  border-radius: var(--radius-input);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown__item:hover {
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--primary);
}

.dropdown__divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-xs) 0;
}

/* ------------------------------------------------------------
   15. MODAL
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay--active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
}

.modal-overlay--active .modal {
  transform: scale(1) translateY(0);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  transition: var(--transition-fast);
  border-radius: var(--radius-input);
}

.modal__close:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.modal__body {
  padding: var(--space-lg);
}

.modal__footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ------------------------------------------------------------
   16. STEPPER
   ------------------------------------------------------------ */
.stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stepper__step {
  display: flex;
  gap: var(--space-md);
  position: relative;
  padding-bottom: var(--space-lg);
}

.stepper__step:last-child {
  padding-bottom: 0;
}

/* Connecting line */
.stepper__step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.stepper__step--passed:not(:last-child)::before {
  background: var(--accent);
}

.stepper__step--running:not(:last-child)::before {
  background: linear-gradient(to bottom, var(--highlight), var(--border));
}

.stepper__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-sm);
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  z-index: 1;
}

.stepper__step--passed .stepper__icon {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.stepper__step--running .stepper__icon {
  background: var(--highlight);
  border-color: var(--highlight);
  color: #FFFFFF;
  animation: pulse 2s infinite;
}

.stepper__step--failed .stepper__icon {
  background: var(--error);
  border-color: var(--error);
  color: #FFFFFF;
}

.stepper__content {
  flex: 1;
  padding-top: 4px;
}

.stepper__title {
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: 2px;
}

.stepper__description {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.stepper__log {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-dark);
  border-radius: var(--radius-input);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-xs);
  color: #E0DEF4;
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ------------------------------------------------------------
   17. GRID UTILITIES
   ------------------------------------------------------------ */
.grid {
  display: grid;
  gap: var(--space-lg);
}

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

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

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

.grid--auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.flex {
  display: flex;
}

.flex--center {
  align-items: center;
  justify-content: center;
}

.flex--between {
  align-items: center;
  justify-content: space-between;
}

.flex--col {
  flex-direction: column;
}

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ------------------------------------------------------------
   18. SPACING UTILITIES
   ------------------------------------------------------------ */
.m-0 { margin: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* ------------------------------------------------------------
   19. LAYOUT UTILITIES
   ------------------------------------------------------------ */
.page-content {
  margin-left: var(--sidebar-width);
  padding: var(--space-xl);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.sidebar--collapsed ~ .page-content {
  margin-left: var(--sidebar-collapsed-width);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1440px;
}

/* Visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, #E0DFF0 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-input);
}

.skeleton--text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton--title {
  height: 20px;
  margin-bottom: 12px;
  width: 50%;
}

.skeleton--circle {
  border-radius: var(--radius-circle);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--space-lg) 0;
}

/* Tag / Chip */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--border-light);
  color: var(--text-secondary);
}

.tag__remove {
  cursor: pointer;
  opacity: 0.5;
  transition: var(--transition-fast);
}

.tag__remove:hover {
  opacity: 1;
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: var(--radius-input);
  background: var(--bg-dark);
  color: #FFFFFF;
  font-size: var(--text-xs);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-fast);
  pointer-events: none;
  z-index: 100;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ------------------------------------------------------------
   20. KEYFRAME ANIMATIONS
   ------------------------------------------------------------ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes progressFill {
  from { width: 0; }
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

/* ------------------------------------------------------------
   21. ANIMATION UTILITY CLASSES
   ------------------------------------------------------------ */
.animate-fade-in {
  animation: fadeIn 0.5s ease-out both;
}

.animate-slide-in {
  animation: slideIn 0.5s ease-out both;
}

.animate-slide-up {
  animation: slideUp 0.5s ease-out both;
}

.animate-bounce-in {
  animation: bounceIn 0.5s ease-out both;
}

.animate-shake {
  animation: shake 0.4s ease-in-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* Stagger delays for sequential animations */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ------------------------------------------------------------
   22. HORIZONTAL SCROLL CONTAINER
   ------------------------------------------------------------ */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-sm);
}

.scroll-x::-webkit-scrollbar {
  height: 4px;
}

.scroll-x::-webkit-scrollbar-thumb {
  background: rgba(var(--primary-rgb), 0.2);
  border-radius: 2px;
}

/* ------------------------------------------------------------
   23. RESPONSIVE BREAKPOINTS
   ------------------------------------------------------------ */
@media (max-width: 1200px) {
  .grid--4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-content {
    margin-left: 0;
    padding: var(--space-lg);
  }

  .sidebar {
    transform: translateX(-100%);
    z-index: 1000;
  }

  .sidebar--mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 768px) {
  :root {
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
  }

  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }

  .card {
    padding: var(--space-md);
  }

  .modal {
    width: 95%;
    max-height: 90vh;
  }

  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
  }

  .toast {
    min-width: auto;
  }

  .hide-mobile {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .page-content {
    padding: var(--space-md);
  }

  .btn--lg {
    padding: 12px 20px;
    font-size: var(--text-sm);
  }
}

/* ------------------------------------------------------------
   24. PRINT STYLES
   ------------------------------------------------------------ */
@media print {
  body {
    background: #FFFFFF;
    color: #000000;
    font-size: 12pt;
  }

  .sidebar,
  .toast-container,
  .btn,
  .modal-overlay {
    display: none !important;
  }

  .page-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #DDD;
    break-inside: avoid;
  }

  a {
    color: #000000;
    text-decoration: underline;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #555;
  }

  .code-block {
    background: #F5F5F5;
    color: #000000;
    border: 1px solid #DDD;
  }
}
