/* ==========================================================================
   Anamnez formu — çok aşamalı form sayfası.
   Ana siteyle aynı tema değişkenlerini kullanır (style.css'ten sonra yüklenir).
   ========================================================================== */

.anamnez { padding: clamp(1.75rem, 4vw, 3.5rem) 0 var(--section-y); }

.container--form { max-width: 920px; }

/* --- Başlık --------------------------------------------------------------- */

.anamnez__head { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }

.anamnez__title {
  margin: 0 0 0.9rem;
  font-size: var(--font-size-anam-title, clamp(1.65rem, 1.25rem + 1.9vw, 2.5rem));
  color: var(--brand);
  text-wrap: balance;
}

.anamnez__lead { margin: 0 0 1.25rem; max-width: 62ch; font-size: var(--font-size-anam-desc, 16px); color: var(--ink-soft); }

/* Tıbbi uyarı: göz ardı edilmemesi için belirgin ama sakin. */
.anamnez__warn {
  display: flex;
  gap: 0.7rem;
  margin: 0;
  padding: 0.9rem 1.1rem;
  border-left: 4px solid var(--accent-2);
  border-radius: 0 12px 12px 0;
  background: color-mix(in srgb, var(--accent-2) 10%, var(--surface));
  font-size: 0.9rem;
  color: var(--ink);
}

/* --- İlerleme göstergesi --------------------------------------------------- */

.steps-bar {
  position: sticky;
  top: 84px;
  z-index: 20;
  margin-bottom: 1.75rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.steps-bar__track {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}
.steps-bar__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.35s var(--ease);
}

.steps-bar__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}
.steps-bar__list li { flex: none; }

.steps-bar__list button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0.35rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.steps-bar__list button:hover:not(:disabled) { background: var(--bg-soft); color: var(--brand); }
.steps-bar__list button:disabled { cursor: default; opacity: 0.65; }
.steps-bar__list button .num {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 700;
  flex: none;
}
.steps-bar__list .is-current button { color: var(--brand); font-weight: 700; border-color: var(--line-strong); }
.steps-bar__list .is-current button .num { background: var(--accent); color: #fff; }
.steps-bar__list .is-done button .num { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--brand-deep); }

.steps-bar__count { margin: 0.65rem 0 0; font-size: 0.8rem; color: var(--ink-muted); }

/* --- Form panelleri -------------------------------------------------------- */

