.calcly-wrapper {
  background: #fff !important;
  color: #111827 !important;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  max-width: 520px;
  margin: 0 auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.calcly-header {
  text-align: center;
  margin-bottom: 16px;
}

.calcly-logo {
  font-weight: 700;
  font-size: 1.6em;
  color: #1e66f5;
}

.calcly-subtitle {
  color: #374151;
  font-size: 0.95em;
}

.calcly-field {
  margin-bottom: 14px;
}

.calcly-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.calcly-form input {
  width: 100%;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1em;
}

.imperial-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.calcly-btn {
  background: linear-gradient(90deg,#1e66f5,#3b82f6);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.calcly-btn.ghost {
  background: transparent;
  border: 2px solid #1e66f5;
  color: #1e66f5;
}

.calcly-btn:hover {
  opacity: 0.9;
}

.calcly-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.calcly-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.calcly-card {
  flex: 1 1 140px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  text-align: center;
  padding: 12px;
  background: #fff;
}

.calcly-card .value {
  font-size: 1.4em;
  font-weight: 600;
  color: #111827;
}

.calcly-footer {
  margin-top: 16px;
  color: #6b7280;
  font-size: 12px;
  text-align: center;
}

.hidden { display: none !important; }

.calcly-toggle {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.calcly-toggle label {
  font-weight: 500;
  color: #374151;
}

/* --- BMI SCALE BAR --- */
.bmi-bar-container {
  margin-top: 24px;
  text-align: center;
  position: relative;
}

.bmi-category-label {
  font-weight: 700;
  margin-bottom: 8px;
  color: #1e293b;
  font-size: 1em;
}

.bmi-bar {
  position: relative;
  display: flex;
  height: 18px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: inset 0 0 3px rgba(0,0,0,0.15);
  cursor: pointer;
}

.bmi-segment {
  flex: 1;
  position: relative;
  transition: all 0.35s ease;
}

.bmi-segment.under { background: #60a5fa; }
.bmi-segment.healthy { background: #34d399; }
.bmi-segment.over { background: #facc15; }
.bmi-segment.obese { background: #f87171; }

/* Active category highlight */
.bmi-segment.active {
  flex: 1.2;
  height: 26px;
  margin-top: -4px;
  box-shadow: 0 0 12px rgba(0,0,0,0.25), 0 0 15px rgba(255,255,255,0.5) inset;
  z-index: 2;
  filter: brightness(1.15);
  animation: barGlow 2.2s ease-in-out infinite;
}

/* Embedded arrow (colour set dynamically by JS) */
.bmi-arrow {
  position: absolute;
  top: 0;
  width: 10px;
  height: 100%;
  background: rgba(17,24,39,0.9);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
  transform: translateX(-50%);
  transition: left 0.5s ease, background 0.3s ease;
  z-index: 3;
}

/* Tooltip styling */
.bmi-tooltip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,24,39,0.95);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 0.8em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 9999; /* ensures tooltips are above everything */
}

.bmi-segment:hover .bmi-tooltip,
.bmi-segment:focus .bmi-tooltip,
.bmi-segment.show-tip .bmi-tooltip {
  opacity: 1;
}

/* Category labels */
.bmi-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75em;
  color: #6b7280;
  margin-top: 4px;
}

/* GP / Doctor Disclaimer */
.calcly-warning {
  margin-top: 16px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 10px;
  border-radius: 8px;
  color: #92400e;
  font-size: 0.85em;
  line-height: 1.4em;
}

/* Subtle glow animation for active bar */
@keyframes barGlow {
  0%, 100% {
    box-shadow: 0 0 12px rgba(0,0,0,0.25), 0 0 15px rgba(255,255,255,0.4) inset;
  }
  50% {
    box-shadow: 0 0 18px rgba(0,0,0,0.35), 0 0 25px rgba(255,255,255,0.7) inset;
  }
}

/* Responsive */
@media(max-width: 640px) {
  .calcly-cards { flex-direction: column; }
  .calcly-actions { flex-direction: column; }
  .bmi-arrow { width: 8px; }
}
