/*
 * ThingList Design System
 * Version 1.0.0
 * 
 * A comprehensive, accessible design system for ThingList.app
 * WCAG 2.1 AA Compliant
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */

:root {
  /* Color System - Primary */
  --color-primary-50: #EDF7F0;
  --color-primary-100: #D4ECDB;
  --color-primary-200: #A9D9B7;
  --color-primary-300: #7EC693;
  --color-primary-400: #53B36F;
  --color-primary-500: #2E8B57;
  --color-primary-600: #2E8B57; /* Main brand color */
  --color-primary-700: #1F593A;
  --color-primary-800: #17422B;
  --color-primary-900: #0F2B1C;

  /* Color System - Accent */
  --color-accent-50: #FFF8E1;
  --color-accent-100: #FFECB3;
  --color-accent-200: #FFE082;
  --color-accent-300: #FFD54F;
  --color-accent-400: #FFCA28;
  --color-accent-500: #DAA520;
  --color-accent-600: #DAA520; /* Main accent color */
  --color-accent-700: #B8860B;
  --color-accent-800: #8B6508;
  --color-accent-900: #5E4305;

  /* Color System - Neutral */
  --color-neutral-50: #FAFBFA;
  --color-neutral-100: #e9ece7;
  --color-neutral-200: #dfe3dc;
  --color-neutral-300: #C5CDC3;
  --color-neutral-400: #9BA599;
  --color-neutral-500: #666666;
  --color-neutral-600: #4D4D4D;
  --color-neutral-700: #333333;
  --color-neutral-800: #2D3B32;
  --color-neutral-900: #2D3B32;

  /* Color System - Semantic */
  --color-success: #4CAF50;
  --color-success-light: #E8F5E9;
  --color-success-dark: #388E3C;
  
  --color-warning: #FF9800;
  --color-warning-light: #FFF3E0;
  --color-warning-dark: #F57C00;
  
  --color-error: #E74C3C;
  --color-error-light: #FFEBEE;
  --color-error-dark: #C62828;
  
  --color-info: #2196F3;
  --color-info-light: #E3F2FD;
  --color-info-dark: #1976D2;

  /* Color System - UI */
  --color-white: #FFFFFF;
  --color-black: #000000;
  --color-background: var(--color-neutral-100);
  --color-surface: var(--color-white);
  --color-border: var(--color-neutral-300);
  --color-text-primary: var(--color-neutral-900);
  --color-text-secondary: var(--color-neutral-700);
  --color-text-muted: var(--color-neutral-500);

  /* Typography */
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  --font-family-mono: 'SF Mono', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;

  /* Font Sizes */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;      /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 2rem;        /* 32px */
  --font-size-4xl: 2.5rem;      /* 40px */

  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-snug: 1.33;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.67;

  /* Letter Spacing */
  --letter-spacing-tight: -0.02em;
  --letter-spacing-snug: -0.01em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.01em;

  /* Spacing Scale (4px base unit) */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 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.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-focus: 0 0 0 3px rgba(46, 139, 87, 0.3);

  /* 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);

  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;

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

/* ============================================
   CSS 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;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-secondary);
  background-color: var(--color-background);
  overflow-x: hidden;
}

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

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

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary-600);
  color: var(--color-white);
  padding: var(--space-sm) var(--space-md);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  z-index: var(--z-tooltip);
  border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-primary-700);
  outline-offset: 2px;
}

/* Focus visible styles for keyboard navigation */
*:focus-visible {
  outline: 3px solid var(--color-primary-600);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Remove focus outline for mouse users (keeps keyboard navigation accessible) */
*:focus:not(:focus-visible) {
  outline: none;
}

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

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

h1 {
  font-size: var(--font-size-4xl);
  letter-spacing: var(--letter-spacing-tight);
  line-height: 1.2;
}

h2 {
  font-size: var(--font-size-3xl);
  letter-spacing: var(--letter-spacing-snug);
  line-height: 1.25;
}

h3 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-snug);
  line-height: var(--line-height-snug);
}

h4 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  line-height: 1.4;
}

h5 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  line-height: 1.44;
}

h6 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
}

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

.lead {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-normal);
}

.small {
  font-size: var(--font-size-sm);
  line-height: 1.43;
}

.tiny {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-wide);
}

strong, b {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

em, i {
  font-style: italic;
}

code {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
  background-color: var(--color-neutral-200);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

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

a:hover {
  color: var(--color-primary-700);
  text-decoration: underline;
}

a:focus-visible {
  outline: 3px solid var(--color-primary-600);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.text-link {
  color: var(--color-primary-600);
  font-weight: var(--font-weight-medium);
  border-bottom: 1px solid transparent;
  transition: all var(--transition-fast);
}

.text-link:hover {
  color: var(--color-primary-700);
  border-bottom-color: var(--color-primary-700);
  text-decoration: none;
}

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

/* Responsive Typography */
@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-3xl);
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.375rem;
  }

  .lead {
    font-size: 1.0625rem;
  }
}

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

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

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

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

