/* ============================================
   BLOGCAST.IO DESIGN SYSTEM
   Robinhood-Level Professional Polish
   ============================================ */

/* ============================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */
:root {
  /* Colors - Core Palette */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #151515;
  --bg-card: #161616;
  --bg-elevated: #1a1a1a;
  --bg-hover: #1e1e1e;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #707070;
  --text-disabled: #4a4a4a;

  /* Brand Accents */
  --accent-blue: #2563EB;
  --accent-blue-hover: #3B82F6;
  --accent-blue-glow: rgba(37, 99, 235, 0.25);
  --accent-blue-subtle: rgba(37, 99, 235, 0.1);

  --accent-lime: #84CC16;
  --accent-lime-hover: #9AE622;
  --accent-lime-glow: rgba(132, 204, 22, 0.25);
  --accent-lime-subtle: rgba(132, 204, 22, 0.1);

  --accent-violet: #8B5CF6;
  --accent-violet-hover: #A78BFA;
  --accent-violet-glow: rgba(139, 92, 246, 0.25);
  --accent-violet-subtle: rgba(139, 92, 246, 0.1);

  /* Semantic Colors */
  --color-success: #10B981;
  --color-success-hover: #34D399;
  --color-success-glow: rgba(16, 185, 129, 0.25);
  --color-success-subtle: rgba(16, 185, 129, 0.1);

  --color-error: #EF4444;
  --color-error-hover: #F87171;
  --color-error-glow: rgba(239, 68, 68, 0.25);
  --color-error-subtle: rgba(239, 68, 68, 0.1);

  --color-warning: #F59E0B;
  --color-warning-hover: #FBBF24;
  --color-warning-glow: rgba(245, 158, 11, 0.25);
  --color-warning-subtle: rgba(245, 158, 11, 0.1);

  --color-info: #3B82F6;
  --color-info-subtle: rgba(59, 130, 246, 0.1);

  /* Borders */
  --border-subtle: #1f1f1f;
  --border-default: #262626;
  --border-strong: #333333;
  --border-focus: var(--accent-blue);

  /* Gradients */
  --gradient-blue-violet: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-violet) 100%);
  --gradient-lime-blue: linear-gradient(135deg, var(--accent-lime) 0%, var(--accent-blue) 100%);
  --gradient-violet-lime: linear-gradient(135deg, var(--accent-violet) 0%, var(--accent-lime) 100%);
  --gradient-card-hover: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);

  /* ============================================
     2. SPACING (8px Base Grid)
     ============================================ */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* ============================================
     3. BORDER RADIUS
     ============================================ */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;
  --radius-full: 9999px;

  /* ============================================
     4. SHADOWS
     ============================================ */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.35);
  --shadow-2xl: 0 20px 40px rgba(0, 0, 0, 0.4);

  /* Glow Shadows (for hover states) */
  --shadow-glow-blue: 0 0 20px var(--accent-blue-glow), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow-lime: 0 0 20px var(--accent-lime-glow), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow-violet: 0 0 20px var(--accent-violet-glow), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow-success: 0 0 20px var(--color-success-glow), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow-error: 0 0 20px var(--color-error-glow), 0 8px 24px rgba(0, 0, 0, 0.3);

  /* Focus Ring */
  --shadow-focus: 0 0 0 3px var(--accent-blue-glow);
  --shadow-focus-error: 0 0 0 3px var(--color-error-glow);
  --shadow-focus-success: 0 0 0 3px var(--color-success-glow);

  /* ============================================
     5. TYPOGRAPHY
     ============================================ */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.8125rem;  /* 13px */
  --text-base: 0.875rem; /* 14px */
  --text-md: 0.9375rem;  /* 15px */
  --text-lg: 1rem;       /* 16px */
  --text-xl: 1.125rem;   /* 18px */
  --text-2xl: 1.25rem;   /* 20px */
  --text-3xl: 1.5rem;    /* 24px */
  --text-4xl: 1.875rem;  /* 30px */
  --text-5xl: 2.25rem;   /* 36px */
  --text-6xl: 3rem;      /* 48px */
  --text-7xl: 3.75rem;   /* 60px */

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 1.8;

  /* Letter Spacing */
  --tracking-tighter: -0.03em;
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.02em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* ============================================
     6. TRANSITIONS & ANIMATIONS
     ============================================ */
  --duration-instant: 50ms;
  --duration-fast: 100ms;
  --duration-normal: 150ms;
  --duration-moderate: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 400ms;
  --duration-slowest: 500ms;

  /* Easing Functions */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Common Transitions */
  --transition-colors: color var(--duration-normal) var(--ease-out), background-color var(--duration-normal) var(--ease-out), border-color var(--duration-normal) var(--ease-out);
  --transition-transform: transform var(--duration-moderate) var(--ease-out);
  --transition-shadow: box-shadow var(--duration-moderate) var(--ease-out);
  --transition-opacity: opacity var(--duration-normal) var(--ease-out);
  --transition-all: all var(--duration-moderate) var(--ease-out);

  /* ============================================
     7. Z-INDEX SCALE
     ============================================ */
  --z-below: -1;
  --z-base: 0;
  --z-raised: 10;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;
  --z-toast: 700;
  --z-max: 9999;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
}