.anamnez__form {
  padding: clamp(1.35rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.step-panel { animation: stepin 0.28s var(--ease); }
@keyframes stepin { from { opacity: 0; transform: translateY(8px); } }

.step-panel__title {
  margin: 0 0 0.6rem;
  font-size: var(--font-size-anam-step-title, clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem));
  color: var(--brand);
}
.anamnez__form .label { font-size: var(--font-size-anamnesis-label, 14px); }
.anamnez__form .input,
.anamnez__form .textarea,
.anamnez__form .select { font-size: max(16px, var(--font-size-anam-input, 16px)); }
.anamnez__form .help { font-size: var(--font-size-anam-help, 13px); }
.consents .consent { font-size: var(--font-size-anam-consent, 14px); }
#btn-prev, #btn-next { font-size: var(--font-size-anam-navbtn, 15px); }
#btn-submit { font-size: var(--font-size-anam-submit, 16px); }
.step-panel__note {
  margin: 0 0 1.5rem;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.help { margin: 0.35rem 0 0; font-size: 0.82rem; color: var(--ink-muted); }

/* --- Dosya yükleme --------------------------------------------------------- */

.upload-box {
  margin-top: 1.75rem;
  padding: 1.15rem 1.25rem 1.35rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--surface-2);
}
.upload-box__title { margin: 0 0 0.4rem; font-size: 1rem; color: var(--brand); }
.upload-box__note { margin: 0 0 0.9rem; font-size: 0.85rem; color: var(--ink-muted); }
.upload-box input[type="file"] { padding: 0.6rem; background: var(--surface); }

.upload-box__list { margin: 0.85rem 0 0; display: grid; gap: 0.45rem; }
.upload-box__list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
}
.upload-box__list svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.upload-box__list .size { margin-left: auto; color: var(--ink-muted); font-size: 0.78rem; white-space: nowrap; }
.upload-box__list .is-bad { color: #b3392b; }

.upload-box__privacy {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* --- Fizyolojik bulgular: açılır çoklu seçim ------------------------------ */

.findings { margin-top: 1.75rem; }
.findings .help { margin-bottom: 0.6rem; }

.dropdown { position: relative; }

/* Kapalı hâlde bir select gibi görünür; seçim özeti burada yazar. */
.dropdown__toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 48px;
  padding: 0.72rem 0.95rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: max(16px, var(--font-size-anam-input, 16px));
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.dropdown__toggle:hover { border-color: var(--accent); }
.dropdown.is-open .dropdown__toggle {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.dropdown__value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dropdown__arrow { width: 18px; height: 18px; flex: none; color: var(--ink-muted); transition: transform var(--t-fast); }
.dropdown.is-open .dropdown__arrow { transform: rotate(180deg); }

/* Panel: yüksekliği sınırlı, kendi içinde kaydırılır. Bütün seçenekler
   aynı anda ekranı kaplamaz. */
.dropdown__panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(340px, 55vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.35rem;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dropdown__item { border-bottom: 1px solid var(--line); }
.dropdown__item:last-child { border-bottom: 0; }
.dropdown__item--none { border-top: 1px solid var(--line-strong); }

.dropdown__opt {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  /* Rahat dokunma hedefi (≈44px). */
  min-height: 44px;
  padding: 0.6rem 0.5rem;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
}
.dropdown__opt:hover { background: var(--bg-soft); border-radius: 8px; }
.dropdown__opt input {
  width: 20px; height: 20px;
  margin: 1px 0 0;
  flex: none;
  accent-color: var(--accent);
}
.dropdown__opt span { min-width: 0; overflow-wrap: anywhere; }

/* Seçilen bulgunun hemen altındaki kısa not alanı. */
.dropdown__note { padding: 0 0.5rem 0.65rem 2.35rem; }
.input--sm { min-height: 42px; padding: 0.5rem 0.75rem; font-size: max(16px, 0.9rem); }

/* Kapalı panelde seçili bulguların özeti. */
.findings__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
}
.findings__chips li {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  color: var(--brand-deep);
  font-size: 0.8rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* --- Form içi alt bölümler (adet / menstrüel döngü) ----------------------- */

.subsection {
  margin: 1.75rem 0 0;
  padding: 1.15rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-2);
}
.subsection__title {
  padding: 0 0.4rem;
  font-family: var(--font-heading, var(--heading-font));
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand);
}
.subsection .step-panel__note { margin-bottom: 1.1rem; }
.subsection .field:last-child { margin-bottom: 0; }

.choices--wrap { gap: 0.5rem; }
.choice--sm { min-height: 44px; padding: 0.45rem 0.9rem; font-size: 0.88rem; }
.textarea--sm { min-height: 84px; }

/* --- 24 saatlik beslenme kaydı -------------------------------------------- */

.recall { display: grid; gap: 0.9rem; margin-bottom: 1.5rem; }

.recall__meal {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.recall__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}
.recall__name { font-weight: 600; color: var(--brand); }
.recall__time { margin-left: auto; width: 140px; flex: none; }
.recall__time .input { min-height: 42px; }

.recall__grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0.75rem; }
.recall__grid .textarea { min-height: 76px; }

/* --- Özet ------------------------------------------------------------------ */

.summary { display: grid; gap: 0.85rem; margin-bottom: 1.75rem; }

.summary__block {
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.summary__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}
.summary__head h3 { margin: 0; font-size: 0.98rem; color: var(--brand); }
.summary__edit {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  padding: 0 0.3rem;
}
.summary__edit:hover { text-decoration: underline; }

.summary__list { display: grid; gap: 0.4rem; margin: 0; }
.summary__list div {
  display: grid;
  grid-template-columns: minmax(140px, 34%) 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.88rem;
}
.summary__list dt { color: var(--ink-muted); }
.summary__list dd { margin: 0; color: var(--ink); word-break: break-word; white-space: pre-line; }
.summary__empty { margin: 0; font-size: 0.86rem; color: var(--ink-muted); font-style: italic; }

/* --- Aydınlatma metni ------------------------------------------------------ */

.notice-box {
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
}
.notice-box > summary {
  padding: 0.95rem 1.15rem;
  min-height: 50px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--brand);
  list-style: none;
}
.notice-box > summary::-webkit-details-marker { display: none; }
.notice-box > summary::after {
  content: "＋";
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
}
.notice-box[open] > summary::after { content: "−"; }
.notice-box__body {
  padding: 0 1.15rem 1.2rem;
  font-size: 0.89rem;
  color: var(--ink-soft);
  max-height: 260px;
  overflow-y: auto;
}
.notice-box__body p { margin-bottom: 0.85rem; }

