/**
 * ═══════════════════════════════════════════════════════════════
 * 📄 FICHIER: main.css
 * 📂 CHEMIN: /assets/css/main.css
 * 🎯 UTILITÉ: Système de design unifié pour tout le site
 * 🎨 STYLE: Modern & Minimal (Apple/Vercel inspired)
 * 📱 RESPONSIVE: Mobile-first approach
 * 🌙 THEMES: Support Dark/Light mode
 * ⚡ PERFORMANCE: Optimisé avec CSS moderne
 * ═══════════════════════════════════════════════════════════════
 */

/* ========================================
   VARIABLES & DESIGN TOKENS
   ======================================== */

:root {
  /* Nouvelle palette moderne */
  --primary: #0066ff;
  --primary-dark: #0052cc;
  --primary-light: #3384ff;
  --primary-alpha: rgba(0, 102, 255, 0.1);

  --secondary: #7928ca;
  --secondary-dark: #6020a0;
  --secondary-light: #9945ff;

  --success: #00d46a;
  --warning: #ffb800;
  --danger: #ff3838;
  --info: #00a9ff;

  /* Neutral colors - Light mode */
  --bg-primary: #ffffff;
  --bg-secondary: #fafbfc;
  --bg-tertiary: #f6f8fa;
  --bg-card: #ffffff;
  --bg-hover: #f0f3f5;

  --text-primary: #0a0d14;
  --text-secondary: #57606a;
  --text-tertiary: #8b92a1;
  --text-inverse: #ffffff;

  --border-primary: #e1e4e8;
  --border-secondary: #d0d7de;
  --border-focus: var(--primary);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.12);
  --shadow-2xl: 0 24px 48px rgba(0, 0, 0, 0.14);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;

  --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;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index Scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;
  --z-toast: 700;
  --z-max: 9999;

  /* Breakpoints for CSS */
  --screen-sm: 640px;
  --screen-md: 768px;
  --screen-lg: 1024px;
  --screen-xl: 1280px;
  --screen-2xl: 1536px;
}

/* Dark Mode Variables */
[data-theme='dark'] {
  --primary: #3384ff;
  --primary-dark: #0066ff;
  --primary-light: #5299ff;
  --primary-alpha: rgba(51, 132, 255, 0.1);

  --secondary: #9945ff;
  --secondary-dark: #7928ca;
  --secondary-light: #b266ff;

  --bg-primary: #0a0d14;
  --bg-secondary: #0f1319;
  --bg-tertiary: #151922;
  --bg-card: #1a1f2c;
  --bg-hover: #202632;

  --text-primary: #f0f3f5;
  --text-secondary: #a8b2c1;
  --text-tertiary: #6b7280;
  --text-inverse: #0a0d14;

  --border-primary: #2d333f;
  --border-secondary: #373e4d;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.6);
  --shadow-2xl: 0 24px 48px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100%;
  transition: background-color var(--transition-base),
    color var(--transition-base);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: var(--font-bold);
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(var(--text-xl), 3vw, var(--text-3xl));
  letter-spacing: -0.015em;
}

h4 {
  font-size: clamp(var(--text-lg), 2.5vw, var(--text-2xl));
}

h5 {
  font-size: var(--text-xl);
}

h6 {
  font-size: var(--text-lg);
}

p {
  margin-bottom: var(--space-md);
  line-height: var(--leading-relaxed);
}

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

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

strong {
  font-weight: var(--font-semibold);
}

small {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.125rem 0.25rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--primary);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-lg);
}

/* ========================================
   LAYOUT COMPONENTS
   ======================================== */

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

@media (min-width: 640px) {
  .container {
    padding: 0 var(--space-xl);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-2xl);
  }
}

.section {
  padding: var(--space-3xl) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-4xl) 0;
  }
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-lg);
}

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