/* Prevent horizontal scroll */
html, body {
  max-width: 100vw;
}

/* ============================================
   9. TYPOGRAPHY STYLES
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 { font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl)); }
h2 { font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl)); }
h3 { font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl)); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-colors);
}

/* ============================================
   10. FOCUS STATES (Accessibility)
   ============================================ */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Custom focus ring for interactive elements */
.focus-ring:focus-visible {
  box-shadow: var(--shadow-focus);
  border-color: var(--border-focus);
}

/* ============================================
   11. BUTTON SYSTEM
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-all);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

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

/* Button Sizes */
.btn-xs {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.btn-md {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
}

.btn-lg {
  padding: var(--space-4) var(--space-7);
  font-size: var(--text-lg);
}

.btn-xl {
  padding: var(--space-5) var(--space-8);
  font-size: var(--text-xl);
}

/* Button Variants */
.btn-primary {
  background: var(--accent-lime);
  color: var(--bg-primary);
  border-color: var(--accent-lime);
}

.btn-primary:hover {
  background: var(--accent-lime-hover);
  border-color: var(--accent-lime-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-lime);
}

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

.btn-secondary {
  background: transparent;
  color: var(--accent-lime);
  border-color: var(--accent-lime);
}

.btn-secondary:hover {
  background: var(--accent-lime);
  color: var(--bg-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-lime);
}

.btn-blue {
  background: var(--accent-blue);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.btn-blue:hover {
  background: var(--accent-blue-hover);
  border-color: var(--accent-blue-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-blue);
}

.btn-violet {
  background: var(--accent-violet);
  color: var(--text-primary);
  border-color: var(--accent-violet);
}

.btn-violet:hover {
  background: var(--accent-violet-hover);
  border-color: var(--accent-violet-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-violet);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--color-error);
  color: var(--text-primary);
  border-color: var(--color-error);
}

.btn-danger:hover {
  background: var(--color-error-hover);
  border-color: var(--color-error-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-error);
}

/* Button with Icon */
.btn-icon {
  padding: var(--space-3);
}

.btn-icon.btn-sm {
  padding: var(--space-2);
}

.btn-icon.btn-lg {
  padding: var(--space-4);
}

/* Loading Button State */
.btn-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

.btn-primary.btn-loading::after {
  border-color: var(--bg-primary);
  border-top-color: transparent;
}

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

/* Button Full Width */
.btn-full {
  width: 100%;
}

/* ============================================
   12. INPUT SYSTEM
   ============================================ */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: var(--transition-all);
}

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

.input:hover {
  border-color: var(--border-strong);
}

.input:focus {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-focus);
  outline: none;
}

/* Input Sizes */
.input-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.input-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
}

/* Input States */
.input-error {
  border-color: var(--color-error);
}

.input-error:focus {
  border-color: var(--color-error);
  box-shadow: var(--shadow-focus-error);
}

.input-success {
  border-color: var(--color-success);
}

.input-success:focus {
  border-color: var(--color-success);
  box-shadow: var(--shadow-focus-success);
}

/* Input Group */
.input-group {
  position: relative;
  display: flex;
  gap: var(--space-3);
}

.input-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon {
  padding-left: var(--space-10);
}

/* Form Label */
.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

/* Form Helper/Error Text */
.form-helper {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-success {
  font-size: var(--text-xs);
  color: var(--color-success);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ============================================
   13. CARD SYSTEM
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: var(--transition-all);
}

.card-hoverable {
  cursor: pointer;
}

.card-hoverable:hover {
  transform: translateY(-4px);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow-blue);
}

.card-elevated {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}

.card-featured {
  background: var(--gradient-blue-violet);
  border: none;
}

/* Card Sections */
.card-header {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-default);
  margin-bottom: var(--space-4);
}

.card-footer {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-default);
  margin-top: var(--space-4);
}

