:root{
  --hgc-sticky-offset: 85px;
}

/* Frontend styles */
.hgc-container body {
  margin: 0;
}
.hgc-container h1 {
  text-align: center;
  margin-bottom: 1rem;
}

.calculator-container {
  max-width: 1000px;
  margin: 0 auto;
  background: #fff;
  padding: 1.5rem 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  color: #333;
}
.parents {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.parent-field {
  flex: 1 1 480px;
  position: relative;
}
label {
  font-weight: bold;
  display: block;
  margin-bottom: 0.25rem;
}

.multi-select {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px;
  min-height: 40px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  cursor: text;
  background: #fff;
}
.multi-select input {
  border: none;
  flex: 1;
  min-width: 180px;
  padding: 6px;
  outline: none;
}
.tag {
  display: flex;
  align-items: center;
  background: #e0e0e0;
  border-radius: 12px;
  padding: 2px 8px;
  margin: 2px;
  font-size: 0.9rem;
}
.tag.combo {
  background: #d6e9ff;
}
.tag .x {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: bold;
  color: #555;
  margin-left: 6px;
}

.suggestions {
  position: absolute;
  z-index: 1000;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  /* On small screens, let the suggestion box expand to the full width of its parent */
  width: 100%;
  min-width: 100%;
}
.suggestions .group {
  font-weight: 700;
  padding: 4px 8px;
  font-size: 1rem;
  color: #fff;
  background: #ef7d00;
  position: sticky;
  top: 0;
  border-bottom: 1px solid #eee;
}
.suggestions .item {
  padding: 6px 10px;
  cursor: pointer;
}
.suggestions .item:hover {
  background-color: #fdfdfd;
  cursor: pointer;
  filter: brightness(0.95);
}
button {
  font-size: 0.95rem;
  padding: 6px 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f5f5f5;
  cursor: pointer;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
}
th,
td {
  padding: 6px 8px;
  border-bottom: 1px solid #ddd;
  text-align: left;
}
th {
  background: #f0f0f0;
}

/* ====== Badges  ====== */
.hgc .trait-badge {
  display: inline-block;
  padding: 4px 10px;
  margin: 2px 6px 2px 0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
}
.hgc .badge-incomplete {
  background: #00983a;
}
.hgc .badge-incomplete-super {
  background: #00983a;
}
.hgc .badge-recessive {
  background: #ef7d00;
}
.hgc .badge-recessive-het {
  background: #747474;
} /* 100% het */
.hgc .badge-recessive-poss-het {
  background: #f2af00;
} /* 1–99% het */
.hgc .badge-dominant {
  background: #7030a0;
}
.hgc .badge-polygenic {
  background: #2a6f9d;
}

.hidden {
  display: none;
}

/* Toggle switch */
.hgc .hgc-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}

.hgc .hgc-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
  user-select: none;
}

.hgc .hgc-switch input[type="checkbox"] {
  width: 42px;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: #e2e5e9;
  border-radius: 24px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
  border: 1px solid #d0d4d9;
}

.hgc .hgc-switch input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.hgc .hgc-switch input[type="checkbox"]:checked {
  background: #ef7d00;
  border-color: #ef7d00;
}

.hgc .hgc-switch input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

.hgc .hgc-switch-label {
  font-weight: 500;
}
/* ====== Layout container ====== */
.hgc {
  font-size: 16px;
  color: #222;
}

/* ====== Header: parents + actions (toggle/clear onder de parents) ====== */
.hgc-header {
  display: grid;
  grid-template-columns: 1fr; /* één kolom: eerst parents, daaronder actions */
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

/* Parents area (2 columns with center X on desktop) */
.hgc-parents {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  align-items: center;
  gap: 12px;
}

/* Parent card */
.hgc-parent-label {
  font-size: clamp(0.9rem, 0.5vw, 1rem);
  margin: 6px 0 -3px 2px;
}
.hgc .select {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e3e6eb;
  border-radius: 8px;
  background: #fff;
  /* Ensure suggestion lists positioned absolutely within this container are relative to it */
  position: relative;
}
.hgc .select input[type="text"] {
  border: none;
  outline: none;
  min-width: 140px;
  padding: 6px 4px;
  font-size: 14px;
}

.hgc-cross {
  text-align: center;
  font-weight: 600;
  color: #656d76;
  padding-top: 34px;
}

/* Toggle + Clear ONDER de parents, links uitgelijnd */
.hgc-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap; /* responsive: allow Share button to move to next line */
  justify-self: start; /* niet meer rechts */
  padding-top: 0; /* uitlijnen met de overige content */
  margin-top: 4px; /* kleine ruimte onder de parents */
}

