/*
 * BonedOut.com - Calculator Styles
 * Use this in addition to style.css for calculator pages
 * Handles: packout calculator, meat calculator, and future calculators
 */

/* ============================================
   CALCULATOR WRAPPER
   ============================================ */
.calc-wrap {
  color: var(--text);
  max-width: 100%;
  overflow-x: hidden;
}

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

/* ============================================
   CALCULATOR-SPECIFIC LAYOUT
   ============================================ */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 960px) {
  .calc-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

/* Calculator Cards - Override default for form-heavy layouts */
.calc-wrap .card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 1rem;
}

.calc-wrap .card h2,
.calc-wrap .card h3 {
  margin: 0 0 0.6rem;
  color: #d6e9ff;
}

.calc-wrap .card.soft {
  margin-top: 1rem;
}

/* ============================================
   CALCULATOR FORM LAYOUTS
   ============================================ */
/* Row Layouts for Form Fields */
.calc-row {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.calc-row.two {
  grid-template-columns: 1fr 1fr;
}

.calc-row.three {
  grid-template-columns: repeat(3, 1fr);
}

.calc-row.four {
  grid-template-columns: repeat(4, 1fr);
}

/* Stack on mobile */
@media (max-width: 640px) {
  .calc-row.two,
  .calc-row.three,
  .calc-row.four {
    grid-template-columns: 1fr;
  }
}

/* Field Groups */
.field {
  display: flex;
  flex-direction: column;
}

.field label {
  display: block;
  margin: 0.2rem 0 0.35rem;
  color: var(--text);
  font-size: 0.9rem;
}

.field small {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

/* ============================================
   CALCULATOR FORM CONTROLS
   ============================================ */
.calc-wrap input[type="number"],
.calc-wrap input[type="text"],
.calc-wrap select {
  width: 100%;
  padding: 0.72rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #0f1714;
  color: var(--text);
  font-family: inherit;
}

.calc-wrap input::placeholder {
  color: #a9b9c9;
}

.calc-wrap input:focus,
.calc-wrap select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 209, 165, 0.2);
}

/* ============================================
   CALCULATOR CHOICE/RADIO GROUPS
   ============================================ */
.choice,
.chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.choice input[type="radio"],
.chips input[type="radio"] {
  display: none;
}

.choice .chip,
.chips .chip {
  padding: 0.55rem 0.85rem;
  border: 2px solid #3a4b60;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  background: #0f1a24;
  font-weight: 600;
}

.choice input:checked + .chip,
.chips input:checked + .chip {
  background: var(--brand);
  border-color: var(--brand);
  color: #052916;
  box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.35);
}

.choice input:focus-visible + .chip,
.chips input:focus-visible + .chip {
  outline: 2px dashed #3a87ff;
  outline-offset: 2px;
}

/* ============================================
   TOGGLE SWITCHES
   ============================================ */
.toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
}

.toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 48px;
  height: 28px;
  background: #0b121a;
  border-radius: 20px;
  position: relative;
  border: 1px solid var(--stroke);
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle input:checked {
  background: #183024;
  border-color: #2f5c45;
}

.toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: left 0.2s ease, background 0.2s ease;
}

.toggle input:checked::after {
  left: 23px;
  background: #9ae6b4;
}

.toggle input:focus-visible {
  outline: 2px dashed var(--brand);
  outline-offset: 3px;
}

/* ============================================
   CALCULATOR ACTIONS
   ============================================ */
.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* ============================================
   CALCULATOR RESULTS - KPI DISPLAY
   ============================================ */
.kpis {
  display: grid;
  gap: 0.75rem;
}

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

@media (min-width: 720px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi {
  background: #0b121a;
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  padding: 0.8rem;
  color: var(--text);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.kpi b {
  display: block;
  font-size: 1.15rem;
  margin-top: 0.25rem;
  color: var(--text);
}

/* ============================================
   CALCULATOR TABLES
   ============================================ */
.calc-wrap table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.calc-wrap table thead,
.calc-wrap table tbody,
.calc-wrap table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.calc-wrap th,
.calc-wrap td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--stroke);
  text-align: left;
  color: var(--text);
}

.calc-wrap thead th {
  color: #cbe3ff;
  font-weight: 600;
}

.calc-wrap tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   CALCULATOR FOOTNOTES
   ============================================ */
.footnote {
  margin-top: 0.6rem;
  color: #9aa8b6;
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ============================================
   THEME CONTROL (Optional Light Mode)
   ============================================ */
.theme-control {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
  align-items: center;
}

.theme-control label {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.theme-control select {
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #0b121a;
  color: var(--text);
  width: auto;
}

/* Light Mode Theme Override (Optional) */
.calc-light {
  --bg: #ffffff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --stroke: #d0d7e2;
  --brand: #0ea5e9;
}

.calc-light .card {
  background: var(--card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.calc-light .kpi {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.calc-light input[type="number"],
.calc-light input[type="text"],
.calc-light select {
  background: #ffffff;
  color: #0f172a;
  border-color: #d0d7e2;
}

.calc-light .choice .chip,
.calc-light .chips .chip {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.calc-light .choice input:checked + .chip,
.calc-light .chips input:checked + .chip {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.35);
}

.calc-light .btn {
  background: #0ea5e9;
  color: #ffffff;
  border-color: #0ea5e9;
}

.calc-light .btn:hover {
  background: #0284c7;
  border-color: #0284c7;
}

.calc-light .btn.ghost {
  background: transparent;
  color: #0f172a;
  border-color: #cbd5e1;
}

.calc-light .btn.ghost:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.calc-light .toggle input {
  background: #e2e8f0;
}

.calc-light .toggle input:checked {
  background: #10b981;
}

.calc-light .theme-control select {
  background: #ffffff;
  color: #0f172a;
  border-color: #d0d7e2;
}

/* ============================================
   CALCULATOR PAGE TITLE
   ============================================ */
.page-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

/* ============================================
   RESPONSIVE CALCULATOR ADJUSTMENTS
   ============================================ */
@media (max-width: 640px) {
  .calc-wrap .card {
    padding: 1rem;
  }
  
  .actions {
    flex-direction: column;
  }
  
  .actions .btn {
    width: 100%;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .calc-wrap .card {
    padding: 1.25rem;
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (forced-colors: active) {
  .calc-wrap,
  .calc-wrap * {
    forced-color-adjust: auto;
  }
  
  .calc-wrap .card,
  .calc-wrap input,
  .calc-wrap select {
    background: Canvas;
    color: CanvasText;
    border: 1px solid ButtonText;
  }
  
  .calc-wrap .btn {
    background: Highlight;
    color: HighlightText;
    border: 1px solid Highlight;
  }
  
  .choice .chip {
    border-color: ButtonText;
  }
}
