@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* Color Variables & Light Theme Reset */
:root {
  --bg-primary: #f4f6f8;        /* Off-white slate background */
  --bg-card: #ffffff;           /* Clean white cards */
  --bg-input: #e2e8f0;          /* Slate-200 inputs */
  --border-color: rgba(226, 232, 240, 0.9); /* Slate-200 border */
  --text-primary: #1e293b;      /* Slate-800 text */
  --text-secondary: #64748b;    /* Slate-500 text */
  --text-muted: #94a3b8;        /* Slate-400 text */
  --paprika: #d95738;           /* Warm smoked paprika accent */
  --paprika-hover: #c2410c;
  --honey: #f59e0b;             /* Honey/amber for numeric highlights */
  --emerald: #10b981;           /* Green checklist state */
  --rose: #ef4444;              /* Red delete state */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

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

body {
  background-color: var(--bg-primary);
  font-family: var(--font-sans);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Screen Wrapper Container */
.app-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

/* Header & iOS Navbar */
.app-header {
  flex-shrink: 0;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  z-index: 80;
}
.app-navbar {
  height: 50px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-btn {
  background: none;
  border: none;
  color: var(--paprika);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  width: 60px;
  text-align: left;
}
.nav-title {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.nav-btn-more {
  background: none;
  border: none;
  color: var(--paprika);
  font-size: 16px;
  cursor: pointer;
  width: 60px;
  text-align: right;
}

/* Scroll Area for Content */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 100px; /* offset tab bar height */
}

/* View Visibility */
.app-view {
  display: none;
  flex-direction: column;
  gap: 16px;
}
.app-view.active {
  display: flex;
}
.plan-subview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.recipe-subview {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.recipe-subview.active {
  display: flex;
}

/* Header Text elements */
.profile-header, .catalog-section {
  padding: 4px 4px 0 4px;
}
.view-large-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #0f172a;
}
.view-subtitle {
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Card layout system */
.control-card, .math-card, .ingredients-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Recipe details title banner */
.recipe-title-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.02);
}
.recipe-large-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #0f172a;
  line-height: 1.25;
}
.recipe-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.meta-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
}

/* Catalog group list */
.recipes-grouped-list, .tasks-grouped-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
}
.recipes-grouped-list > div, .tasks-grouped-list > div {
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}
.recipes-grouped-list > div:last-child, .tasks-grouped-list > div:last-child {
  border-bottom: none;
}
.recipe-catalog-item {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.15s;
}
.recipe-catalog-item:hover {
  background-color: var(--bg-primary);
}
.catalog-details h3 {
  font-size: 13px;
  font-weight: 750;
  color: var(--text-primary);
}
.catalog-details p {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
}
.chevron-right {
  font-size: 18px;
  color: var(--text-muted);
  font-weight: 300;
}

/* Tasks elements */
.task-row-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.task-main-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.checkbox-circle-btn {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background-color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: transparent;
  transition: all 0.15s;
}
.checkbox-circle-btn.checked {
  border-color: var(--emerald);
  background-color: var(--emerald);
  color: #ffffff;
}
.task-body {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
}
.task-description {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  color: var(--text-primary);
}
.task-description span.line-through {
  text-decoration: line-through;
  color: var(--text-muted);
}
.action-capital {
  text-transform: capitalize;
}
.recipes-tag-btn {
  border: none;
  background-color: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.12);
  color: var(--honey);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 750;
  padding: 2px 6px;
  border-radius: 6px;
  align-self: flex-start;
  cursor: pointer;
}
.task-minutes {
  font-family: monospace;
  font-size: 11px;
  font-weight: 750;
  color: var(--text-secondary);
}
.task-recipes-expanded {
  margin-top: 10px;
  padding-left: 30px;
  border-left: 2px solid #e2e8f0;
  font-size: 10.5px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.expanded-title {
  font-weight: 750;
  color: var(--text-muted);
}
.expanded-item {
  line-height: 1.4;
}

/* Surge elements */
.sunday-surge-btn {
  width: 100%;
}
.surge-metrics-bar {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.surge-metric-badge {
  font-size: 9.5px;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 20px;
}
.surge-metric-badge.prep {
  background-color: rgba(16, 185, 129, 0.08);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.15);
}
.surge-metric-badge.savings {
  background-color: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

/* Sub-tabs segment selector */
.subtab-bar {
  display: flex;
  background-color: rgba(226, 232, 240, 0.8);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  margin-top: 10px;
}
.subtab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 750;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.subtab-btn.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Custom Settings Switch */
.settings-list {
  display: flex;
  flex-direction: column;
  divide-y: 1px solid var(--border-color);
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.settings-row:first-child {
  padding-top: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}
.settings-row:last-child {
  padding-bottom: 0;
}
.segment-control {
  display: flex;
  background-color: var(--bg-primary);
  padding: 2px;
  border-radius: 8px;
}
.segment-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 750;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.segment-btn.active {
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* iOS Switch Style */
.ios-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--text-muted);
  border: none;
  border-radius: 24px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.ios-switch.active {
  background-color: var(--emerald);
}
.ios-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}
.ios-switch.active .ios-switch-thumb {
  transform: translateX(20px);
}

/* Tips & Banners */
.tips-banner {
  background-color: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.12);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tips-title {
  font-size: 11px;
  font-weight: 800;
  color: #1d4ed8;
  text-transform: uppercase;
}
.tips-text {
  font-size: 10.5px;
  line-height: 1.45;
  color: #1e40af;
  font-weight: 600;
}

.chronological-title-bar {
  padding: 10px 4px 0 4px;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Steps Timeline Breakers */
.station-breaker-header {
  background-color: rgba(226, 232, 240, 0.4);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 12px;
  margin-bottom: 2px;
}

/* Step Items Row */
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: opacity 0.2s, background-color 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
  cursor: pointer;
  margin-top: 8px;
}
.step-card.completed {
  opacity: 0.55;
  background-color: rgba(255,255,255,0.5);
  border-color: transparent;
}
.checkbox-circle {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: transparent;
  transition: all 0.2s;
  background-color: #ffffff;
}
.step-card.completed .checkbox-circle {
  border-color: var(--paprika);
  background-color: var(--paprika);
  color: white;
}
.step-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.step-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.step-index-lbl {
  font-size: 9px;
  font-weight: 750;
  color: var(--text-muted);
}
.contamination-badge {
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  text-transform: uppercase;
}
.contamination-badge.tier-3 {
  background-color: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.15);
}
.contamination-badge.tier-2 {
  background-color: rgba(245, 158, 11, 0.08);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.15);
}
.contamination-badge.tier-1 {
  background-color: rgba(16, 185, 129, 0.08);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.15);
}
.step-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
  font-weight: 600;
}
.step-card.completed .step-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.step-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.badge {
  font-size: 8.5px;
  font-weight: 750;
  padding: 1px 5px;
  border-radius: 5px;
}
.badge.ingredient {
  background-color: var(--bg-primary);
  border: 1px solid #e2e8f0;
  color: var(--text-secondary);
}
.badge.hardware {
  background-color: var(--bg-primary);
  border: 1px solid #cbd5e1;
  color: var(--text-secondary);
}
.surge-save-success-tag {
  font-size: 10px;
  font-weight: 750;
  color: var(--emerald);
  margin-top: 2px;
}