@media (min-width: 640px) {
  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .sm\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .sm\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Flexbox Utilities */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.flex-row {
  flex-direction: row;
}
.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-sm {
  gap: var(--space-sm);
}
.gap-md {
  gap: var(--space-md);
}
.gap-lg {
  gap: var(--space-lg);
}

/* ========================================
   CARDS
   ======================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

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

.card:hover::before {
  transform: scaleX(1);
}

.card-header {
  margin-bottom: var(--space-lg);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.card-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.card-body {
  margin-bottom: var(--space-lg);
}

.card-footer {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  text-decoration: none;
  outline: none;
}

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

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

/* Button Variants */
.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-secondary);
}

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

.btn-ghost:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #e63333;
}

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

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--text-base);
}

.btn-xl {
  padding: 1rem 2rem;
  font-size: var(--text-lg);
}

/* Button States */
.btn-loading {
  position: relative;
  color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid white;
  border-radius: 50%;
  border-right-color: transparent;
  animation: spin 0.6s linear infinite;
}

/* Icon Button */
.btn-icon {
  padding: 0.625rem;
  width: 2.5rem;
  height: 2.5rem;
}

.btn-icon.btn-sm {
  padding: 0.5rem;
  width: 2rem;
  height: 2rem;
}

.btn-icon.btn-lg {
  padding: 0.75rem;
  width: 3rem;
  height: 3rem;
}

/* ========================================
   FORMS
   ======================================== */

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

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

.form-label-required::after {
  content: '*';
  color: var(--danger);
  margin-left: var(--space-xs);
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-control:hover {
  border-color: var(--border-secondary);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

.form-control:disabled {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

/* Textarea */
textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Select */
select.form-control {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23637381' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-md);
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: var(--space-sm);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.form-check-input[type='radio'] {
  border-radius: var(--radius-full);
}

.form-check-input:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

/* Form Validation */
.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(255, 56, 56, 0.1);
}

.form-control.is-valid {
  border-color: var(--success);
}

.form-control.is-valid:focus {
  box-shadow: 0 0 0 3px rgba(0, 212, 106, 0.1);
}

.form-text {
  display: block;
  margin-top: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

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

/* ========================================
   NAVIGATION
   ======================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(var(--bg-primary-rgb), 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-primary);
  transition: all var(--transition-base);
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 var(--space-lg);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-logo {
  width: 32px;
  height: 32px;
}

.navbar-nav {
  display: none;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

@media (min-width: 768px) {
  .navbar-nav {
    display: flex;
  }
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

/* Mobile Menu */
.navbar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .navbar-toggle {
    display: none;
  }
}

.mobile-menu {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  transform: translateX(-100%);
  transition: transform var(--transition-base);
  z-index: var(--z-modal);
  padding: var(--space-xl);
  overflow-y: auto;
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-menu .nav-link {
  display: block;
  padding: var(--space-md) 0;
  font-size: var(--text-base);
}

/* ========================================
   BADGES & TAGS
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.25rem 0.625rem;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: 1;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.badge-primary {
  background: var(--primary-alpha);
  color: var(--primary);
}

.badge-success {
  background: rgba(0, 212, 106, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 184, 0, 0.1);
  color: var(--warning);
}

.badge-danger {
  background: rgba(255, 56, 56, 0.1);
  color: var(--danger);
}

.badge-info {
  background: rgba(0, 169, 255, 0.1);
  color: var(--info);
}

.badge-dark {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.375rem 0.75rem;
  font-size: var(--text-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.tag:hover {
  background: var(--bg-hover);
  border-color: var(--border-secondary);
}

.tag.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ========================================
   ALERTS & TOASTS
   ======================================== */

.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  animation: slideDown var(--transition-base) ease;
}

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

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-xs);
}

.alert-message {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.alert-success {
  background: rgba(0, 212, 106, 0.1);
  color: var(--success);
  border: 1px solid rgba(0, 212, 106, 0.2);
}

.alert-warning {
  background: rgba(255, 184, 0, 0.1);
  color: var(--warning);
  border: 1px solid rgba(255, 184, 0, 0.2);
}

.alert-danger {
  background: rgba(255, 56, 56, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 56, 56, 0.2);
}

.alert-info {
  background: rgba(0, 169, 255, 0.1);
  color: var(--info);
  border: 1px solid rgba(0, 169, 255, 0.2);
}

/* Toasts */
.toast-container {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 400px;
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  margin-bottom: var(--space-md);
  pointer-events: auto;
  animation: slideInRight var(--transition-base) ease;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.toast-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

/* ========================================
   MODALS
   ======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn var(--transition-base) ease;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  animation: scaleIn var(--transition-base) ease;
}

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

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

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

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

.modal-body {
  padding: var(--space-xl);
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-footer {
  padding: var(--space-xl);
  border-top: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
}

/* ========================================
   TABLES
   ======================================== */

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--bg-tertiary);
}

.table th {
  padding: var(--space-md);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-align: left;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-primary);
}

