/* ── Blood Alcohol Calculator – Styles ───────────────────────────────────── */

.bac-calc-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 760px;
  margin: 2rem auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.08);
  color: #1e293b;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.bac-calc__header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.bac-calc__icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.bac-calc__title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  color: #0f172a;
}

.bac-calc__desc {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* ── Safety banner ───────────────────────────────────────────────────────── */

.bac-calc__safety-banner {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #7f1d1d;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* ── Unit toggle ─────────────────────────────────────────────────────────── */

.bac-calc__toggle-wrap {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.bac-calc__toggle {
  padding: 0.45rem 1.2rem;
  border: 2px solid #475569;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.bac-calc__toggle--active {
  background: #475569;
  color: #fff;
}

/* ── Fieldsets ───────────────────────────────────────────────────────────── */

.bac-calc__fieldset {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  margin: 0 0 1.4rem;
}

.bac-calc__legend {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.25rem;
  flex-wrap: wrap;
}

.bac-calc__legend--toggle {
  cursor: pointer;
  user-select: none;
}

.bac-calc__legend-chevron {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: auto;
  transition: transform 0.2s;
}

.bac-calc__legend-chevron.open {
  transform: rotate(180deg);
}

.bac-calc__advanced-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.bac-calc__advanced-body.open {
  max-height: 300px;
  margin-top: 1rem;
}

/* ── Grid / Fields ───────────────────────────────────────────────────────── */

.bac-calc__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.bac-calc__row--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 600px) {
  .bac-calc__row, .bac-calc__row--3 {
    grid-template-columns: 1fr;
  }
}

.bac-calc__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.bac-calc__field label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #374151;
}

.bac-calc__field input[type="number"],
.bac-calc__field select {
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.97rem;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.bac-calc__field input:focus,
.bac-calc__field select:focus {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
  background: #fff;
}

.bac-calc__hint {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* ── Drink list ──────────────────────────────────────────────────────────── */

.bac-calc__drinks-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.bac-calc__drink-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

@media (max-width: 520px) {
  .bac-calc__drink-row {
    grid-template-columns: 1fr 1fr;
  }
}

.bac-calc__drink-row select,
.bac-calc__drink-row input {
  padding: 0.5rem 0.7rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  color: #0f172a;
  background: #f8fafc;
  width: 100%;
  box-sizing: border-box;
}

.bac-calc__drink-row select:focus,
.bac-calc__drink-row input:focus {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

.bac-calc__drink-remove {
  width: 32px;
  height: 32px;
  border: 1.5px solid #fca5a5;
  border-radius: 6px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.bac-calc__drink-remove:hover {
  background: #fee2e2;
}

.bac-calc__add-drink-btn {
  padding: 0.3rem 0.85rem;
  border: 1.5px solid #dc2626;
  border-radius: 6px;
  background: transparent;
  color: #dc2626;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
  transition: background 0.15s, color 0.15s;
}

.bac-calc__add-drink-btn:hover {
  background: #dc2626;
  color: #fff;
}

/* ── Presets ─────────────────────────────────────────────────────────────── */

.bac-calc__drink-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  background: #fef2f2;
  border-radius: 8px;
}

.bac-calc__preset-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #dc2626;
}

.bac-calc__preset {
  padding: 0.3rem 0.8rem;
  border: 1.5px solid #fca5a5;
  border-radius: 20px;
  background: #fff;
  color: #991b1b;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.bac-calc__preset:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.bac-calc__btn-wrap {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.bac-calc__btn {
  padding: 0.75rem 2.2rem;
  border: none;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.bac-calc__btn:hover {
  background: #b91c1c;
}

.bac-calc__btn:active {
  transform: scale(0.97);
}

.bac-calc__btn--reset {
  background: #e2e8f0;
  color: #334155;
}

.bac-calc__btn--reset:hover {
  background: #cbd5e1;
}

/* ── Results ─────────────────────────────────────────────────────────────── */

.bac-calc__results {
  margin-top: 2rem;
  border-top: 2px solid #f1f5f9;
  padding-top: 1.75rem;
}

/* BAC Gauge */
.bac-calc__gauge-section {
  margin-bottom: 1.5rem;
}

.bac-calc__gauge-wrap {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.bac-calc__gauge {
  width: 180px;
  height: 90px;
  border-radius: 180px 180px 0 0;
  background: conic-gradient(
    #22c55e 0deg 54deg,
    #84cc16 54deg 108deg,
    #facc15 108deg 144deg,
    #f97316 144deg 162deg,
    #ef4444 162deg 180deg
  );
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.bac-calc__gauge::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  background: #fff;
  border-radius: 50%;
}

.bac-calc__gauge-needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 3px;
  height: 78px;
  background: #1e293b;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-90deg);
  border-radius: 2px 2px 0 0;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.bac-calc__bac-display {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.bac-calc__bac-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
}

.bac-calc__bac-value {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  color: #0f172a;
  transition: color 0.4s;
}

.bac-calc__bac-status {
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
}

.bac-status--safe     { background:#dcfce7; color:#15803d; }
.bac-status--caution  { background:#fef9c3; color:#a16207; }
.bac-status--illegal  { background:#ffedd5; color:#c2410c; }
.bac-status--danger   { background:#fee2e2; color:#dc2626; }
.bac-status--critical { background:#7f1d1d; color:#fff; }

/* Result cards */
.bac-calc__results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 520px) {
  .bac-calc__results-grid { grid-template-columns: 1fr; }
}

.bac-calc__result-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bac-calc__result-card--sober {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.bac-calc__result-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
}

.bac-calc__result-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0f172a;
}

.bac-calc__result-sub {
  font-size: 0.73rem;
  color: #94a3b8;
}

/* ── Effects table ───────────────────────────────────────────────────────── */

.bac-calc__effects {
  margin-bottom: 1rem;
}

.bac-calc__effects-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #374151;
  margin: 0 0 0.75rem;
}

.bac-calc__effects-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bac-calc__effect-row {
  display: grid;
  grid-template-columns: 130px 1fr 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: background 0.2s;
}

.bac-calc__effect-row.bac-effect--active {
  background: #fef2f2;
  outline: 2px solid #fca5a5;
}

@media (max-width: 520px) {
  .bac-calc__effect-row {
    grid-template-columns: 1fr;
  }
}

.bac-calc__effect-range {
  font-size: 0.78rem;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}

.bac-calc__effect-bar-wrap {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.bac-calc__effect-bar {
  height: 100%;
  border-radius: 999px;
}

.bac-calc__effect-desc {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.45;
}

/* ── Disclaimer ──────────────────────────────────────────────────────────── */

.bac-calc__disclaimer {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 1rem;
  line-height: 1.6;
}

/* ── Error ───────────────────────────────────────────────────────────────── */

.bac-calc__error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 600;
}
