/* ===== member medical questionnaire =====
   Every application form prints the medical history as a grid: one row per
   condition group, one column per member, each cell Y or N. Read for a whole
   family that grid is a long wall of cells, so the apply form asks it one
   member at a time in a pop-up: the client ticks Yes only where it applies, and
   every line left unticked is answered No on the insurer's form. */

.member-medical-block { gap: 0.3rem; }

.member-medical-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #cfdfe0;
  border-radius: 10px;
  background: #f4fafa;
  color: #014a52;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.member-medical-open:hover { background: #e9f4f5; border-color: #9ec7c9; }
.member-medical-open i { color: #016f6d; }

.member-medical-status {
  display: block;
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.35;
}

.member-medical-status.has-declared { color: #b45309; font-weight: 700; }

/* ---- the pop-up ---- */
.medical-dialog-overlay {
  position: fixed;
  inset: 0;
  /* Above the cover modal, which sits at z-index 9999. */
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgb(9, 25, 26, 0.66);
}

.medical-dialog-overlay[hidden] { display: none; }
body.medical-dialog-open { overflow: hidden; }

.medical-dialog {
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: min(88vh, 900px);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgb(9, 25, 26, 0.35);
  overflow: hidden;
}

.medical-dialog-head {
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid #eef2f2;
}

.medical-dialog-head h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
  color: var(--primary-navy, #013947);
  font-size: 1.05rem;
  font-weight: 800;
}

.medical-dialog-head h3 i { color: #016f6d; }

.medical-dialog-who {
  margin: 0 0 0.3rem;
  color: #013b46;
  font-size: 0.86rem;
  font-weight: 700;
}

.medical-dialog-lead {
  margin: 0;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.4;
}

.medical-dialog-rows {
  padding: 0.5rem 0.75rem;
  overflow-y: auto;
}

.medical-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  padding: 0.6rem 0.35rem;
  border-bottom: 1px solid #f0f4f4;
}

.medical-row:last-child { border-bottom: 0; }

/* A line nobody has answered yet is tinted, so the ones still to do are the
   ones the eye lands on. */
.medical-row:not(.is-answered) { background: #fffdf6; }

.medical-row-answer {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.medical-answer {
  flex: 1 1 0;
  min-width: 0;
  min-height: 32px;
  padding: 0.32rem 0.4rem;
  border: 1.5px solid #d5e1e0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.medical-answer:hover { border-color: #9ec7c9; }

.medical-answer-yes.is-on {
  border-color: #b91c1c;
  background: #fdeaea;
  color: #b91c1c;
}

.medical-answer-no.is-on {
  border-color: #016f6d;
  background: #eaf4f5;
  color: #014a52;
}

.medical-row-label {
  margin: 0;
  color: #1e293b;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}

.medical-row-details { margin-top: 0.4rem; }

.medical-row-details label {
  display: block;
  margin-bottom: 0.2rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
}

.medical-row-details textarea {
  width: 100%;
  min-height: 54px;
  padding: 0.5rem 0.6rem;
  border: 1.5px solid #d1d9e6;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  resize: vertical;
}

.medical-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1rem 0.9rem;
  border-top: 1px solid #eef2f2;
  background: #fbfdfd;
}

.medical-dialog-count {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
}

.medical-dialog-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.medical-dialog-actions button {
  min-height: 40px;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.medical-dialog-clear {
  border: 1.5px solid #d5e1e0;
  background: #fff;
  color: #013b46;
}

.medical-dialog-clear:disabled { opacity: 0.5; cursor: default; }

.medical-dialog-save {
  border: 1.5px solid #014a52;
  background: #014a52;
  color: #fff;
}

.medical-dialog-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* The member's own row: waiting to be answered, or answered. */
.member-medical-status.is-pending { color: #b45309; font-weight: 700; }

.member-medical-open.application-field-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.13);
  color: #b91c1c;
}

@media (max-width: 640px) {
  .medical-dialog-overlay { padding: 0.6rem; }
  .medical-dialog { max-height: 92vh; }
  .medical-row {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.55rem 0.2rem;
  }
  .medical-row-label { font-size: 0.8rem; }
  .medical-dialog-foot { justify-content: stretch; }
  .medical-dialog-actions { width: 100%; }
  .medical-dialog-actions button { flex: 1; }
}