/* Timers inside steps */
.timer-container {
  margin-top: 6px;
  background-color: #0f172a;
  color: #f8fafc;
  padding: 6px 10px;
  border-radius: 8px;
}
.timer-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
}
.timer-pill strong {
  font-family: monospace;
  font-size: 11px;
}
.timer-btn {
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
}

/* Ingredients list subview */
.card-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
}
.grocery-list {
  display: flex;
  flex-direction: column;
}
.grocery-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.03);
}
.grocery-row:last-child {
  border-bottom: none;
}
.grocery-name-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.grocery-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.staple-tag {
  font-size: 7.5px;
  font-weight: 800;
  background-color: var(--text-muted);
  color: white;
  padding: 1px 4px;
  border-radius: 4px;
  text-transform: uppercase;
}
.grocery-qty {
  font-family: monospace;
  font-size: 12px;
  font-weight: 750;
  color: var(--paprika);
  background-color: rgba(217, 87, 56, 0.05);
  border: 1px solid rgba(217, 87, 56, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Family setup cards */
.family-members-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.family-row {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
}
.consolidated-au-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 850;
  color: var(--text-primary);
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 4px;
}
.au-badge {
  font-family: monospace;
  font-size: 12px;
  font-weight: 750;
  color: var(--honey);
  background-color: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Emergency Bailout Section */
.bailout-trigger-container {
  padding: 8px 4px;
}
.bailout-btn {
  width: 100%;
  background-color: var(--paprika);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 12px;
  border-radius: 12px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(217, 87, 56, 0.15);
  transition: background-color 0.15s;
}
.bailout-btn:hover {
  background-color: var(--paprika-hover);
}

/* Bottom Tab Navigation */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background-color: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -3px 10px rgba(15, 23, 42, 0.02);
  z-index: 100;
}
.tab-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: color 0.15s;
}
.tab-item.active {
  color: var(--paprika);
}
.tab-icon-emoji {
  font-size: 18px;
}
.tab-item span {
  font-size: 9.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* iOS Overlay Modal for Emergency Bailout */
.bailout-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(245, 158, 11, 0.98);
  z-index: 200;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 24px;
  opacity: 0;
  transition: opacity 0.25s ease-out;
}
.bailout-overlay.active {
  display: flex;
  opacity: 1;
}
.bailout-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  text-align: center;
  color: #1e293b;
  gap: 16px;
}
.warning-triangle {
  font-size: 48px;
  background-color: #1e293b;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.bailout-content h2 {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
}
.bailout-notice {
  background-color: rgba(30, 41, 59, 0.08);
  border: 1px solid rgba(30, 41, 59, 0.15);
  padding: 16px;
  border-radius: 12px;
  max-width: 280px;
  font-size: 13px;
  font-weight: 700;
}
.highlight-red {
  text-decoration: underline;
  color: #991b1b;
  font-weight: 900;
}
.bailout-notice .subtext {
  font-size: 11.5px;
  color: #475569;
  margin-top: 8px;
  font-weight: 600;
}
.bailout-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-btn.full-width {
  width: 100%;
}
.bailout-footer .action-btn.primary {
  background-color: #1e293b;
  color: #ffffff;
}
.bailout-footer .action-btn.secondary {
  background-color: transparent;
  border: 1px solid rgba(30,41,59,0.3);
  color: #1e293b;
}
