/* ProgressPulse Design System */

/* ========================================
   Design Tokens
   ======================================== */

:root {
  /* Colors - Warm, trustworthy palette */
  --color-primary-50: #fef7ee;
  --color-primary-100: #fdead7;
  --color-primary-200: #fad2ae;
  --color-primary-300: #f6b27a;
  --color-primary-400: #f18a44;
  --color-primary-500: #ed6b1f;
  --color-primary-600: #de5215;
  --color-primary-700: #b83d13;
  --color-primary-800: #933218;
  --color-primary-900: #772c17;
  
  /* Neutral */
  --color-neutral-0: #ffffff;
  --color-neutral-50: #fafafa;
  --color-neutral-100: #f5f5f5;
  --color-neutral-200: #e5e5e5;
  --color-neutral-300: #d4d4d4;
  --color-neutral-400: #a3a3a3;
  --color-neutral-500: #737373;
  --color-neutral-600: #525252;
  --color-neutral-700: #404040;
  --color-neutral-800: #262626;
  --color-neutral-900: #171717;
  
  /* Semantic */
  --color-success-500: #22c55e;
  --color-success-100: #dcfce7;
  --color-warning-500: #f59e0b;
  --color-warning-100: #fef3c7;
  --color-error-500: #ef4444;
  --color-error-100: #fee2e2;
  --color-info-500: #3b82f6;
  --color-info-100: #dbeafe;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-sans);
  
  /* 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;
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Spacing Scale */
  --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.25rem;
  --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);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ========================================
   Reset & Base
   ======================================== */

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-neutral-800);
  background-color: var(--color-neutral-50);
  min-height: 100vh;
}

/* ========================================
   Layout Components
   ======================================== */

.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-4);
  min-height: 100vh;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn var(--transition-base);
}

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

/* ========================================
   Navigation & Header
   ======================================== */

.nav-tabs {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--color-neutral-0);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}

.nav-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-neutral-500);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-tab:hover {
  color: var(--color-neutral-700);
  background: var(--color-neutral-100);
}

.nav-tab.active {
  background: var(--color-primary-500);
  color: var(--color-neutral-0);
}

.header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-0);
  font-size: var(--text-xl);
}

.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-neutral-800);
}

.header-subtitle {
  color: var(--color-neutral-500);
  font-size: var(--text-sm);
}

/* ========================================
   Cards
   ======================================== */

.card {
  background: var(--color-neutral-0);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-neutral-200);
}

.card + .card {
  margin-top: var(--space-4);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-neutral-800);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

/* ========================================
   Progress Bar
   ======================================== */

.progress-container {
  margin: var(--space-6) 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.progress-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-neutral-700);
}

.progress-percent {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary-600);
}

.progress-bar {
  height: 12px;
  background: var(--color-neutral-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary-400), var(--color-primary-500));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ========================================
   Stage List
   ======================================== */

.stages {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stage {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-neutral-50);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.stage:hover {
  background: var(--color-neutral-100);
}

.stage.completed {
  background: var(--color-success-100);
  border-color: var(--color-success-500);
}

.stage.current {
  background: var(--color-primary-50);
  border-color: var(--color-primary-500);
}

.stage-check {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-neutral-300);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  background: var(--color-neutral-0);
}

.stage.completed .stage-check {
  background: var(--color-success-500);
  border-color: var(--color-success-500);
  color: var(--color-neutral-0);
}

.stage.current .stage-check {
  border-color: var(--color-primary-500);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(237, 107, 31, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(237, 107, 31, 0); }
}

.stage-info {
  flex: 1;
  min-width: 0;
}

.stage-name {
  font-weight: var(--font-medium);
  color: var(--color-neutral-800);
}

.stage.completed .stage-name {
  color: var(--color-success-500);
}

.stage-date {
  font-size: var(--text-xs);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary-500);
  color: var(--color-neutral-0);
}

.btn-primary:hover {
  background: var(--color-primary-600);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-neutral-100);
  color: var(--color-neutral-700);
}

.btn-secondary:hover {
  background: var(--color-neutral-200);
}

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

.btn-success:hover {
  background: #16a34a;
}

.btn-block {
  width: 100%;
}

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

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

/* ========================================
   Form Elements
   ======================================== */

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

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

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  border: 2px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  background: var(--color-neutral-0);
  transition: all var(--transition-fast);
}

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

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

/* ========================================
   Order Card (Dashboard)
   ======================================== */

.order-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-neutral-0);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-neutral-200);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.order-card + .order-card {
  margin-top: var(--space-3);
}

.order-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-100), var(--color-primary-200));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.order-info {
  flex: 1;
  min-width: 0;
}

.order-name {
  font-weight: var(--font-semibold);
  color: var(--color-neutral-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-customer {
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

.order-meta {
  text-align: right;
}

.order-progress-mini {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary-600);
}

.order-due {
  font-size: var(--text-xs);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

.order-due.urgent {
  color: var(--color-error-500);
  font-weight: var(--font-medium);
}

/* ========================================
   Status Badge
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
}

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

.badge-complete {
  background: var(--color-success-100);
  color: var(--color-success-500);
}

.badge-urgent {
  background: var(--color-error-100);
  color: var(--color-error-500);
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
}

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

.empty-text {
  color: var(--color-neutral-500);
  margin-bottom: var(--space-6);
}

/* ========================================
   Share Link
   ======================================== */

.share-link {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.share-input {
  flex: 1;
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-family: monospace;
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  color: var(--color-neutral-600);
}

.share-btn {
  padding: var(--space-3);
  background: var(--color-neutral-800);
  color: var(--color-neutral-0);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.share-btn:hover {
  background: var(--color-neutral-900);
}

/* ========================================
   Customer View Specific
   ======================================== */

.customer-header {
  text-align: center;
  padding: var(--space-6);
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
  border-radius: var(--radius-2xl);
  color: var(--color-neutral-0);
  margin-bottom: var(--space-6);
}

.customer-order-name {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

.customer-maker {
  opacity: 0.9;
  font-size: var(--text-sm);
}

.customer-eta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.eta-icon {
  font-size: var(--text-lg);
}

.eta-text {
  font-weight: var(--font-medium);
}

/* ========================================
   Floating Action Button
   ======================================== */

.fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-primary-500);
  color: var(--color-neutral-0);
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  font-size: var(--text-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.fab:hover {
  background: var(--color-primary-600);
  transform: scale(1.05);
}

/* ========================================
   Toast Notification
   ======================================== */

.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-neutral-800);
  color: var(--color-neutral-0);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all var(--transition-base);
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-neutral-400);
  font-size: var(--text-xs);
}

.footer a {
  color: var(--color-primary-500);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ========================================
   Utilities
   ======================================== */

.text-center { text-align: center; }
.text-muted { color: var(--color-neutral-500); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.hidden { display: none !important; }

/* ========================================
   Responsive Adjustments
   ======================================== */

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