/*
 * THE BLOGGER - Premium Modern Design System
 * Inspired by Apple HIG, Material Design 3, and top NY-LA agencies
 * Mobile-first, accessible, performant
 */

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

:root {
  /* Primary Palette - Teal Blue (#1e81b0, #76b5c5, #abdbe3) */
  --color-primary-50: #E8F6FA;
  --color-primary-100: #D1EDF5;
  --color-primary-200: #ABDBE3;
  --color-primary-300: #9ACFDC;
  --color-primary-400: #76B5C5;
  --color-primary-500: #1E81B0;
  --color-primary-600: #1A6F99;
  --color-primary-700: #165D82;
  --color-primary-800: #124B6B;
  --color-primary-900: #0E3954;

  /* Secondary Palette - Navy Blue (#063970, #154c79) */
  --color-secondary-500: #063970;
  --color-secondary-600: #154C79;
  --color-secondary-700: #0A4460;
  --color-secondary-800: #052E4D;

  /* Accent Palette - Orange/Brown (#e28743, #eab676, #873e23) */
  --color-accent-50: #FDF5ED;
  --color-accent-100: #FAE8D5;
  --color-accent-200: #EAB676;
  --color-accent-300: #E8A05C;
  --color-accent-400: #E28743;
  --color-accent-500: #D67A34;
  --color-accent-600: #B3672C;
  --color-accent-700: #873E23;
  --color-accent-800: #6B311C;

  /* Neutral Palette - Cream/Brown (#eeeee4, #21130d) */
  --color-neutral-0: #FFFFFF;
  --color-neutral-50: #EEEEE4;
  --color-neutral-100: #E5E5DB;
  --color-neutral-200: #D4D4CA;
  --color-neutral-300: #B8B8AF;
  --color-neutral-400: #9C9C94;
  --color-neutral-500: #6B6B64;
  --color-neutral-600: #4A4A44;
  --color-neutral-700: #35342F;
  --color-neutral-800: #2B2621;
  --color-neutral-850: #251F1A;
  --color-neutral-900: #21130D;
  --color-neutral-950: #1A0F0A;

  /* Semantic Colors */
  --color-success-50: #F0FDF4;
  --color-success-100: #DCFCE7;
  --color-success-500: #22C55E;
  --color-success-600: #16A34A;
  --color-success-700: #15803D;
  --color-success-900: #14532D;

  --color-warning-50: #FFFBEB;
  --color-warning-100: #FEF3C7;
  --color-warning-500: #F59E0B;
  --color-warning-600: #D97706;
  --color-warning-700: #B45309;

  --color-error-50: #FEF2F2;
  --color-error-100: #FEE2E2;
  --color-error-500: #EF4444;
  --color-error-600: #DC2626;
  --color-error-700: #B91C1C;
  --color-error-900: #7F1D1D;

  --color-info-50: #F0F9FF;
  --color-info-100: #E0F2FE;
  --color-info-500: #0EA5E9;
  --color-info-600: #0284C7;
  --color-info-700: #0369A1;

  /* Spacing Scale (8px system) */
  --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 */
  --space-24: 6rem;     /* 96px */

  /* Typography Scale */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-5xl: 3rem;      /* 48px */

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

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

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

  /* Border Radius */
  --radius-sm: 0.5rem;   /* 8px */
  --radius-base: 0.75rem; /* 12px */
  --radius-md: 1rem;     /* 16px */
  --radius-lg: 1.25rem;  /* 20px */
  --radius-xl: 1.5rem;   /* 24px */
  --radius-2xl: 2rem;    /* 32px */
  --radius-full: 9999px;

  /* Shadows - Dark Mode (Default) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-base: 0 2px 8px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px 0 rgba(0, 0, 0, 0.35), 0 2px 6px 0 rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px 0 rgba(0, 0, 0, 0.4), 0 4px 12px 0 rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 12px 32px 0 rgba(0, 0, 0, 0.45), 0 6px 16px 0 rgba(0, 0, 0, 0.35);
  --shadow-2xl: 0 24px 64px 0 rgba(0, 0, 0, 0.5), 0 12px 32px 0 rgba(0, 0, 0, 0.4);

  /* Brand Shadows (with color) */
  --shadow-primary-sm: 0 4px 12px rgba(30, 129, 176, 0.25), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-primary-md: 0 8px 24px rgba(30, 129, 176, 0.3), 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-primary-lg: 0 12px 32px rgba(30, 129, 176, 0.35), 0 4px 12px rgba(0, 0, 0, 0.45);

  /* Transitions */
  --ease-standard: cubic-bezier(0.4, 0.0, 0.2, 1);
  --ease-decelerate: cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-accelerate: cubic-bezier(0.4, 0.0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.65, 0, 0.35, 1);

  --duration-instant: 100ms;
  --duration-fast: 200ms;
  --duration-base: 300ms;
  --duration-moderate: 400ms;
  --duration-slow: 500ms;

  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-fixed: 1200;
  --z-overlay: 9000;
  --z-modal: 9100;
  --z-popover: 9200;
  --z-toast: 9999;

  /* Surface Colors - Dark Mode */
  --surface-base: var(--color-neutral-950);
  --surface-elevated: var(--color-neutral-900);
  --surface-card: var(--color-neutral-850);
  --surface-card-hover: var(--color-neutral-800);
  --surface-overlay: rgba(0, 0, 0, 0.8);

  --text-primary: var(--color-neutral-50);
  --text-secondary: var(--color-neutral-300);
  --text-tertiary: var(--color-neutral-400);
  --text-disabled: var(--color-neutral-600);

  --border-default: var(--color-neutral-800);
  --border-subtle: var(--color-neutral-850);
  --border-strong: var(--color-neutral-700);

  --brand: var(--color-primary-500);
  --brand-hover: var(--color-primary-400);
  --brand-active: var(--color-primary-300);

  --accent: var(--color-accent-500);
  --accent-hover: var(--color-accent-400);

  --focus-ring: 0 0 0 3px rgba(30, 129, 176, 0.3);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #1E81B0 0%, #76B5C5 100%);
  --gradient-secondary: linear-gradient(135deg, #063970 0%, #154C79 100%);
  --gradient-accent: linear-gradient(135deg, #E28743 0%, #EAB676 100%);
  --gradient-subtle: linear-gradient(180deg, #1A0F0A 0%, #21130D 100%);
  --gradient-vibrant: linear-gradient(135deg, #1E81B0 0%, #E28743 50%, #873E23 100%);

  /* Glass Effects */
  --glass-bg: rgba(23, 32, 51, 0.6);
  --glass-border: rgba(248, 250, 252, 0.1);
  --glass-blur: blur(20px) saturate(150%);
}

/* =============================================================================
   2. RESET & BASE STYLES
   ============================================================================= */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', 'Roboto', sans-serif;
  background: var(--surface-base);
  color: var(--text-primary);
  line-height: var(--leading-normal);
  min-height: 100vh;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============================================================================
   3. TYPOGRAPHY
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2rem, 5vw, var(--text-4xl));
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(1.625rem, 4vw, var(--text-3xl));
  margin-bottom: var(--space-3);
}

h3 {
  font-size: clamp(1.375rem, 3vw, var(--text-2xl));
  margin-bottom: var(--space-3);
  color: var(--brand);
}

h4 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}

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

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

a:hover {
  color: var(--brand-hover);
}

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

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

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

/* =============================================================================
   4. UTILITY CLASSES
   ============================================================================= */

.hidden {
  display: none !important;
}

.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;
}