.table td {
  padding: var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-primary);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

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

/* ========================================
   LOADING STATES
   ======================================== */

.skeleton {
  animation: skeleton-loading 1.5s linear infinite;
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    var(--bg-hover) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-md);
}

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

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: var(--space-md);
}

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

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-primary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.spinner-xl {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-max);
}

.loading-content {
  background: var(--bg-card);
  padding: var(--space-2xl);
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: var(--shadow-2xl);
}

.loading-text {
  margin-top: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

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

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

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

/* ========================================
   UTILITIES
   ======================================== */

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

/* Text Alignment */
.text-left {
  text-align: left !important;
}
.text-center {
  text-align: center !important;
}
.text-right {
  text-align: right !important;
}

/* Font Weight */
.font-normal {
  font-weight: var(--font-normal) !important;
}
.font-medium {
  font-weight: var(--font-medium) !important;
}
.font-semibold {
  font-weight: var(--font-semibold) !important;
}
.font-bold {
  font-weight: var(--font-bold) !important;
}

/* Colors */
.text-primary {
  color: var(--text-primary) !important;
}
.text-secondary {
  color: var(--text-secondary) !important;
}
.text-tertiary {
  color: var(--text-tertiary) !important;
}
.text-success {
  color: var(--success) !important;
}
.text-warning {
  color: var(--warning) !important;
}
.text-danger {
  color: var(--danger) !important;
}
.text-info {
  color: var(--info) !important;
}

/* Spacing */
.m-0 {
  margin: 0 !important;
}
.mt-0 {
  margin-top: 0 !important;
}
.mb-0 {
  margin-bottom: 0 !important;
}
.ml-0 {
  margin-left: 0 !important;
}
.mr-0 {
  margin-right: 0 !important;
}

.m-auto {
  margin: auto !important;
}
.mt-auto {
  margin-top: auto !important;
}
.mb-auto {
  margin-bottom: auto !important;
}
.ml-auto {
  margin-left: auto !important;
}
.mr-auto {
  margin-right: auto !important;
}

.p-0 {
  padding: 0 !important;
}
.pt-0 {
  padding-top: 0 !important;
}
.pb-0 {
  padding-bottom: 0 !important;
}
.pl-0 {
  padding-left: 0 !important;
}
.pr-0 {
  padding-right: 0 !important;
}

/* Borders */
.border-0 {
  border: 0 !important;
}
.border-top-0 {
  border-top: 0 !important;
}
.border-bottom-0 {
  border-bottom: 0 !important;
}
.border-left-0 {
  border-left: 0 !important;
}
.border-right-0 {
  border-right: 0 !important;
}

/* Width */
.w-full {
  width: 100% !important;
}
.w-auto {
  width: auto !important;
}

/* Height */
.h-full {
  height: 100% !important;
}
.h-auto {
  height: auto !important;
}

/* Overflow */
.overflow-hidden {
  overflow: hidden !important;
}
.overflow-auto {
  overflow: auto !important;
}
.overflow-x-auto {
  overflow-x: auto !important;
}
.overflow-y-auto {
  overflow-y: auto !important;
}

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

/* Z-Index */
.z-0 {
  z-index: 0 !important;
}
.z-10 {
  z-index: 10 !important;
}
.z-20 {
  z-index: 20 !important;
}
.z-30 {
  z-index: 30 !important;
}
.z-40 {
  z-index: 40 !important;
}
.z-50 {
  z-index: 50 !important;
}

/* Cursor */
.cursor-pointer {
  cursor: pointer !important;
}
.cursor-default {
  cursor: default !important;
}
.cursor-not-allowed {
  cursor: not-allowed !important;
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Mobile First Hide/Show */
@media (min-width: 640px) {
  .sm\:hidden {
    display: none !important;
  }
  .sm\:block {
    display: block !important;
  }
  .sm\:inline-block {
    display: inline-block !important;
  }
  .sm\:flex {
    display: flex !important;
  }
}

@media (min-width: 768px) {
  .md\:hidden {
    display: none !important;
  }
  .md\:block {
    display: block !important;
  }
  .md\:inline-block {
    display: inline-block !important;
  }
  .md\:flex {
    display: flex !important;
  }
}

@media (min-width: 1024px) {
  .lg\:hidden {
    display: none !important;
  }
  .lg\:block {
    display: block !important;
  }
  .lg\:inline-block {
    display: inline-block !important;
  }
  .lg\:flex {
    display: flex !important;
  }
}

/* ========================================
   CUSTOM COMPONENTS
   ======================================== */

/* Hero Section */
.hero {
  padding: var(--space-4xl) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--primary-alpha) 0%, transparent 70%);
  animation: pulse 4s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(var(--text-4xl), 8vw, 4rem);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-lg);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(var(--text-lg), 3vw, var(--text-xl));
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Workflow Card Special */
.workflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.workflow-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.workflow-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-alpha);
}

