/* ============================================
   DESIGN SYSTEM - Foundation
   ============================================ */

/* Typography Scale */
:root {
  /* Font Families */
  --font-primary: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, Helvetica, sans-serif;
  --font-display: 'Poppins', 'Nunito', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  
  /* Type Scale (Major Third - 1.25) */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.25rem;    /* 20px */
  --text-xl: 1.563rem;   /* 25px */
  --text-2xl: 1.953rem;  /* 31px */
  --text-3xl: 2.441rem;  /* 39px */
  --text-4xl: 3.052rem;  /* 49px */
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Font Weights */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
}

/* Spacing System (4px base unit) */
:root {
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
}

/* Enhanced Color System */
:root {
  /* Primary Colors */
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-primary-500: #3b82f6;
  --color-primary-600: #2563eb;
  --color-primary-700: #1d4ed8;
  --color-primary-900: #1e3a8a;
  
  /* Semantic Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* Neutral Scale */
  --color-neutral-50: #f9fafb;
  --color-neutral-100: #f3f4f6;
  --color-neutral-200: #e5e7eb;
  --color-neutral-500: #6b7280;
  --color-neutral-700: #374151;
  --color-neutral-900: #111827;
}

/* Shadow System (Elevation) */
:root {
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

/* Border Radius System */
:root {
  --radius-none: 0;
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;
}

/* Breakpoints */
:root {
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/* Animation Timing */
:root {
  --transition-fast: 0.15s ease-out;
  --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Shared page layout */
  --site-max-width: 1200px;
  --site-gutter: clamp(16px, 2.5vw, 32px);
}

/* ============================================
   COMPONENTS - Modern Card Design
   ============================================ */

.modern-card {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-slow);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.modern-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

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

.modern-card:hover::before {
  opacity: 1;
}

.modern-card:active {
  transform: translateY(-2px);
}

/* Card Content Structure */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  padding-bottom: var(--space-2);
}

.card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--input-bg);
  color: var(--accent);
  flex-shrink: 0;
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.card-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-2);
  background: var(--accent);
  color: var(--on-accent, #111);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-extrabold);
  color: var(--text);
  margin: 0;
  line-height: var(--leading-tight);
  letter-spacing: -0.3px;
}

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

.card-meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.card-tag,
.card-type {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-full);
  color: var(--muted);
  font-weight: var(--weight-medium);
}

.card-footer {
  padding: var(--space-4);
  padding-top: var(--space-2);
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* ============================================
   COMPONENTS - Button System
   ============================================ */

.btn {
  /* Base */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  font-family: var(--font-primary);
  min-height: 44px; /* Touch target */
  white-space: nowrap;
}

/* Button Variants */
.btn-primary,
.btn.accent {
  background: var(--accent);
  color: var(--on-accent, #111);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn.accent:hover {
  background: var(--accent);
  filter: brightness(1.1);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active,
.btn.accent:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

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

.btn-secondary:hover {
  background: var(--input-bg-hover);
  border-color: var(--input-border-hover);
  transform: translateY(-1px);
}

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

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

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

.btn-danger:hover {
  background: #dc2626;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  min-height: 52px;
}

/* Button States */
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
  color: transparent;
}

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

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

/* Icon Button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--input-border);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-base);
}

.icon-btn:hover {
  background: var(--input-bg-hover);
  border-color: var(--input-border-hover);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   COMPONENTS - Form System
   ============================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.form-label .required {
  color: var(--color-error);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  font-family: var(--font-primary);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--input-border-hover);
  background: var(--input-bg-hover);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 59, 130, 246), 0.1);
}

.form-input:invalid:not(:placeholder-shown),
.form-select:invalid:not(:placeholder-shown),
.form-textarea:invalid:not(:placeholder-shown) {
  border-color: var(--color-error);
}

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

.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-help {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--space-1);
}

.input-wrapper {
  position: relative;
}

.input-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.input-wrapper:focus-within::after {
  transform: scaleX(1);
}

/* ============================================
   COMPONENTS - Loading Skeletons
   ============================================ */

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

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

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

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

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

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* ============================================
   COMPONENTS - Modals & Overlays
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 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: 10000;
  animation: fadeIn var(--transition-base);
  padding: var(--space-4);
}

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

.modal {
  background: var(--panel);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  animation: slideUp var(--transition-slow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--input-border);
}

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

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

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  color: var(--text);
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: var(--input-bg-hover);
  border-color: var(--input-border-hover);
}

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