.text-center {
  text-align: center;
}

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

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =============================================================================
   5. LAYOUT COMPONENTS
   ============================================================================= */

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

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

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

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

/* =============================================================================
   6. NAVIGATION
   ============================================================================= */

.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: var(--space-4) var(--space-6);
  box-shadow: var(--shadow-sm);
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

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

.navbar-brand img {
  height: 40px;
  width: auto;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-card);
  border-radius: var(--radius-base);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

@media (max-width: 767px) {
  .navbar {
    padding: var(--space-3) var(--space-4);
  }

  .navbar-brand img {
    height: 32px;
  }

  .nav-buttons {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
}

/* =============================================================================
   7. BUTTONS
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-base);
  border: none;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-standard);
  min-height: 48px;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:active {
  transform: scale(0.96);
  transition-duration: var(--duration-fast);
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-600) 100%);
  color: var(--color-neutral-0);
  box-shadow: var(--shadow-primary-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-400) 0%, var(--color-primary-500) 100%);
  box-shadow: var(--shadow-primary-md);
  transform: translateY(-2px);
}

.btn-primary:active {
  box-shadow: var(--shadow-sm);
  transform: scale(0.96);
}

/* Secondary Button */
.btn-secondary {
  background: transparent;
  border: 2px solid var(--border-default);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--surface-card);
  border-color: var(--brand);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--brand);
}

.btn-ghost:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* Danger Button */
.btn-danger {
  background: transparent;
  border: 2px solid var(--color-error-500);
  color: var(--color-error-500);
}

.btn-danger:hover {
  background: var(--color-error-500);
  color: var(--color-neutral-0);
}

/* Success Button */
.btn-success {
  background: var(--color-success-500);
  color: var(--color-neutral-0);
}

.btn-success:hover {
  background: var(--color-success-600);
}

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

/* Icon Button */
.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-base);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--surface-card-hover);
  border-color: var(--brand);
  color: var(--text-primary);
}

/* Button Group */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-8);
}

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