.workflow-card:hover::before {
  transform: scaleX(1);
}

.workflow-stats {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-primary);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.workflow-stat {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Search Box Advanced */
.search-box {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  padding-right: 120px;
  font-size: var(--text-base);
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-alpha);
}

.search-button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-sm) var(--space-lg);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-button:hover {
  background: var(--primary-dark);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-2xl) 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-base);
}

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

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Dark Mode Toggle */
.theme-toggle {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition-base);
  z-index: var(--z-sticky);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-2xl);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
}

/* Documentation Styles */
.documentation {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
}

.documentation h1,
.documentation h2,
.documentation h3,
.documentation h4,
.documentation h5,
.documentation h6 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-lg);
}

.documentation p {
  margin-bottom: var(--space-lg);
}

.documentation ul,
.documentation ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
}

.documentation li {
  margin-bottom: var(--space-sm);
}

.documentation code {
  background: var(--bg-tertiary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.875em;
}

.documentation pre {
  background: var(--bg-tertiary);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

.documentation blockquote {
  border-left: 4px solid var(--primary);
  padding-left: var(--space-lg);
  margin: var(--space-lg) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.documentation table {
  width: 100%;
  margin: var(--space-lg) 0;
  border-collapse: collapse;
}

.documentation th,
.documentation td {
  padding: var(--space-md);
  border: 1px solid var(--border-primary);
}

.documentation th {
  background: var(--bg-tertiary);
  font-weight: var(--font-semibold);
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  .navbar,
  .theme-toggle,
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --primary: #0040ff;
    --text-primary: #000000;
    --bg-primary: #ffffff;
    --border-primary: #000000;
  }

  [data-theme='dark'] {
    --primary: #4da6ff;
    --text-primary: #ffffff;
    --bg-primary: #000000;
    --border-primary: #ffffff;
  }
}