/* --- Onay kutuları --------------------------------------------------------- */

.consents { display: grid; gap: 0.7rem; }

.consents .consent {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.consents .consent:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.consents .consent.is-invalid { border-color: #b3392b; }

/* Sağlık verisi rızası ayrı ve daha belirgin durur. */
.consent--health {
  border-left-width: 4px !important;
  border-left-color: var(--accent) !important;
}

/* --- Adım butonları -------------------------------------------------------- */

.step-nav {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
#btn-next, #btn-submit { margin-left: auto; }

/* --- Başarı ekranı --------------------------------------------------------- */

.done {
  padding: clamp(2.25rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  text-align: center;
}
.done__mark {
  display: grid;
  place-items: center;
  width: 68px; height: 68px;
  margin: 0 auto 1.4rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}
.done__mark svg { width: 32px; height: 32px; }
.done__title { margin: 0 0 0.8rem; font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); }
.done__text { max-width: 52ch; margin: 0 auto 1.1rem; color: var(--ink-soft); }
.done__ref {
  display: inline-block;
  margin: 0 0 1.6rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 0.84rem;
  color: var(--ink-muted);
}
.done__actions { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }

/* --- Duyarlı --------------------------------------------------------------- */

@media (max-width: 1080px) {
  .steps-bar { top: 8px; }
}

@media (max-width: 860px) {
  .recall__grid { grid-template-columns: 1fr; }
  .summary__list div { grid-template-columns: 1fr; gap: 0.15rem; }
  .summary__list dt { font-size: 0.8rem; }
}

@media (max-width: 640px) {
  .anamnez__form { padding: 1rem; }
  .steps-bar { padding: 0.85rem 0.9rem; }

  /* Dar ekranda panel daha kısa durur ve klavye açılınca da kullanılabilir
     kalır. Not alanları bulgu adının hemen altında, tam genişlikte gelir. */
  .dropdown__panel { max-height: min(300px, 50vh); }
  .dropdown__note { padding-left: 0.5rem; }
  .subsection { padding: 1rem 0.9rem 1.1rem; }
  .choice--sm { width: 100%; }
  /* Dar ekranda adım etiketleri yerine yalnızca numaralar kalır. */
  .steps-bar__list button .txt { display: none; }
  .steps-bar__list button { padding: 0.3rem; }
  .steps-bar__list { gap: 0.3rem; }

  .recall__head { flex-wrap: wrap; }
  .recall__time { margin-left: 0; width: 100%; }

  .step-nav { flex-direction: column-reverse; }
  .step-nav .btn { width: 100%; margin-left: 0; }

  .done__actions .btn { width: 100%; }
}

@media print {
  .steps-bar, .step-nav, .nav, .footer { display: none !important; }
  .step-panel[hidden] { display: block !important; }
}
