/* assets/quiz.css - cleaned & consolidated
   - narrower layout (max-width 760px)
   - header uses CSS grid for badge + title
   - med-type pills, radio groups, and selects aligned with content
   - responsive adjustments
*/

:root{
  --accent: #f07a2b;
  --accent-weak: rgba(240,122,43,0.12);
  --muted: #f6f6f6;
  --danger: #d9534f;
  --content-max: 800px; /* main column width */
  --gutter: 20px;
  --radius: 8px;
  --font-stack: "Open Sans", Arial, sans-serif;
}

/* Container */
.iodine-quiz-root {
  max-width: var(--content-max);
  margin: 12px auto 60px;
  font-family: var(--font-stack);
  position: relative;
  background: #fff;
  padding: 0 18px;
  box-sizing: border-box;
  color: #111;
}

/* Progress */
.iq-progress-wrap {
  height: 6px;
  background: #fff;
  border-radius: 6px;
  margin-bottom: 18px;
  position: relative;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.03);
  overflow: visible;
}
.iq-progress {
  height: 6px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ffb07a);
  transition: width .28s ease;
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset;
}
.iq-progress-wrap::after{
  content: "";
  position: absolute;
  left: 0; right: 0; top: -6px; height: 3px;
  background: linear-gradient(90deg, var(--accent-weak), rgba(255,255,255,0));
  opacity: .9;
}

/* Frame (content area) */
.iq-frame {
  padding: 18px 0px;
  min-height: 220px;
  position: relative;
  transition: opacity .28s ease, transform .28s ease;
  box-sizing: border-box;
}
.iq-frame.iq-fade-out {
  opacity: 0.16;
  transform: translateY(-6px) scale(.997);
}

/* Header: left badge + title using grid */
.iq-section-header {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding: 0 6px;
}
.iq-step-left {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  flex: 0 0 44px;
}
.iq-title-wrap { display:flex; align-items:center; gap:8px; }
.iq-section-header h2 {
  margin: 0;
  font-size: 1.16rem;
  font-weight: 600;
  color: #111;
}
.iq-required-badge {
  background: var(--accent-weak);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight:700;
  font-size: .95rem;
}

/* Error */
.iq-error {
  background: #fff2f2;
  border: 1px solid #ffd2d2;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  display: none; /* shown by JS */
  box-sizing: border-box;
}

/* Radio questions */
.iq-radio p {
  margin: 0 0 10px 0;
  font-weight: 600;
}
.iq-radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 8px;
}

/* Choice pill */
.iq-choice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  user-select: none;
  background: #fff;
  transition: background .14s ease, box-shadow .14s ease, transform .12s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.iq-choice:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,0.06); }
.iq-choice input[type=radio], .iq-choice input[type=checkbox] { margin-right: 6px; accent-color: var(--accent); }
.iq-choice.selected { background: var(--accent-weak); border-color: var(--accent); }

/* Medication-specific layout */
.iq-med-wrap { margin-top: 6px; }
.iq-med-types { margin: 10px 0 12px; }
.iq-med-types > p { margin: 0 0 8px; font-weight:500; }

/* Render med-type pills inline and keep them aligned */
.iq-med-types .iq-choice { padding: 8px 12px; border-radius: 8px; }

/* Number inputs */
.iq-number { margin-top: 12px; }
.iq-number label { display:block; margin-bottom: 8px; font-weight:500; }
.iq-number input {
  padding: 10px;
  width: 160px;
  border-radius: var(--radius);
  border: 1px solid #eee;
  box-sizing: border-box;
}

/* Foods table (single page) */
.iq-food-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 18px;
}
.iq-food-table th, .iq-food-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #f2f2f2;
  text-align: left;
  vertical-align: middle;
}
.iq-food-table td:first-child { width: 60%; }
.iq-food-table select {
  padding: 10px;
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius);
  border: 1px solid #eee;
  background: #fff;
  box-sizing: border-box;
}

/* Single-food step (one select per step) */
.single-food-wrap p { margin: 0 0 8px 0; font-weight:600; }
.single-food-wrap select {
  width: 100%;
  max-width: 420px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid #eee;
  box-sizing: border-box;
}

/* Footer + buttons - constrained and centered */
.iq-footer {
  background: rgba(255,255,255,0.96);
  display:flex;
  justify-content:space-between;
  gap: 16px;
  margin: 22px auto 0;
  padding: 12px 8px;
  box-sizing: border-box;
  max-width: calc(var(--content-max) - 36px);
  border-top: 1px solid #fafafa;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.02);
  position: sticky;
  bottom: 12px;
  z-index: 999;
}
.iq-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #e9e9e9;
  background: #fff;
  cursor: pointer;
  min-width: 110px;
  font-weight: 700;
  color: #222;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.iq-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow:none; transform:none; }
.iq-btn-next, .iq-btn-primary { background: var(--accent); color:#fff; border-color: rgba(0,0,0,0.04); }
.iq-btn-prev { background:#fff; color:#333; }

/* Results box */
.iq-results { background:#fff; padding:16px; border:1px solid #f0f0f0; margin-top:18px; border-radius:10px; }

/* Email form */
.iq-email-form { margin-top: 12px; }

/* Small layout tweaks to align radio/check/select with title width */
.iq-radio, .iq-number, .single-food-wrap, .iq-food-table, .iq-med-wrap {
  /* ensure content follows title width and doesn't shift left */
  margin-left: 0;
  padding-left: 6px;
  box-sizing: border-box;
}

/* Tighter spacing */
.iq-radio p, .single-food-wrap p, .iq-number label { margin-bottom: 10px; }



/* Responsive */
@media (max-width: 600px) {
    .quiz-step {
        max-width: 100% !important;
        width: 100% !important;
    }

    .quiz-question, 
    .quiz-options,
    .quiz-medication-inputs,
    .quiz-food-frequency {
        width: 100% !important;
    }

    .quiz-nav-buttons {
        width: 100% !important;
        justify-content: space-between !important;
    }

    .quiz-nav-buttons button {
        flex: 1;
        margin: 0 5px;
    }
}


/* Accessibility focus */
.iq-choice:focus-within, .iq-choice:focus { outline: 2px solid rgba(240,122,43,0.18); outline-offset: 3px; }
.iq-btn:focus { box-shadow: 0 2px 8px rgba(0,0,0,0.06); outline: none; }
