/**
 * Cheddy Design System
 * A refined, data-focused aesthetic for Amazon product monitoring
 *
 * Design Philosophy: "Precision Monitoring"
 * - Clean, minimal interface that prioritizes data readability
 * - Sophisticated color palette with purposeful accent colors
 * - Typography hierarchy optimized for information density
 * - Subtle animations that guide attention without distraction
 */

/* ===== DESIGN TOKENS ===== */

:root {
  /* Colors - Primary Palette */
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-primary-200: #bfdbfe;
  --color-primary-300: #93c5fd;
  --color-primary-400: #60a5fa;
  --color-primary-500: #3b82f6;
  --color-primary-600: #2563eb;
  --color-primary-700: #1d4ed8;
  --color-primary-800: #1e40af;
  --color-primary-900: #1e3a8a;

  /* Colors - Brand (Cheddy Orange/Warm) */
  --color-brand-50: #fff7ed;
  --color-brand-100: #ffedd5;
  --color-brand-200: #fed7aa;
  --color-brand-300: #fdba74;
  --color-brand-400: #fb923c;
  --color-brand-500: #f97316;
  --color-brand-600: #ea580c;
  --color-brand-700: #c2410c;
  --color-brand-800: #9a3412;
  --color-brand-900: #7c2d12;

  /* Colors - Status */
  --color-success-50: #f0fdf4;
  --color-success-500: #22c55e;
  --color-success-700: #15803d;
  --color-warning-50: #fefce8;
  --color-warning-400: #facc15;
  --color-warning-700: #a16207;
  --color-error-50: #fef2f2;
  --color-error-500: #ef4444;
  --color-error-700: #b91c1c;
  --color-info-50: #f0f9ff;
  --color-info-500: #0ea5e9;
  --color-info-700: #0369a1;

  /* Colors - Neutral */
  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', monospace;

  /* Font Sizes */
  --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;

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

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

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

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-colored: 0 10px 30px -10px var(--color-brand-500);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ===== BASE STYLES ===== */

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-slate-700);
  background-color: var(--color-slate-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  line-height: 1.2;
  color: var(--color-slate-900);
}

h1 { font-size: var(--text-4xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-3xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

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

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-slate-200);
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-elevated {
  box-shadow: var(--shadow-md);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-600) 0%, var(--color-primary-700) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-700) 0%, var(--color-primary-800) 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: var(--color-slate-700);
  border: 1px solid var(--color-slate-300);
}

.btn-secondary:hover {
  background: var(--color-slate-50);
  border-color: var(--color-slate-400);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-error-500) 0%, var(--color-error-700) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: linear-gradient(135deg, var(--color-error-700) 0%, #991b1b 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  background: var(--color-slate-100);
  color: var(--color-slate-900);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
}

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

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

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

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

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border-left: 4px solid;
}

.alert-success {
  background: var(--color-success-50);
  border-color: var(--color-success-500);
}

.alert-warning {
  background: var(--color-warning-50);
  border-color: var(--color-warning-400);
}

.alert-error {
  background: var(--color-error-50);
  border-color: var(--color-error-500);
}

.alert-info {
  background: var(--color-info-50);
  border-color: var(--color-info-500);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-slate-200);
  background: white;
}

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

.table thead {
  background: var(--color-slate-50);
  border-bottom: 2px solid var(--color-slate-200);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-slate-600);
}

.table tbody tr {
  border-bottom: 1px solid var(--color-slate-100);
  transition: background-color var(--transition-fast);
}

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

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

.table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-slate-700);
}

/* Form Elements */
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-slate-700);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-slate-900);
  background: white;
  border: 1px solid var(--color-slate-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

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

.form-input::placeholder {
  color: var(--color-slate-400);
}

/* Links */
.link {
  color: var(--color-primary-600);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: color var(--transition-fast);
  position: relative;
}

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

.link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary-600);
  transition: width var(--transition-base);
}

.link:hover::after {
  width: 100%;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
}

.empty-state-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto var(--space-4);
  color: var(--color-slate-300);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-slate-900);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  color: var(--color-slate-500);
  max-width: 24rem;
  margin: 0 auto;
}

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

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

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

.animate-fade-in {
  animation: fadeIn 0.4s ease-out;
}

.animate-slide-in {
  animation: slideInFromLeft 0.3s ease-out;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== UTILITY CLASSES ===== */

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary-600) 0%, var(--color-brand-500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.divider {
  height: 1px;
  background: var(--color-slate-200);
  margin: var(--space-8) 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack-sm {
  gap: var(--space-2);
}

.stack-lg {
  gap: var(--space-6);
}

/* ===== BREADCRUMBS ===== */

.breadcrumb-nav {
  margin-bottom: var(--space-6);
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  animation: breadcrumbSlideIn 0.3s ease-out backwards;
}

.breadcrumb-item:nth-child(1) { animation-delay: 0ms; }
.breadcrumb-item:nth-child(2) { animation-delay: 50ms; }
.breadcrumb-item:nth-child(3) { animation-delay: 100ms; }
.breadcrumb-item:nth-child(4) { animation-delay: 150ms; }

.breadcrumb-item:not(:last-child)::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-slate-300);
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.breadcrumb-item:not(:last-child):hover::after {
  background: var(--color-primary-400);
}

.breadcrumb-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-slate-600);
  text-decoration: none;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.breadcrumb-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(249, 115, 22, 0.05) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.breadcrumb-link:hover {
  color: var(--color-primary-600);
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--color-primary-200);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

.breadcrumb-link:hover::before {
  opacity: 1;
}

.breadcrumb-link svg {
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.breadcrumb-link:hover svg {
  transform: scale(1.1);
}

.breadcrumb-link-current {
  color: var(--color-slate-900);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(249, 115, 22, 0.06) 100%);
  border-color: var(--color-primary-200);
  cursor: default;
  pointer-events: none;
}

.breadcrumb-link-current::before {
  opacity: 1;
}

.breadcrumb-text {
  position: relative;
  z-index: 1;
}

@keyframes breadcrumbSlideIn {
  from {
    opacity: 0;
    transform: translateX(-8px) translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

/* Responsive adjustments for breadcrumbs */
@media (max-width: 640px) {
  .breadcrumb-link {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
  }

  .breadcrumb-link svg {
    width: 0.875rem;
    height: 0.875rem;
  }
}
