/* General Reset and Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #0d1117;
  color: #c9d1d9;
  padding-bottom: 110px; /* Leave room for sticky footer */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header styles */
.app-header {
  background-color: #161b22;
  border-bottom: 1px solid #21262d;
  padding: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  font-size: 1.6rem;
}

.brand h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f0803c;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.sync-status-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-label {
  font-size: 0.75rem;
  background: #21262d;
  padding: 4px 10px;
  border-radius: 20px;
  color: #8b949e;
  border: 1px solid #30363d;
  font-weight: 600;
}

/* Live Sync Badges */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.sync-badge.live {
  background-color: rgba(57, 211, 83, 0.15);
  color: #39d353;
  border: 1px solid rgba(57, 211, 83, 0.3);
}

.sync-badge.syncing {
  background-color: rgba(240, 128, 60, 0.15);
  color: #f0803c;
  border: 1px solid rgba(240, 128, 60, 0.3);
}

.sync-badge.offline {
  background-color: rgba(248, 81, 73, 0.15);
  color: #f85149;
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
}

.sync-badge.live .pulse-dot {
  animation: pulse-green 1.5s infinite;
}

.sync-badge.syncing .pulse-dot {
  animation: pulse-orange 1s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(57, 211, 83, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(57, 211, 83, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(57, 211, 83, 0); }
}

@keyframes pulse-orange {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(240, 128, 60, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(240, 128, 60, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(240, 128, 60, 0); }
}

/* Main Content Containers */
.app-content {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-grow: 1;
}

/* Card Styling */
.control-card, .ingredients-section, .calculator-card, .estimator-section, .workflow-section {
  background-color: #161b22;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

/* Control Card & Slider */
.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.control-header h2 {
  font-size: 1.15rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.weight-display-container {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.weight-display-number {
  font-size: 3rem;
  font-weight: 800;
  color: #58a6ff;
  line-height: 1;
}

.weight-display-unit {
  font-size: 1.2rem;
  color: #8b949e;
  font-weight: 600;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  background: #30363d;
  outline: none;
  margin: 15px 0;
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #58a6ff;
  cursor: pointer;
  border: 3px solid #0d1117;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
  transition: transform 0.1s ease;
}

.custom-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
  background: #58a6ff;
}

.slider-track-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #8b949e;
  padding: 0 4px;
}

/* Elbow-Friendly Slider Buttons */
.adjust-btn {
  background-color: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  border-radius: 8px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.adjust-btn:active {
  background-color: #30363d;
  transform: scale(0.95);
}

.btn-sm {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

.btn-lg {
  width: 64px;
  height: 64px;
  font-size: 1.3rem;
  background-color: #2b3540;
  border-color: #3f4e60;
  color: #58a6ff;
}

.btn-lg:active {
  background-color: #3f4e60;
}

/* Ingredient Cards Grid */
.section-title {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8b949e;
  margin-bottom: 16px;
  border-left: 4px solid #f0803c;
  padding-left: 8px;
}

.ingredients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.ingredient-card {
  background-color: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: transform 0.2s;
}

.ingredient-card:active {
  transform: scale(0.98);
}

.ing-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
}

.ing-value-box {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.ing-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
}

.ing-unit {
  font-size: 0.9rem;
  color: #8b949e;
  font-weight: 600;
}

.ing-desc {
  font-size: 0.75rem;
  color: #8b949e;
}

.highlight-card {
  border-color: rgba(240, 128, 60, 0.4);
  background-color: rgba(240, 128, 60, 0.05);
}

.highlight-card .ing-value {
  color: #f0803c;
}

/* Link Estimator Section */
.estimator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.est-card {
  background-color: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.est-metric {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.est-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: #58a6ff;
}

.est-unit {
  font-size: 1rem;
  color: #8b949e;
  font-weight: 600;
}

.est-label {
  font-size: 0.8rem;
  color: #8b949e;
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 600;
}

.wide-card {
  grid-column: 1 / -1;
  background-color: rgba(88, 166, 255, 0.05);
  border-color: rgba(88, 166, 255, 0.3);
}

.wide-card .est-number {
  font-size: 1.8rem;
}

/* Task Checklists (Elbow Tap Friendly) */
.workflow-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0;
  background-color: transparent;
  border: none;
  box-shadow: none;
}

.day-container {
  background-color: #161b22;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.day-title {
  font-size: 1.15rem;
  color: #ffffff;
  margin-bottom: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-title::before {
  content: "📅";
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-row {
  background-color: #21262d;
  border: 1px solid #30363d;
  border-radius: 10px;
  display: flex;
  align-items: stretch;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 72px; /* Extra large click target for elbow tap */
  user-select: none;
}

.task-row:active {
  transform: scale(0.99);
}

.task-checkbox-col {
  width: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #30363d;
  background-color: #1c2128;
  transition: all 0.2s ease;
}

.task-checkbox {
  width: 34px;
  height: 34px;
  border: 2px solid #8b949e;
  border-radius: 8px;
  display: block;
  position: relative;
  transition: all 0.2s ease;
}

.task-content {
  padding: 12px 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.step-num {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #58a6ff;
  letter-spacing: 0.5px;
}

.task-content p {
  font-size: 0.95rem;
  line-height: 1.35;
  font-weight: 400;
  color: #c9d1d9;
}

/* Checked Task (Success State) - STRIKING EMERALD GREEN */
.task-row.checked {
  background-color: #1a4f27; /* Rich emerald dark green */
  border-color: #2ea44f;
  box-shadow: 0 0 10px rgba(46, 164, 79, 0.2);
}

.task-row.checked .task-checkbox-col {
  background-color: #236934;
  border-right-color: #2ea44f;
}

.task-row.checked .task-checkbox {
  border-color: #ffffff;
  background-color: #39d353;
}

.task-row.checked .task-checkbox::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 4px;
  width: 9px;
  height: 16px;
  border: solid #0d1117;
  border-width: 0 4px 4px 0;
  transform: rotate(45deg);
}

.task-row.checked .step-num {
  color: #a5ecb5;
}

.task-row.checked .task-content p {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
}

/* Sticky Bottom Layout Bar */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #161b22;
  border-top: 1px solid #21262d;
  padding: 16px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.footer-buttons {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.8fr;
  gap: 12px;
}

.footer-btn {
  height: 60px; /* Large tap targets for elbow */
  border-radius: 12px;
  border: none;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  color: #ffffff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  user-select: none;
}

.footer-btn:active {
  transform: scale(0.96);
}

.footer-btn .btn-icon {
  font-size: 1.3rem;
}

.btn-danger {
  background-color: #21262d;
  border: 1.5px solid #f85149;
  color: #f85149;
}

.btn-danger:active {
  background-color: rgba(248, 81, 73, 0.15);
}

.btn-secondary {
  background-color: #21262d;
  border: 1.5px solid #30363d;
  color: #c9d1d9;
}

.btn-secondary:active {
  background-color: #30363d;
}

.btn-primary {
  background-color: #f0803c;
  border: 1.5px solid #f2965a;
  color: #0d1117;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary:active {
  background-color: #f2965a;
}

/* Beef Sausage Mixture Calculator Section */
.calc-inputs-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.calc-input-group {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-input-group label, .calc-toggle-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calc-input-wrapper {
  display: flex;
  align-items: center;
  background-color: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0 12px;
  height: 54px;
  transition: border-color 0.2s;
}

.calc-input-wrapper:focus-within {
  border-color: #58a6ff;
}

.calc-number-input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 800;
  width: 100%;
  outline: none;
}

/* Remove spin buttons from number input */
.calc-number-input::-webkit-outer-spin-button,
.calc-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.calc-number-input {
  -moz-appearance: textfield;
}

.calc-input-unit {
  color: #8b949e;
  font-weight: 600;
  font-size: 1rem;
}

.calc-toggle-group {
  flex: 2 1 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-buttons {
  display: flex;
  gap: 12px;
  height: 54px;
}

.toggle-btn {
  flex: 1;
  background-color: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  padding: 6px 12px;
  font-family: inherit;
}

.toggle-btn:active {
  transform: scale(0.98);
}

.toggle-btn.active {
  background-color: rgba(88, 166, 255, 0.15);
  border-color: #58a6ff;
  color: #58a6ff;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.1);
}

.ratio-title {
  font-size: 0.9rem;
  font-weight: 800;
}

.ratio-sub {
  font-size: 0.7rem;
  opacity: 0.85;
  margin-top: 2px;
}

.calc-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.result-card {
  background-color: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.2s, border-color 0.2s;
}

.result-card:hover {
  border-color: #3f4e60;
}

.result-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
}

.result-value-box {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.result-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
}

.result-unit {
  font-size: 1.1rem;
  color: #8b949e;
  font-weight: 600;
}

.result-desc {
  font-size: 0.75rem;
  color: #8b949e;
}

.result-card:first-child {
  border-left: 4px solid #58a6ff;
}

.result-card:last-child {
  border-left: 4px solid #f0803c;
}

/* Tablet & Mobile Layout Adjustments */
@media (max-width: 600px) {
  .header-container {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  
  .weight-display-number {
    font-size: 2.5rem;
  }

  .btn-lg {
    width: 52px;
    height: 52px;
    font-size: 1.15rem;
  }

  .btn-sm {
    width: 42px;
    height: 42px;
    font-size: 0.95rem;
  }

  .ingredients-grid {
    grid-template-columns: 1fr 1fr; /* 2 columns on small screens */
  }

  .ingredient-card {
    padding: 16px 12px;
  }

  .ing-label {
    font-size: 0.9rem;
  }

  .ing-value {
    font-size: 2.1rem;
  }

  .ing-desc {
    font-size: 0.85rem;
  }

  /* Extra large tap targets & font sizes for kitchen line elbow-tapping */
  .task-row {
    min-height: 90px;
  }

  .task-checkbox-col {
    width: 88px;
  }

  .task-checkbox {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border-width: 2.5px;
  }

  .task-row.checked .task-checkbox::after {
    left: 13px;
    top: 4px;
    width: 11px;
    height: 20px;
    border-width: 0 5px 5px 0;
  }

  .task-content {
    padding: 14px 18px;
  }

  .step-num {
    font-size: 0.85rem;
  }

  .task-content p {
    font-size: 1.2rem;
    line-height: 1.45;
  }

  .section-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
  }

  .toggle-buttons {
    height: auto;
    flex-direction: column;
    width: 100%;
  }

  .toggle-btn {
    padding: 12px 12px;
    width: 100%;
    height: 56px;
  }

  .ratio-title {
    font-size: 1rem;
  }

  .ratio-sub {
    font-size: 0.8rem;
  }

  .footer-buttons {
    grid-template-columns: 1fr; /* Stack buttons vertically for mobile */
    gap: 10px;
  }
  
  .footer-btn {
    height: 60px; /* Keep buttons big on mobile */
    font-size: 1.1rem;
  }

  body {
    padding-bottom: 240px; /* Give more space for stacked footer buttons */
  }
}