/* =============================================================================
   8. CARDS
   ============================================================================= */

.card {
  background: var(--surface-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  transition: all var(--duration-moderate) var(--ease-spring);
}

.card:hover {
  transform: translateY(-8px);
  border-color: var(--brand);
  box-shadow: var(--shadow-xl), var(--shadow-primary-md);
}

/* Glass Card */
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-2xl);
}

/* Blog Card */
.blog-card {
  position: relative;
  background: var(--surface-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--duration-moderate) var(--ease-spring);
  cursor: pointer;
  overflow: hidden;
}

.blog-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-moderate) var(--ease-smooth);
}

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

.blog-card:hover {
  transform: translateY(-8px);
  border-color: var(--brand);
  box-shadow: var(--shadow-primary-lg);
}

.blog-card h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.blog-card .blog-url {
  font-size: var(--text-sm);
  color: var(--brand);
  margin-bottom: var(--space-3);
}

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

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

.category-tag {
  padding: var(--space-1) var(--space-3);
  background: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--weight-medium);
}

/* Card Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-8);
}

@media (max-width: 767px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* =============================================================================
   9. FORMS
   ============================================================================= */

.form-group {
  position: relative;
  margin-bottom: var(--space-6);
}

/* Floating Label Input */
.input-wrapper {
  position: relative;
}

input, textarea, select {
  width: 100%;
  padding: var(--space-5) var(--space-4) var(--space-2);
  background: var(--surface-elevated);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-base);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: inherit;
  transition: all var(--duration-base) var(--ease-standard);
}

input::placeholder {
  opacity: 0;
}

label {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  transition: all var(--duration-base) var(--ease-standard);
  pointer-events: none;
  user-select: none;
}

input:focus + label,
input:not(:placeholder-shown) + label,
textarea:focus + label,
textarea:not(:placeholder-shown) + label {
  top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--brand);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface-card);
  box-shadow: var(--focus-ring);
}

/* Textarea */
textarea {
  min-height: 120px;
  resize: vertical;
  line-height: var(--leading-relaxed);
  padding-top: var(--space-4);
}

/* Select */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-12);
  cursor: pointer;
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  cursor: pointer;
}

.checkbox-label,
.radio-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

/* Error State */
.form-group.error input,
.form-group.error textarea,
.form-group.error select {
  border-color: var(--color-error-500);
  background: rgba(239, 68, 68, 0.05);
}

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

.error-message {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  color: var(--color-error-500);
  font-size: var(--text-sm);
}

/* Success State */
.form-group.success input,
.form-group.success textarea {
  border-color: var(--color-success-500);
}

.form-group.success label {
  color: var(--color-success-500);
}

/* =============================================================================
   10. MODALS & OVERLAYS
   ============================================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn var(--duration-base) var(--ease-decelerate);
}

.modal-content {
  background: var(--surface-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-2xl);
  animation: modalSlideUp var(--duration-moderate) var(--ease-spring);
}

.modal-header {
  margin-bottom: var(--space-6);
}

.modal-header h2 {
  margin-bottom: var(--space-2);
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-base);
  background: var(--surface-elevated);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-standard);
}

.modal-close:hover {
  background: var(--surface-card-hover);
  color: var(--text-primary);
  transform: rotate(90deg);
}

.modal-buttons {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  justify-content: flex-end;
}

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

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

/* =============================================================================
   11. PROGRESS INDICATORS
   ============================================================================= */

.progress-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-8) auto var(--space-12);
  max-width: 600px;
  position: relative;
}

.progress-step {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 3px solid var(--border-default);
  color: var(--text-tertiary);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-moderate) var(--ease-spring);
  position: relative;
  z-index: 1;
}

.progress-step::after {
  content: '';
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  width: 12px;
  height: 3px;
  background: var(--border-default);
  transform: translateY(-50%);
  transition: background var(--duration-moderate) var(--ease-standard);
  z-index: -1;
}

.progress-step:last-child::after {
  display: none;
}

.progress-step.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--color-neutral-0);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.15), var(--shadow-primary-md);
  transform: scale(1.15);
  animation: stepActivate var(--duration-slow) var(--ease-spring);
}

.progress-step.completed {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--color-neutral-0);
}

.progress-step.completed::before {
  content: '✓';
  font-size: var(--text-lg);
}

.progress-step.completed::after {
  background: var(--brand);
}

@keyframes stepActivate {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1.15); }
}

@media (max-width: 767px) {
  .progress-bar {
    gap: var(--space-2);
  }

  .progress-step {
    width: 40px;
    height: 40px;
    font-size: var(--text-sm);
  }

  .progress-step::after {
    width: 8px;
  }
}

/* =============================================================================
   12. LOADING STATES
   ============================================================================= */

.loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(99, 102, 241, 0.3);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

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

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-card) 0%,
    var(--surface-card-hover) 50%,
    var(--surface-card) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-heading {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-4);
}

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

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

/* =============================================================================
   13. ALERTS & MESSAGES
   ============================================================================= */

.alert {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-base);
  border: 2px solid;
  margin-bottom: var(--space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert-success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
  border-color: var(--color-success-500);
  color: var(--text-primary);
}

.alert-error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
  border-color: var(--color-error-500);
  color: var(--text-primary);
}

.alert-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
  border-color: var(--color-warning-500);
  color: var(--text-primary);
}

.alert-info {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(14, 165, 233, 0.05));
  border-color: var(--color-info-500);
  color: var(--text-primary);
}

/* Success/Error Boxes (legacy support) */
.success-box {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.08));
  border: 2px solid var(--color-success-500);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  text-align: center;
  animation: fadeIn var(--duration-moderate) var(--ease-decelerate);
}

.error-box {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08));
  border: 2px solid var(--color-error-500);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  text-align: center;
  animation: fadeIn var(--duration-moderate) var(--ease-decelerate);
}

/* =============================================================================
   14. IMAGES & MEDIA
   ============================================================================= */

.images-grid,
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.image-card,
.featured-candidate {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-default);
  transition: all var(--duration-moderate) var(--ease-spring);
  cursor: pointer;
}

.image-card img,
.featured-candidate img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.image-card:hover,
.featured-candidate:hover {
  border-color: var(--brand);
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-primary-lg);
}

.image-card.selected,
.featured-candidate.selected {
  border: 3px solid var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), var(--shadow-primary-lg);
}

.checkmark-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 36px;
  height: 36px;
  background: var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  opacity: 0;
  transform: scale(0) rotate(-180deg);
  transition: all var(--duration-moderate) var(--ease-spring);
}

.image-card.selected .checkmark-badge,
.featured-candidate.selected .checkmark-badge {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Upload Area */
.upload-area {
  background: var(--surface-card);
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  text-align: center;
  transition: all var(--duration-base) var(--ease-standard);
  cursor: pointer;
}

.upload-area:hover {
  border-color: var(--brand);
  background: var(--surface-card-hover);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

/* =============================================================================
   15. CONTENT BOXES
   ============================================================================= */

.outline-box,
.article-box,
.info-box {
  background: var(--surface-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  margin: var(--space-6) 0;
}

.outline-box h3,
.article-box h3,
.info-box h3 {
  color: var(--brand);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--border-default);
}

/* =============================================================================
   16. TOGGLES & SWITCHES
   ============================================================================= */

.image-source-toggle,
.api-source-toggle {
  display: flex;
  gap: var(--space-2);
  background: var(--surface-card);
  padding: var(--space-1);
  border-radius: var(--radius-base);
  border: 2px solid var(--border-default);
}

.toggle-btn {
  flex: 1;
  padding: var(--space-3) var(--space-6);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}

.toggle-btn.active {
  background: var(--brand);
  color: var(--color-neutral-0);
  box-shadow: var(--shadow-sm);
}

.toggle-btn:hover:not(.active) {
  color: var(--text-primary);
  background: var(--surface-elevated);
}

/* =============================================================================
   17. RESPONSIVE UTILITIES
   ============================================================================= */

@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }

  .images-grid,
  .featured-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: var(--space-6);
  }

  .button-group {
    flex-direction: column;
    width: 100%;
  }

  .button-group .btn {
    width: 100%;
  }
}

@media (min-width: 768px) {
  .hide-desktop {
    display: none !important;
  }
}

/* =============================================================================
   18. ACCESSIBILITY IMPROVEMENTS
   ============================================================================= */

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

button:focus-visible,
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: var(--z-toast);
  background: var(--brand);
  color: var(--color-neutral-0);
  padding: var(--space-4);
  text-decoration: none;
  font-weight: var(--weight-semibold);
}

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

/* =============================================================================
   19. PRINT STYLES
   ============================================================================= */

@media print {
  .navbar,
  .nav-buttons,
  .button-group,
  .btn,
  .modal-backdrop {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    border: 1px solid black;
    break-inside: avoid;
  }
}

/* =============================================================================
   20. ANIMATIONS
   ============================================================================= */

/* Fade in animation */
.fade-in {
  animation: fadeIn var(--duration-moderate) var(--ease-decelerate);
}

/* Slide up animation */
.slide-up {
  animation: slideUp var(--duration-moderate) var(--ease-decelerate);
}

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

/* Scale in animation */
.scale-in {
  animation: scaleIn var(--duration-moderate) var(--ease-spring);
}

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

/* Checkmark animation */
@keyframes checkmark {
  0% {
    stroke-dashoffset: 50;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* =============================================================================
   END OF MODERN.CSS
   ============================================================================= */