.style-nav {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-icon {
  font-size: 1.5rem;
}

.brand-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-600);
}

.brand-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-normal);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  text-decoration: none;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-links a:hover {
  color: var(--color-primary-600);
  background-color: var(--color-primary-50);
}

@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
}

/* ============================================
   SECTIONS
   ============================================ */

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

.section-alt {
  background-color: var(--color-white);
}

.section-header {
  text-align: center;
  max-width: 768px;
  margin: 0 auto var(--space-3xl);
}

.section-header h1,
.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-header p {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  margin-bottom: 0;
}

.subsection {
  margin-bottom: var(--space-3xl);
}

.subsection h3 {
  margin-bottom: var(--space-md);
}

.subsection h4 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-lg);
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
}

.subsection-intro {
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

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

.intro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.intro-card {
  padding: var(--space-xl);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.intro-card h3 {
  margin-bottom: var(--space-md);
  font-size: var(--font-size-lg);
}

.intro-card p {
  margin: 0;
  color: var(--color-text-muted);
  line-height: var(--line-height-relaxed);
}

/* ============================================
   COLOR SYSTEM
   ============================================ */

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.color-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-white);
}

.color-swatch {
  height: 120px;
  width: 100%;
}

.color-info {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.color-info strong {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
}

.color-info code {
  font-size: var(--font-size-xs);
  background-color: var(--color-neutral-100);
}

.color-usage {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.contrast-ratio {
  font-size: var(--font-size-xs);
  color: var(--color-success);
  font-weight: var(--font-weight-medium);
  margin-top: var(--space-xs);
}

/* ============================================
   SPACING SYSTEM
   ============================================ */

.spacing-demo {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.spacing-item {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.spacing-visual {
  height: 48px;
  background: var(--color-primary-600);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.spacing-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

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

.spacing-label code {
  font-size: var(--font-size-sm);
}

.spacing-label span {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ============================================
   BORDER RADIUS
   ============================================ */

.radius-demo {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.radius-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.radius-box {
  width: 80px;
  height: 80px;
  background: var(--color-primary-600);
  border: 2px solid var(--color-primary-700);
}

.radius-item strong {
  font-size: var(--font-size-sm);
}

.radius-item code {
  font-size: var(--font-size-xs);
}

/* ============================================
   SHADOWS
   ============================================ */

.shadow-demo {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.shadow-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.shadow-box {
  width: 120px;
  height: 80px;
  background: var(--color-white);
  border-radius: var(--radius-md);
}

.shadow-item strong {
  font-size: var(--font-size-sm);
}

.shadow-item code {
  font-size: var(--font-size-xs);
  max-width: 120px;
  text-align: center;
}

/* ============================================
   TYPE SCALE
   ============================================ */

.type-scale {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

.type-item {
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.type-sample {
  margin-bottom: var(--space-md);
}

.type-specs {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.type-specs strong {
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.spec-row {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.spec-row span {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.usage-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: var(--space-xs);
}

/* ============================================
   TEXT STYLES
   ============================================ */

.text-styles {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.text-styles p {
  margin: 0;
}

/* ============================================
   RESPONSIVE TABLE
   ============================================ */

.responsive-table {
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

.responsive-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.responsive-table th,
.responsive-table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.responsive-table th {
  background: var(--color-neutral-100);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.responsive-table tbody tr:hover {
  background: var(--color-neutral-50);
}

/* ============================================
   FONT DEMO
   ============================================ */

.font-demo {
  padding: var(--space-xl);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.font-sample {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.font-display {
  font-size: 5rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-600);
  line-height: 1;
}

.font-info {
  flex: 1;
}

.font-info strong {
  font-size: var(--font-size-2xl);
  display: block;
  margin-bottom: var(--space-sm);
}

.font-info p {
  margin-bottom: var(--space-md);
  color: var(--color-text-muted);
}

/* ============================================
   COMPONENTS - BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: 44px; /* WCAG touch target */
  min-width: 44px;
}

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

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

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

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-700);
  border-color: var(--color-primary-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-accent {
  background-color: var(--color-accent-600);
  color: var(--color-white);
  border-color: var(--color-accent-600);
}

.btn-accent:hover:not(:disabled) {
  background-color: var(--color-accent-700);
  border-color: var(--color-accent-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-outline:hover:not(:disabled) {
  background-color: var(--color-primary-50);
  color: var(--color-primary-700);
  border-color: var(--color-primary-700);
}

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

.btn-ghost:hover:not(:disabled) {
  background-color: var(--color-primary-50);
  color: var(--color-primary-700);
}

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

.btn-danger:hover:not(:disabled) {
  background-color: var(--color-error-dark);
  border-color: var(--color-error-dark);
}

/* Button Sizes */
.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: var(--font-size-sm);
  min-height: 36px;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--font-size-lg);
  min-height: 52px;
}

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

.btn-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* ============================================
   COMPONENTS - FORMS
   ============================================ */

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

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

.form-input,
.form-select {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text-secondary);
  background-color: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: 44px; /* WCAG touch target */
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary-600);
  box-shadow: var(--shadow-focus);
}

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

.form-input:disabled {
  background-color: var(--color-neutral-100);
  cursor: not-allowed;
  opacity: 0.6;
}

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

.input-error:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
}

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

.input-success:focus {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

/* Form Help Text */
.form-help {
  display: block;
  margin-top: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

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

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

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

/* Select */
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 12px;
  padding-right: 2.5rem;
  appearance: none;
}

/* Checkboxes and Radios */
.form-check {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-sm);
  min-height: 24px;
}

.form-checkbox,
.form-radio {
  width: 20px;
  height: 20px;
  margin-right: var(--space-sm);
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--color-primary-600);
}

.form-check label {
  margin: 0;
  cursor: pointer;
  font-weight: var(--font-weight-normal);
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
}

.form-checkbox:disabled,
.form-radio:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.form-check input:disabled + label {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ============================================
   COMPONENTS - ALERTS
   ============================================ */

.alert {
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
}

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

.alert-success {
  background-color: var(--color-success-light);
  border-color: var(--color-success);
  color: var(--color-success-dark);
}

.alert-info {
  background-color: var(--color-info-light);
  border-color: var(--color-info);
  color: var(--color-info-dark);
}

.alert-warning {
  background-color: var(--color-warning-light);
  border-color: var(--color-warning);
  color: var(--color-warning-dark);
}

.alert-error {
  background-color: var(--color-error-light);
  border-color: var(--color-error);
  color: var(--color-error-dark);
}

/* ============================================
   COMPONENTS - CARDS
   ============================================ */

.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-hover {
  transition: all var(--transition-base);
}

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

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-neutral-50);
}

.card-header h4 {
  margin: 0;
}

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

.card-body p:last-child {
  margin-bottom: 0;
}

.card-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  background: var(--color-neutral-50);
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  display: block;
}

.card h4 {
  margin-bottom: var(--space-sm);
}

.card p {
  color: var(--color-text-muted);
  line-height: var(--line-height-relaxed);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

/* ============================================
   COMPONENTS - BADGES & TAGS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.625rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: var(--radius-full);
  background-color: var(--color-neutral-200);
  color: var(--color-neutral-700);
}

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

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

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

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

.badge-neutral {
  background-color: var(--color-neutral-300);
  color: var(--color-neutral-900);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.375rem 0.75rem;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  background-color: var(--color-primary-50);
  color: var(--color-primary-700);
  border: 1px solid var(--color-primary-600);
  border-radius: var(--radius-full);
}

.tag-remove {
  background: none;
  border: none;
  color: currentColor;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color var(--transition-fast);
}

.tag-remove:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.tag-remove:focus-visible {
  outline: 2px solid var(--color-primary-600);
  outline-offset: 1px;
}

/* ============================================
   COMPONENTS - LOADING SPINNER
   ============================================ */

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-neutral-200);
  border-top-color: var(--color-primary-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

/* ============================================
   COMPONENT DEMOS
   ============================================ */

.component-demo {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-xl);
  background: var(--color-neutral-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin: var(--space-lg) 0;
}

.component-demo-vertical {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-xl);
  background: var(--color-neutral-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin: var(--space-lg) 0;
}

.code-example {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--color-neutral-900);
  border-radius: var(--radius-md);
  margin: var(--space-lg) 0;
}

.code-example code {
  background: transparent;
  color: #10B981;
  font-size: var(--font-size-sm);
  padding: 0;
  display: block;
}

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

.accessibility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.a11y-card {
  padding: var(--space-xl);
  background: var(--color-white);
  border: 2px solid var(--color-primary-600);
  border-radius: var(--radius-lg);
}

.a11y-card h3 {
  margin-bottom: var(--space-md);
  color: var(--color-primary-600);
  font-size: var(--font-size-lg);
}

.a11y-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.a11y-card li {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-sm);
  position: relative;
}

.a11y-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--color-success);
  font-weight: var(--font-weight-bold);
}

/* ============================================
   FOOTER
   ============================================ */

.style-footer {
  background: var(--color-neutral-900);
  color: var(--color-white);
  padding: var(--space-2xl) 0;
  margin-top: var(--space-4xl);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.footer-brand strong {
  display: block;
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-xs);
}

.footer-brand p {
  margin: 0;
  color: var(--color-neutral-300);
  font-size: var(--font-size-sm);
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  color: var(--color-white);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-primary-600);
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

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

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Flex */
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

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

/* Print Styles */
@media print {
  .style-nav,
  .style-footer,
  .skip-link {
    display: none;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

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