/* ============================================================
   BMI Calculator — Nahnu Media v2.0.0
   Brand: #111 bg · #FF6A00 accent · white text · dark cards
   ============================================================ */

/* ---------- Reset & box model ---------- */
.bmi-wrap,
.bmi-wrap *,
.bmi-wrap *::before,
.bmi-wrap *::after {
  box-sizing: border-box;
}

/* ---------- CSS custom properties ---------- */
.bmi-wrap {
  --primary:        #FF6A00;
  --primary-dark:   #e05800;
  --surface:        #1a1a1a;
  --surface-2:      #222222;
  --surface-3:      #2a2a2a;
  --border:         #2e2e2e;
  --text:           #ffffff;
  --text-muted:     #8a8a8a;
  --text-secondary: #b0b0b0;
  --error:          #ff4d4d;
  --radius-card:    18px;
  --radius-input:   12px;
  --radius-pill:    999px;

  width: 100%;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 12px;
  background: transparent;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
}

/* ---------- Two-column layout ---------- */
.bmi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  min-width: 0;
}

@media (min-width: 900px) {
  .bmi-grid {
    grid-template-columns: 380px 1fr;
    gap: 20px;
  }
}

.bmi-grid > * {
  min-width: 0;
  width: 100%;
}

/* ---------- Form card ---------- */
.bmi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  min-width: 0;
}

.bmi-form {
  padding: 18px;
}

/* ---------- Results panel ---------- */
.bmi-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  min-width: 0;
}

.bmi-results.is-hidden { display: none; }

.bmi-head {
  background: #000;
  border-bottom: 2px solid var(--primary);
  padding: 16px 20px;
}
.bmi-h-title {
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.bmi-h-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.bmi-body { padding: 16px 18px; }

/* ---------- Metric / Imperial tabs ---------- */
.bmi-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
  border: 1px solid var(--border);
  min-width: 0;
}
.bmi-tab {
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, transform 0.04s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.bmi-tab:hover { color: var(--text); }
.bmi-tab:active { transform: translateY(1px); }
.bmi-tab[aria-selected='true'] {
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

/* ---------- Form grid ---------- */
.bmi-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

@media (max-width: 540px) {
  .bmi-form-grid { grid-template-columns: 1fr; }
}

.bmi-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bmi-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

/* Inputs & selects */
.bmi-input,
.bmi-select {
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 15px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.bmi-input::placeholder { color: var(--text-muted); }
.bmi-input:hover,
.bmi-select:hover { border-color: #444; }
.bmi-input:focus,
.bmi-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.18);
}

/* Custom select arrow */
.bmi-select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8a8a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) 50%;
  background-size: 12px 8px;
}

/* ft/in split */
.bmi-ftin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}

.bmi-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
}

/* ---------- Actions ---------- */
.bmi-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.bmi-btn {
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.04s;
  white-space: nowrap;
}
.bmi-btn:hover  { opacity: 0.88; }
.bmi-btn:active { transform: translateY(1px); }
.bmi-primary { background: var(--primary); color: #fff; }
.bmi-ghost {
  background: var(--surface-3);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.bmi-ghost:hover { color: var(--text); border-color: #444; }

.bmi-error {
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  display: none;
}
.bmi-error.is-visible { display: block; }

/* ---------- BMI hero ---------- */
.bmi-main {
  margin: 0 0 14px;
  padding: 18px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  text-align: center;
}
.bmi-main .big {
  font-size: 52px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}
.bmi-main .sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Category table ---------- */
.bmi-break {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 14px;
  margin-bottom: 12px;
  min-width: 0;
}
.bmi-b-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.bmi-cat-list { display: grid; gap: 3px; min-width: 0; }
.bmi-cat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.12s;
  gap: 8px;
  min-width: 0;
}
.bmi-cat-row:hover { background: var(--surface-3); }
.bmi-cat-row.is-active {
  background: rgba(255, 106, 0, 0.10);
  color: var(--text);
}
.bmi-cat-row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bmi-cat-row .range { flex-shrink: 0; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.bmi-cat-row.is-active .range { color: var(--primary); font-weight: 700; }

/* ---------- Charts ---------- */
.chart-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 14px;
  margin-bottom: 12px;
  min-width: 0;
}
.bmi-m-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.canvas-hold {
  position: relative;
  width: 100%;
  height: 230px;
  min-width: 0;
}
@media (max-width: 480px) { .canvas-hold { height: 180px; } }

.bmi-chart-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}
.bmi-tools-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

/* ---------- Note ---------- */
.bmi-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.bmi-note p { margin: 0; }

/* ---------- Utility ---------- */
.bmi-hidden  { display: none !important; }
.is-hidden   { display: none !important; }

/* ---------- Focus a11y ---------- */
.bmi-wrap :focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .bmi-tab, .bmi-btn { transition: none !important; }
}

/* ---------- RTL ---------- */
[dir='rtl'] .bmi-cat-row { flex-direction: row-reverse; }

/* ---------- Small screen tweaks ---------- */
@media (max-width: 480px) {
  .bmi-form  { padding: 14px; }
  .bmi-body  { padding: 12px 14px; }
  .bmi-main .big { font-size: 40px; }

  .bmi-actions {
    flex-direction: column;
  }
  .bmi-actions .bmi-btn {
    width: 100%;
    text-align: center;
  }
}
