/* BMI — form + animated gauge dashboard */

.bmi-app {
  margin-top: 8px;
  --bmi-accent: #6366f1;
  --bmi-accent-soft: #a78bfa;
}

.bmi-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 520px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--lx-border);
  background: var(--lx-surface);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.07);
}

/* —— Form —— */
.bmi-panel--form {
  padding: 28px 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    radial-gradient(100% 80% at 100% 0%, rgba(124, 58, 237, 0.06), transparent 50%),
    linear-gradient(180deg, #fff 0%, #fafbfd 100%);
}

.bmi-head__title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 900;
  color: var(--lx-ink);
}

.bmi-head__sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--lx-ink-soft);
}

.bmi-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bmi-form__core {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bmi-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bmi-field span {
  font-size: 12px;
  font-weight: 800;
  color: var(--lx-ink-soft);
}

.bmi-field__wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--lx-border);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.bmi-field__wrap:focus-within {
  border-color: var(--lx-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.bmi-field__wrap input,
.bmi-field select {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--lx-ink);
}

.bmi-field__wrap input:focus,
.bmi-field select:focus {
  outline: none;
}

.bmi-field__wrap em {
  font-size: 12px;
  font-weight: 700;
  color: var(--lx-silver-500);
  font-style: normal;
}

.bmi-field select {
  height: 48px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--lx-border);
  background: #fff;
}

.bmi-more {
  border-radius: 14px;
  border: 1px dashed rgba(124, 58, 237, 0.22);
  background: rgba(124, 58, 237, 0.03);
  padding: 0 12px;
}

.bmi-more summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 4px;
  font-size: 12px;
  font-weight: 800;
  color: var(--lx-purple);
}

.bmi-more summary::-webkit-details-marker {
  display: none;
}

.bmi-more__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-bottom: 12px;
}

.bmi-field--wide {
  grid-column: 1 / -1;
}

.bmi-submit {
  position: relative;
  height: 50px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.bmi-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.bmi-submit:disabled {
  opacity: 0.8;
  cursor: wait;
}

.bmi-submit__spin {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  opacity: 0;
}

.bmi-submit.is-loading .bmi-submit__text {
  opacity: 0;
}

.bmi-submit.is-loading .bmi-submit__spin {
  opacity: 1;
  animation: bmi-spin 0.7s linear infinite;
}

/* —— Viz dashboard —— */
.bmi-panel--viz {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: #0c0f1a;
  overflow: hidden;
}

.bmi-dash {
  position: relative;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  z-index: 1;
}

.bmi-dash__orbs {
  position: absolute;
  inset: -40% -30%;
  pointer-events: none;
  z-index: 0;
}

.bmi-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
  animation: bmi-orb-float 8s ease-in-out infinite;
}

.bmi-orb--1 {
  width: 180px;
  height: 180px;
  top: 10%;
  right: 5%;
  background: var(--bmi-accent, #6366f1);
  animation-delay: 0s;
}

.bmi-orb--2 {
  width: 140px;
  height: 140px;
  bottom: 15%;
  left: 0;
  background: #38bdf8;
  opacity: 0.35;
  animation-delay: -3s;
}

.bmi-orb--3 {
  width: 100px;
  height: 100px;
  top: 50%;
  left: 40%;
  background: #a78bfa;
  opacity: 0.3;
  animation-delay: -5s;
}

.bmi-gauge {
  position: relative;
  width: min(100%, 260px);
  aspect-ratio: 1;
  z-index: 1;
}

.bmi-gauge__svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.bmi-gauge__track {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-linecap: round;
  stroke-dasharray: 414 552;
  stroke-dashoffset: 0;
  transform: rotate(135deg);
  transform-origin: 50% 50%;
}

.bmi-gauge__fill {
  stroke-linecap: round;
  stroke-dasharray: 414 552;
  stroke-dashoffset: 414;
  transform: rotate(135deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.34, 1.2, 0.64, 1), stroke 0.5s ease;
}

.bmi-app.is-calculating .bmi-gauge__fill {
  animation: bmi-gauge-pulse 0.8s ease-in-out infinite;
}

.bmi-gauge__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.bmi-gauge__val {
  font-size: clamp(42px, 10vw, 52px);
  font-weight: 900;
  line-height: 1;
  color: #fff;
  letter-spacing: -0.02em;
  transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.bmi-app.is-updated .bmi-gauge__val {
  animation: bmi-pop 0.45s ease;
}

.bmi-gauge__unit {
  font-size: 12px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.12em;
}

.bmi-gauge__cat {
  margin-top: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--bmi-accent, #6366f1);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--bmi-accent) 50%, transparent);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.bmi-zones {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 1;
}

.bmi-zones li {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.35s ease;
}

.bmi-zones li.is-active {
  color: #fff;
  border-color: color-mix(in srgb, var(--bmi-accent) 60%, transparent);
  background: color-mix(in srgb, var(--bmi-accent) 25%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--bmi-accent) 30%, transparent);
}

.bmi-scale {
  position: relative;
  width: 100%;
  z-index: 1;
}

.bmi-scale__bar {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8 0%, #34d399 32%, #fbbf24 62%, #f87171 100%);
  opacity: 0.85;
}

.bmi-scale__pin {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--bmi-accent, #34d399);
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  transition: left 0.85s cubic-bezier(0.34, 1.2, 0.64, 1), background 0.4s ease;
}

.bmi-scale__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
}

.bmi-whtr {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  z-index: 1;
}

.bmi-whtr__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.bmi-whtr__label {
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.55);
}

.bmi-whtr__val {
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  direction: ltr;
}

.bmi-whtr__track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bmi-whtr__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.6s cubic-bezier(0.34, 1.2, 0.64, 1), background 0.4s ease;
}

.bmi-whtr__mark {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  background: rgba(255, 255, 255, 0.65);
  transform: translateX(-50%);
  transition: left 0.5s ease;
}

.bmi-whtr__cat {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 800;
  transition: color 0.35s ease;
}

.bmi-insights {
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
}

.bmi-insights[hidden] {
  display: none;
}

.bmi-insights__item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.bmi-insights__title {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
}

.bmi-insights__text {
  display: block;
  font-size: 11px;
  line-height: 1.65;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
}

.bmi-insights__item.is-ok {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}

.bmi-insights__item.is-warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

.bmi-insights__item.is-danger {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.bmi-insights__item.is-info {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.bmi-insights__item.is-neutral {
  border-color: rgba(255, 255, 255, 0.12);
}

.bmi-app.is-central-risk .bmi-gauge__cat::after {
  content: ' · ریسک شکمی';
}

.bmi-app.is-central-risk .bmi-orb--1 {
  background: #fbbf24;
}

.bmi-app.is-child .bmi-gauge__cat::after {
  content: ' · غیراستاندارد برای سن';
}

.bmi-app.is-elderly .bmi-dash {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.15);
  border-radius: 18px;
}

@keyframes bmi-orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(12px, -16px) scale(1.06); }
  66% { transform: translate(-10px, 10px) scale(0.94); }
}

@keyframes bmi-gauge-pulse {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50% { opacity: 0.85; filter: brightness(1.15); }
}

@keyframes bmi-pop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes bmi-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .bmi-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .bmi-panel--viz {
    order: -1;
    padding: 28px 20px;
  }

  .bmi-form__core {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .bmi-panel--form {
    padding: 20px 16px 22px;
  }

  .bmi-more__grid {
    grid-template-columns: 1fr;
  }
}