.hgc-actions #shareBtn.btn-share{
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Toggle style (reusable) */
.hgc .hgc-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  font-size: 14px;
  color: #333;
}
.hgc .hgc-switch input[type="checkbox"] {
  width: 42px;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: #e2e5e9;
  border-radius: 24px;
  border: 1px solid #d0d4d9;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.hgc .hgc-switch input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.hgc .hgc-switch input[type="checkbox"]:checked {
  background: #ef7d00;
  border-color: #ef7d00;
}
.hgc .hgc-switch input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}
.hgc .hgc-switch-label {
  font-weight: 500;
  font-size: 12px;
  line-height: normal;
}

/* Clear button (consistent) */
.hgc .btn {
  display: inline-block;
  background: #ef7d00;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 20px;
}

.hgc .btn:hover {
  filter: brightness(0.95);
}


.btn.btn-share{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn.btn-share .btn-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.btn.btn-share svg{
  display: block;
}

.btn.btn-share svg path{
  fill: currentColor;
}
/* Tags used by the multiselect */
.hgc .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #eeeeee;
  color: #333;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}
.hgc .tag.combo {
  background: #c3c4c7;
  color: #333333;
}
.hgc .tag .x {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

/* ====== Table ====== */
.hgc table#results {
  border: 1px solid #eeeeee;
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

/* Interne cellen blijven subtiel */
.hgc th,
.hgc td {
  border-bottom: 1px solid #eaeaea;
}

/* Optioneel: geen extra rand onder de laatste rij */
.hgc table#results tr:last-child td {
  border-bottom: none;
}

.hgc table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.hgc th,
.hgc td {
  padding: 6px 4px !important;
  border-bottom: 1px solid #eaeaea;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}
.hgc th {
  background: #eeeeee;
  color: #444;
  font-weight: 600;
  font-size: clamp(1.05rem, 0.8vw, 1.2rem);
}
.hgc tr:hover td {
  filter: brightness(0.95);
}
.hgc .hidden {
  display: none;
}

/* ====== foutmelding ====== */
.hgc-notice {
  border: 1px solid #d63638;
  background: #fff5f5;
  color: #1e1e1e;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.35;
}

.hgc-notice.is-info {
  border-color: #ef7d00;
  background: #fff4e8;
}


/* ====== Responsive ====== */
@media (max-width: 720px) {
  .hgc-header {
    grid-template-columns: 1fr; /* alles onder elkaar */
    gap: 10px;
  }
  .hgc-parents {
    grid-template-columns: 1fr; /* parent 1, dan X, dan parent 2 (maar X apart tonen) */
    gap: 6px;
  }
  /* Toon de X los als divider */
  .hgc-cross {
    order: 2;
    width: 100%;
    text-align: center;
    padding-top: 6px;
    margin-bottom: -20px;
  }
  .hgc-parent:nth-child(1) {
    order: 1;
  }
  .hgc-parent:nth-child(3) {
    order: 3;
  }

  /* Toggle en Clear onder de parents, boven de tabel; uitlijnen links */
  .hgc-actions {
    justify-self: start;
    gap: 10px;
  }

  /* Kleinere paddings */
  .hgc .select {
    padding: 8px 10px;
  }
  .hgc .select input[type="text"] {
    min-width: 120px;
  }
  .hgc th,
  .hgc td {
    padding: 6px 4px !important;
    font-size: 13px;
  }
  .hgc .trait-badge {
    font-size: 12px;
    padding: 3px 8px;
  }
}

/* === Forceer toggle + Clear ONDER de invoervelden (desktop én mobiel) === */
.hgc .hgc-header {
  display: grid;
  grid-template-columns: 1fr !important; /* één kolom: eerst parents, daaronder actions */
  align-items: start;
  gap: 12px;
  margin-bottom: 30px;
}

.hgc .hgc-header .hgc-actions {
  justify-self: start !important; /* niet meer rechts */
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 0 !important; /* geen optische ophoging */
  margin-top: 4px; /* kleine ruimte onder de parents */
}

.hgc .hgc-header .hgc-cross {
  padding-top: 0 !important; /* was 34px; nu niet nodig */
}

/* Desktop: parents naast elkaar laten staan met 'X' ertussen */
@media (min-width: 721px) {
  .hgc .hgc-parents {
    grid-template-columns: 1fr 40px 1fr !important;
  }
}

/* --- Notes ---
Prefer using the .hgc wrapper + .hgc-header/.hgc-parents layout.
The older .hgc-container/.calculator-container styles are kept for backwards compatibility.
--- */


/* Spacing between action buttons */
.hgc .hgc-actions .btn + .btn {
  margin-right: 10px;
}


/* Share modal */
.hgc-modal.hidden {
  display: none;
}
.hgc-modal.open {
  display: flex;
}
.hgc-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
}
.hgc-modal-content {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}
.hgc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.hgc-modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}
.hgc-modal-close {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.hgc-modal-actions {
  display: grid;
  gap: 10px;
}
.hgc-modal-actions .btn {
  width: 100%;
  text-align: center;
}
.hgc .tag.is-invalid {
  border: 1px solid #d63638;
  background: #fff5f5;
  color: #d63638;
}