/* ============================================
   14. BADGE SYSTEM
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.badge-primary {
  background: var(--accent-lime-subtle);
  color: var(--accent-lime);
}

.badge-blue {
  background: var(--accent-blue-subtle);
  color: var(--accent-blue);
}

.badge-violet {
  background: var(--accent-violet-subtle);
  color: var(--accent-violet);
}

.badge-success {
  background: var(--color-success-subtle);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
}

.badge-error {
  background: var(--color-error-subtle);
  color: var(--color-error);
}

.badge-neutral {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* ============================================
   15. TOAST NOTIFICATION SYSTEM
   ============================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  animation: toast-slide-in var(--duration-slow) var(--ease-spring);
  max-width: 400px;
}

.toast-success {
  border-color: var(--color-success);
  background: linear-gradient(135deg, var(--color-success-subtle) 0%, var(--bg-elevated) 100%);
}

.toast-error {
  border-color: var(--color-error);
  background: linear-gradient(135deg, var(--color-error-subtle) 0%, var(--bg-elevated) 100%);
}

.toast-warning {
  border-color: var(--color-warning);
  background: linear-gradient(135deg, var(--color-warning-subtle) 0%, var(--bg-elevated) 100%);
}

.toast-info {
  border-color: var(--accent-blue);
  background: linear-gradient(135deg, var(--accent-blue-subtle) 0%, var(--bg-elevated) 100%);
}

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

.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-error); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--accent-blue); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.toast-close {
  flex-shrink: 0;
  padding: var(--space-1);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-colors);
}

.toast-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-exit {
  animation: toast-slide-out var(--duration-moderate) var(--ease-in) forwards;
}

@keyframes toast-slide-out {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ============================================
   16. SKELETON LOADING
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    var(--bg-hover) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 60%;
}

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

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   17. PROGRESS BAR
   ============================================ */
.progress {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-lime-blue);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

.progress-indeterminate .progress-bar {
  width: 30%;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ============================================
   18. DROPDOWN MENU
   ============================================ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-2) 0;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-all);
  z-index: var(--z-dropdown);
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-colors);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-2) 0;
}

/* ============================================
   19. MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-opacity);
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-2xl);
  transform: scale(0.95) translateY(20px);
  transition: transform var(--duration-slow) var(--ease-spring);
}

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

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

.modal-title {
  font-size: var(--text-xl);
  font-weight: 600;
}

.modal-close {
  padding: var(--space-2);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition-colors);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-default);
  background: var(--bg-secondary);
}

/* ============================================
   20. TOOLTIP
   ============================================ */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-opacity);
  z-index: var(--z-tooltip);
}

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

/* ============================================
   21. UTILITY CLASSES
   ============================================ */

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flexbox */
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Text */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: var(--tracking-wide); }

/* Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-lime { color: var(--accent-lime); }
.text-blue { color: var(--accent-blue); }
.text-violet { color: var(--accent-violet); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }

/* Background */
.bg-primary { background: var(--bg-primary); }
.bg-secondary { background: var(--bg-secondary); }
.bg-card { background: var(--bg-card); }

/* Spacing */
.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Border */
.border { border: 1px solid var(--border-default); }
.border-0 { border: none; }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Width */
.w-full { width: 100%; }
.max-w-sm { max-width: 384px; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 512px; }
.max-w-xl { max-width: 576px; }
.max-w-2xl { max-width: 672px; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Transitions */
.transition { transition: var(--transition-all); }
.transition-colors { transition: var(--transition-colors); }
.transition-transform { transition: var(--transition-transform); }

/* ============================================
   22. ANIMATIONS
   ============================================ */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

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

.animate-fade-in { animation: fade-in var(--duration-moderate) var(--ease-out); }
.animate-fade-in-up { animation: fade-in-up var(--duration-slow) var(--ease-out); }
.animate-fade-in-down { animation: fade-in-down var(--duration-slow) var(--ease-out); }
.animate-scale-in { animation: scale-in var(--duration-slow) var(--ease-spring); }
.animate-pulse { animation: pulse 2s var(--ease-in-out) infinite; }
.animate-bounce { animation: bounce 1s infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* Staggered animations for lists */
.stagger-children > * {
  opacity: 0;
  animation: fade-in-up var(--duration-slow) var(--ease-out) forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.stagger-children > *:nth-child(8) { animation-delay: 350ms; }
.stagger-children > *:nth-child(9) { animation-delay: 400ms; }
.stagger-children > *:nth-child(10) { animation-delay: 450ms; }

/* ============================================
   23. CONTAINER
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }
.container-xl { max-width: 1280px; }

/* ============================================
   24. RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 1024px) {
  .lg\:hidden { display: none; }
}

@media (max-width: 768px) {
  .md\:hidden { display: none; }
  .md\:flex-col { flex-direction: column; }
  .md\:text-center { text-align: center; }

  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

@media (max-width: 480px) {
  .sm\:hidden { display: none; }
  .sm\:flex-col { flex-direction: column; }
  .sm\:w-full { width: 100%; }
  .sm\:text-center { text-align: center; }
}
