/* TruckStock Design System */
:root {
  /* Colors */
  --brand-primary: #FF6B35;
  --brand-secondary: #2D3047;
  --brand-accent: #FFB627;
  
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-md: 15px;
  --font-size-lg: 17px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  
  /* Borders */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-lg);
}

/* Phone Frame */
.phone-frame {
  width: 375px;
  height: 812px;
  background: var(--gray-900);
  border-radius: 44px;
  padding: 12px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.app {
  width: 100%;
  height: 100%;
  background: var(--gray-50);
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--gray-800);
}

.status-icons {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.battery {
  font-size: var(--font-size-xs);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: white;
  border-bottom: 1px solid var(--gray-200);
}

.header-left h1 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--gray-900);
}

.event-badge {
  display: inline-block;
  background: var(--brand-primary);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-top: var(--space-xs);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-600);
}

.icon-btn:hover {
  background: var(--gray-100);
}

/* Info Bar */
.info-bar {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: white;
}

.weather-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
}

.weather-icon {
  font-size: 24px;
}

.weather-info {
  display: flex;
  flex-direction: column;
}

.weather-temp {
  font-weight: 600;
  color: var(--gray-900);
}

.weather-label {
  font-size: var(--font-size-xs);
  color: var(--gray-600);
}

.capacity-card {
  flex: 1;
  background: var(--gray-100);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
}

.capacity-header {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  margin-bottom: var(--space-xs);
}

.capacity-pct {
  font-weight: 600;
  color: var(--brand-primary);
}

.capacity-bar {
  height: 6px;
  background: var(--gray-300);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.capacity-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Alert Banner */
.alert-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
}

.alert-icon {
  font-size: 16px;
}

.alert-text {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--gray-700);
}

.alert-action {
  background: none;
  border: none;
  color: var(--danger);
  font-weight: 600;
  font-size: var(--font-size-sm);
  cursor: pointer;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: var(--space-xs);
  padding: 0 var(--space-md);
  background: white;
  border-bottom: 1px solid var(--gray-200);
}

.nav-tab {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  background: none;
  border: none;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* Tab Content */
.tab-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.tab-panel {
  display: none;
  height: 100%;
}

.tab-panel.active {
  display: block;
}

/* Search Bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: var(--font-size-md);
  background: transparent;
}

.search-bar svg {
  color: var(--gray-400);
}

/* Inventory List */
.inventory-list {
  padding: 0 var(--space-md) 100px;
}

.inventory-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: white;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.inventory-item:active {
  transform: scale(0.98);
}

.inventory-item.low-stock {
  border-left: 4px solid var(--danger);
}

.item-emoji {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border-radius: var(--radius-md);
}

.item-details {
  flex: 1;
}

.item-name {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.item-meta {
  font-size: var(--font-size-xs);
  color: var(--gray-500);
}

.item-qty {
  text-align: right;
}

.qty-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--gray-900);
}

.qty-unit {
  font-size: var(--font-size-xs);
  color: var(--gray-500);
}

.qty-status {
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-top: 4px;
  display: inline-block;
}

.qty-status.ok {
  background: #D1FAE5;
  color: #059669;
}

.qty-status.low {
  background: #FEE2E2;
  color: #DC2626;
}

.qty-status.warning {
  background: #FEF3C7;
  color: #D97706;
}

/* FAB */
.fab {
  position: absolute;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  background: var(--brand-primary);
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.fab:hover {
  background: #E55A2B;
  transform: scale(1.05);
}

/* Prep Calculator */
.prep-form {
  padding: var(--space-md);
}

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

.form-group label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  background: white;
}

.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-row .form-group {
  flex: 1;
}

.weather-note {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: #FEF3C7;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-md);
}

.btn-primary {
  width: 100%;
  padding: var(--space-md);
  background: var(--brand-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #E55A2B;
}

.btn-secondary {
  padding: var(--space-md);
  background: var(--gray-100);
  color: var(--gray-700);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: 600;
  cursor: pointer;
}

/* Prep Results */
.prep-results {
  padding: var(--space-md);
}

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

.prep-list {
  margin-bottom: var(--space-md);
}

.prep-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: white;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-sm);
}

.prep-item-name {
  font-weight: 500;
}

.prep-item-qty {
  font-weight: 700;
  color: var(--brand-primary);
}

.prep-item-current {
  font-size: var(--font-size-xs);
  color: var(--gray-500);
}

/* History */
.history-list {
  padding: var(--space-md);
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: white;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.history-date {
  width: 48px;
  text-align: center;
}

.history-date .day {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--gray-500);
  text-transform: uppercase;
}

.history-date .date {
  display: block;
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--gray-900);
}

.history-content {
  flex: 1;
}

.history-event {
  font-weight: 600;
  margin-bottom: 4px;
}

.history-stats {
  font-size: var(--font-size-sm);
  color: var(--gray-500);
}

.history-stats .divider {
  margin: 0 var(--space-xs);
}

.history-waste {
  margin-top: 4px;
  font-size: var(--font-size-xs);
}

.waste-label {
  color: var(--gray-500);
}

.waste-value {
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.waste-value.low {
  background: #D1FAE5;
  color: #059669;
}

.waste-value.medium {
  background: #FEF3C7;
  color: #D97706;
}

.chevron {
  color: var(--gray-400);
}

/* Modal */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: 100%;
  background: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding-bottom: 34px; /* Safe area */
}

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

.modal-header h3 {
  font-size: var(--font-size-lg);
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  font-size: 24px;
  line-height: 1;
  color: var(--gray-500);
  cursor: pointer;
}

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

.modal-footer {
  display: flex;
  gap: var(--space-md);
  padding: 0 var(--space-lg);
}

.modal-footer button {
  flex: 1;
}

/* Count Display */
.count-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.count-btn {
  width: 64px;
  height: 64px;
  border: 2px solid var(--gray-200);
  background: white;
  border-radius: var(--radius-full);
  font-size: 32px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s;
}

.count-btn:active {
  transform: scale(0.95);
}

.count-btn.minus {
  color: var(--danger);
}

.count-btn.minus:hover {
  background: #FEF2F2;
  border-color: var(--danger);
}

.count-btn.plus {
  color: var(--success);
}

.count-btn.plus:hover {
  background: #ECFDF5;
  border-color: var(--success);
}

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

#countNumber {
  display: block;
  font-size: 48px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.count-unit {
  font-size: var(--font-size-sm);
  color: var(--gray-500);
}

.par-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--gray-100);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.par-status {
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.par-status.ok {
  background: #D1FAE5;
  color: #059669;
}

.par-status.low {
  background: #FEE2E2;
  color: #DC2626;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 420px) {
  .phone-frame {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 0;
  }
  
  .app {
    border-radius: 0;
  }
  
  body {
    padding: 0;
  }
}