.modal-footer {
  padding: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--input-border);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ============================================
   COMPONENTS - Header/Navigation
   ============================================ */

.app-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  background: var(--panel);
  border-bottom: 1px solid var(--input-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.header-container {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  overflow: visible;
  justify-self: start;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text);
  font-weight: var(--weight-extrabold);
  font-size: var(--text-lg);
  letter-spacing: -0.5px;
  transition: opacity var(--transition-base);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.logo-link:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-search {
  flex: 1;
  max-width: 600px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  padding-left: var(--space-10);
  border-radius: var(--radius-lg);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: var(--text-sm);
  transition: all var(--transition-base);
}

.header-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 59, 130, 246), 0.1);
}

.header-search::before {
  content: '🔍';
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.5;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  overflow: visible;
  justify-self: end;
}

/* ============================================
   UTILITIES - Spacing
   ============================================ */

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* ============================================
   UTILITIES - Grid System
   ============================================ */

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

.grid {
  display: grid;
  gap: var(--space-4);
}

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

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

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

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

/* ============================================
   RESPONSIVE - Mobile Optimizations
   ============================================ */

@media (max-width: 768px) {
  .app-header {
    height: 56px;
    padding: 0 var(--space-4);
  }
  
  .header-search {
    display: none; /* Hide on mobile, show in menu */
  }
  
  .modal {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .modal-overlay {
    padding: 0;
  }
  
  .modern-card {
    border-radius: var(--radius-lg);
  }
  
  .btn {
    min-height: 44px; /* Ensure touch targets */
  }
}

/* ============================================
   ACCESSIBILITY - Focus States
   ============================================ */

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   ANIMATIONS - Micro-interactions
   ============================================ */

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

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

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

.fade-in {
  animation: fadeIn var(--transition-base);
}

.slide-up {
  animation: slideUp var(--transition-slow);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Icon styling */
.icon-theme,
.icon-delete,
.icon-edit,
.icon-analytics,
.icon-ai,
.icon-tools,
.icon-settings,
.icon-search,
.icon-user,
.icon-back,
.icon-studio,
.icon-save,
.icon-loading,
.icon-check,
.icon-close,
.icon-arrow-right,
.icon-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-theme svg,
.icon-delete svg,
.icon-edit svg,
.icon-analytics svg,
.icon-ai svg,
.icon-tools svg,
.icon-settings svg,
.icon-search svg,
.icon-user svg,
.icon-back svg,
.icon-studio svg,
.icon-save svg,
.icon-loading svg,
.icon-check svg,
.icon-close svg,
.icon-arrow-right svg,
.icon-filter svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Assistant message styling */
.assistant-message {
  animation: slideIn var(--transition-base);
}

.assistant-user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--on-accent, #111);
}

.assistant-bot {
  align-self: flex-start;
}

.assistant-loading {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-4);
}

.assistant-loading span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.assistant-loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.assistant-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Domain card specific styles (for domain management) */
.domain-card {
  /* Inherits from .modern-card */
}

.domain-card .card-icon {
  font-size: 32px;
  line-height: 1;
}

/* Ensure domain cards work well in grid */
#domains-grid .domain-card {
  min-height: 200px;
}

/* Button variants for domain cards */
.btn-delete {
  /* Now using .btn-danger instead */
}

/* Legacy support - keep old class names working */
.domain-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.domain-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-extrabold);
  color: var(--text);
  margin: 0 0 var(--space-1) 0;
}

.domain-card-id {
  font-size: var(--text-xs);
  color: var(--muted);
  font-family: var(--font-mono);
  margin: 0;
}

.domain-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.domain-card-badge {
  padding: var(--space-1) var(--space-2);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: var(--weight-medium);
}

.domain-card-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

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

/* ============================================
   ADDITIONAL ENHANCEMENTS
   ============================================ */

/* Toast notifications */
.toast {
  animation: slideUp var(--transition-slow);
}

/* Status loading animation */
.status-loading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.status-loading span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.status-loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.status-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Enhanced responsive grid */
@media (max-width: 1024px) {
  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  .app-header {
    height: 56px;
    padding: 0 var(--space-4);
  }
  
  .header-center {
    display: none !important;
  }
  
  .modal {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .modal-overlay {
    padding: 0;
  }
}

/* Enhanced focus states for better accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
  top: 0;
}

/* Print styles */
@media print {
  .app-header,
  .header-actions,
  .btn,
  .modal-overlay {
    display: none !important;
  }
  
  .modern-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
