/* Poultry Feed Calculator – isolated prototype styles */

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #222222;
  background-color: #f5f5f0;
  -webkit-font-smoothing: antialiased;
}

.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

@media (min-width: 768px) {
  .page-wrap {
    max-width: 1040px;
    padding: 1.5rem 1.5rem 3rem;
  }
}

.hero {
  text-align: center;
  margin-bottom: 1.75rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: #214d21;
  line-height: 1.2;
}

.hero .subtitle {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: #666666;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.disclaimer {
  background: #ffffff;
  border: 1px solid #dddddd;
  border-left: 4px solid #2f6b2f;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #666666;
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
}

.card {
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #214d21;
}

.calc-guide p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: #444444;
  line-height: 1.6;
}

.calc-guide p:last-child {
  margin-bottom: 0;
}

.calc-guide ul {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
  font-size: 0.95rem;
  color: #444444;
  line-height: 1.6;
}

.calc-guide li + li {
  margin-top: 0.35rem;
}

.calc-guide strong {
  color: #214d21;
}

.calc-guide a {
  color: #2f6b2f;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.calc-guide a:hover {
  color: #214d21;
}

.card h2 .step-num {
  display: inline-block;
  background: #2f6b2f;
  color: #ffffff;
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #214d21;
}

.type-section {
  display: none;
}

.type-section.visible {
  display: block;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.option-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.75rem 0.5rem;
  border: 2px solid #dddddd;
  border-radius: 8px;
  background: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  color: #222222;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.option-card:hover {
  border-color: #2f6b2f;
}

.option-card.selected {
  border-color: #2f6b2f;
  background: #eef5ee;
  box-shadow: 0 0 0 1px #2f6b2f;
  color: #214d21;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #222222;
  margin-bottom: 0.35rem;
}

.form-group .hint {
  font-size: 0.8rem;
  color: #666666;
  margin-top: 0.25rem;
}

.form-group input[type='number'],
.form-group input[type='text'] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #dddddd;
  border-radius: 6px;
  background: #ffffff;
  color: #222222;
  min-height: 2.75rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #2f6b2f;
  box-shadow: 0 0 0 2px rgba(47, 107, 47, 0.2);
}

.price-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.price-input-row input[type='number'] {
  flex: 1 1 auto;
  min-width: 0;
}

.price-unit-select {
  flex: 0 0 auto;
  min-width: 5.5rem;
  padding: 0.65rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid #dddddd;
  border-radius: 6px;
  background: #ffffff;
  color: #222222;
  min-height: 2.75rem;
  cursor: pointer;
}

.phase-divider {
  grid-column: 1 / -1;
  border-top: 1px solid #eeeeee;
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.warnings-panel {
  margin-bottom: 1rem;
}

.warnings-panel .warning-item {
  background: #fdf8f0;
  border: 1px solid #e09510;
  border-left: 4px solid #b83232;
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #222222;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: #234f2e;
  color: #ffffff;
  border-color: #234f2e;
  flex: 1 1 100%;
}

.btn-primary:hover {
  background: #2f6b2f;
  border-color: #2f6b2f;
}

.btn-secondary {
  background: #ffffff;
  color: #2f6b2f;
  border-color: #2f6b2f;
  flex: 1 1 auto;
}

.btn-secondary:hover {
  background: #eef5ee;
}

.btn-neutral {
  background: #ffffff;
  color: #666666;
  border-color: #dddddd;
  flex: 1 1 auto;
}

.btn-neutral:hover {
  background: #f5f5f0;
}

.btn-small {
  min-height: 2.25rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-danger {
  background: #ffffff;
  color: #b83232;
  border-color: #b83232;
}

.btn-danger:hover {
  background: #fdf0f0;
}

.error-panel {
  display: none;
  background: #fdf0f0;
  border: 1px solid #b83232;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: #b83232;
  font-size: 0.9rem;
}

.error-panel.visible {
  display: block;
}

.error-panel ul {
  margin: 0;
  padding-left: 1.25rem;
}

.results-section {
  display: none;
}

.results-section.visible {
  display: block;
}

.results-panel {
  display: none;
}

.results-panel.visible {
  display: block;
}

.results-hero {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.result-card {
  background: #f9f9f7;
  border: 1px solid #dddddd;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.result-card.featured {
  padding: 1.15rem;
}

.result-card .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #666666;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.result-card .value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #222222;
  line-height: 1.2;
}

.result-card.featured .value {
  font-size: 1.5rem;
}

.result-card .sub-value {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #666666;
  margin-top: 0.35rem;
}

.result-card.positive .value {
  color: #1f7a3a;
}

.result-card.negative .value {
  color: #b83232;
}

.results-secondary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.result-mini {
  background: #ffffff;
  border: 1px solid #eeeeee;
  border-radius: 6px;
  padding: 0.75rem;
}

.result-mini .label {
  font-size: 0.75rem;
  color: #666666;
  margin-bottom: 0.2rem;
}

.result-mini .value {
  font-size: 1rem;
  font-weight: 600;
  color: #222222;
}

.result-mini .value.positive {
  color: #1f7a3a;
}

.result-mini .value.negative {
  color: #b83232;
}

.saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.saved-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #eeeeee;
}

.saved-item:last-child {
  border-bottom: none;
}

.saved-item-info {
  flex: 1 1 200px;
}

.saved-item-info .saved-date {
  font-size: 0.8rem;
  color: #666666;
}

.saved-item-info .saved-summary {
  font-size: 0.95rem;
  font-weight: 600;
  color: #222222;
}

.saved-item-info .saved-detail {
  font-size: 0.85rem;
  color: #666666;
}

.saved-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.saved-empty {
  color: #666666;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0;
}

.breakdown-section,
.sensitivity-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eeeeee;
}

.breakdown-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: #214d21;
}

.sensitivity-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #214d21;
}

.sensitivity-hint {
  font-size: 0.85rem;
  color: #666666;
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.sensitivity-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .sensitivity-wrap {
    overflow-x: visible;
  }

  .sensitivity-table {
    min-width: 0;
  }
}

.sensitivity-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.sensitivity-table th,
.sensitivity-table td {
  padding: 0.6rem 0.65rem;
  text-align: left;
  border: 1px solid #dddddd;
  white-space: nowrap;
}

.sensitivity-table th {
  background: #eef5ee;
  color: #214d21;
  font-weight: 600;
  font-size: 0.75rem;
}

.sensitivity-table td {
  background: #ffffff;
}

.sensitivity-table tr.base-row td {
  background: #f0f7f0;
  font-weight: 600;
}

.sensitivity-table .positive {
  color: #1f7a3a;
  font-weight: 600;
}

.sensitivity-table .negative {
  color: #b83232;
  font-weight: 600;
}

.print-only {
  display: none;
}

@media (max-width: 540px) {
  .hero h1 {
    font-size: 1.45rem;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .input-grid {
    grid-template-columns: 1fr;
  }

  .results-hero,
  .results-secondary {
    grid-template-columns: 1fr;
  }

  .button-row .btn-primary {
    flex: 1 1 100%;
  }
}

@media print {
  body {
    background: #ffffff;
    font-size: 12pt;
  }

  .page-wrap {
    max-width: 100%;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .card {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .results-section,
  .results-panel {
    display: block !important;
  }

  .result-card.positive .value,
  .result-mini .value.positive {
    color: #1f7a3a !important;
  }

  .result-card.negative .value,
  .result-mini .value.negative {
    color: #b83232 !important;
  }

  .sensitivity-table .positive {
    color: #1f7a3a !important;
  }

  .sensitivity-table .negative {
    color: #b83232 !important;
  }
}
