/* ================= Teklif / modelleme sayfası ================= */

.tk-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(6.2rem, 11vw, 7.5rem) clamp(1rem, 4vw, 3rem) clamp(3rem, 7vw, 5rem);
}

.tk-intro { max-width: 46rem; margin-bottom: clamp(1.6rem, 4vw, 2.6rem); }

.tk-intro h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.02em;
}

.tk-lead { color: var(--muted); margin-top: 0.9rem; font-size: 1.02rem; }
.tk-lead strong { color: var(--text); }

.tk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(1.4rem, 3.5vw, 3rem);
  align-items: start;
}

/* ---------- Model ---------- */

.tk-model-wrap {
  position: sticky;
  top: 5.4rem;
  z-index: 5;
}

.tk-model {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 35%, rgba(143, 196, 232, 0.08), transparent 70%),
    var(--bg-soft);
  overflow: hidden;
}

#tkModel {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 62vh;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

#tkModel:active { cursor: grabbing; }

/* çizgiler ekranda sabit kalınlıkta kalsın (model ölçüye göre ölçeklenir) */
#tkModel polygon,
#tkModel polyline,
#tkModel line,
#tkModel circle { vector-effect: non-scaling-stroke; }

#tkModel line,
#tkModel polyline,
#tkModel text,
#tkModel .ov { pointer-events: none; }

#tkModel .yz { cursor: pointer; }

.tk-model-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-top: 1px solid var(--line);
}

.tk-model-hint {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.tk-rot {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), border-color 200ms ease;
}

.tk-rot:active { transform: scale(0.94); }

@media (hover: hover) and (pointer: fine) {
  .tk-rot:hover { border-color: var(--muted); }
}

.tk-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.tk-summary div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  background: var(--panel);
}

.tk-summary dt { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.04em; }

.tk-summary dd {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

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

.tk-form { display: flex; flex-direction: column; gap: 1.2rem; min-width: 0; }
.tk-form[hidden] { display: none; }

.tk-step {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  min-width: 0;
}

.tk-step legend {
  float: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.12rem;
  margin-bottom: 0.9rem;
}

.tk-step legend + * { clear: both; }

.tk-no {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--amber);
  color: #14100a;
  font-size: 0.85rem;
}

.tk-help { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.9rem; }
.tk-help-small { font-size: 0.8rem; margin: 0.8rem 0 0; }

/* seçim kartları */
.tk-cards { display: grid; gap: 0.6rem; }
.tk-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tk-cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.tk-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 200ms ease, background-color 200ms ease, transform 160ms var(--ease-out);
}

.tk-card:active { transform: scale(0.98); }

.tk-card input { position: absolute; opacity: 0; pointer-events: none; }

.tk-card-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.tk-card-desc { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }

.tk-card.is-checked {
  border-color: var(--amber);
  background: rgba(242, 178, 92, 0.08);
}

.tk-card:has(input:focus-visible) { outline: 2px solid var(--amber); outline-offset: 2px; }

@media (hover: hover) and (pointer: fine) {
  .tk-card:hover { border-color: var(--muted); }
  .tk-card.is-checked:hover { border-color: var(--amber); }
}

/* ölçü girişleri */
.tk-dims { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }

.tk-dim label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}

.tk-dim label span { font-weight: 500; color: var(--muted); font-size: 0.8rem; }

.tk-num {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
  transition: border-color 200ms ease;
}

.tk-num:focus-within { border-color: var(--amber); }
.tk-num.invalid { border-color: #e5675a; }

.tk-num input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 700 1.1rem var(--font-head);
  text-align: center;
  padding: 0.6rem 0;
  font-variant-numeric: tabular-nums;
}

.tk-num input:focus { outline: none; }

.tk-unit { color: var(--muted); font-size: 0.85rem; padding-right: 0.3rem; }

.tk-num button {
  width: 42px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.tk-num button:active { background: rgba(242, 178, 92, 0.15); }

@media (hover: hover) and (pointer: fine) {
  .tk-num button:hover { background: rgba(127, 140, 160, 0.12); }
}

/* yüzey seçimleri */
.tk-surfaces { display: flex; flex-direction: column; gap: 0.7rem; }

.tk-surf {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.tk-surf.is-selected {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(242, 178, 92, 0.15);
}

.tk-surf-fixed { border-style: dashed; opacity: 0.8; }

.tk-surf-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.tk-surf-fixed .tk-surf-head { margin-bottom: 0; }

.tk-surf-name { font-weight: 700; }
.tk-surf-dim { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

.tk-opts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 0.45rem;
}

.tk-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.35rem 0.5rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease, transform 160ms var(--ease-out);
}

.tk-opt:active { transform: scale(0.96); }
.tk-opt input { position: absolute; opacity: 0; pointer-events: none; }
.tk-opt svg { color: var(--silver); }
.tk-opt svg .ik-dolu { fill: currentColor; fill-opacity: 0.25; }

.tk-opt.is-checked {
  border-color: var(--amber);
  color: var(--text);
  background: rgba(242, 178, 92, 0.1);
}

.tk-opt.is-checked svg { color: var(--amber); }
.tk-opt:has(input:focus-visible) { outline: 2px solid var(--amber); outline-offset: 2px; }

@media (hover: hover) and (pointer: fine) {
  .tk-opt:hover { border-color: var(--muted); color: var(--text); }
  .tk-opt.is-checked:hover { border-color: var(--amber); }
}

.tk-opt-desc { color: var(--muted); font-size: 0.8rem; margin-top: 0.55rem; min-height: 1.2em; }

/* iletişim alanları */
.tk-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.tk-field-wide { grid-column: 1 / -1; }

.tk-field label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.35rem; }
.tk-optional { font-weight: 500; color: var(--muted); font-size: 0.8rem; }

.tk-field input,
.tk-field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 500 1rem var(--font-body);
  padding: 0.7rem 0.85rem;
  transition: border-color 200ms ease;
}

.tk-field textarea { resize: vertical; min-height: 5.5rem; }

.tk-field input:focus,
.tk-field textarea:focus { outline: none; border-color: var(--amber); }

.tk-field input.invalid { border-color: #e5675a; }

.tk-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.tk-check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  margin-top: 1.1rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}

.tk-check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 0.1rem;
  accent-color: var(--amber);
}

.tk-check a { color: var(--text); border-bottom: 1px solid var(--line); }

.tk-error { color: #ef8a7f; font-size: 0.82rem; margin-top: 0.35rem; }

.tk-error-box {
  border: 1px solid rgba(229, 103, 90, 0.5);
  background: rgba(229, 103, 90, 0.08);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  color: var(--text);
}

:root[data-theme="light"] .tk-error { color: #c4473a; }

.tk-submit { display: flex; flex-direction: column; align-items: flex-start; }
.tk-submit .btn { width: 100%; text-align: center; border: 0; font-family: inherit; cursor: pointer; }
.tk-submit .btn:disabled { opacity: 0.7; cursor: progress; }

/* ---------- Gönderim sonrası ---------- */

.tk-done {
  grid-column: 2;
  grid-row: 1;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: clamp(1.6rem, 4vw, 2.4rem);
  text-align: center;
  animation: riseIn 600ms var(--ease-out) backwards;
}

.tk-done:focus { outline: none; }

.tk-done-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  font-weight: 700;
  color: #14100a;
  background: var(--amber);
  animation: waIn 650ms cubic-bezier(0.34, 1.56, 0.64, 1) 150ms backwards;
}

.tk-done.is-error .tk-done-icon { background: var(--line); color: var(--text); }
.tk-done.is-error .tk-done-icon::before { content: "!"; }
.tk-done.is-error .tk-done-icon { font-size: 0; }
.tk-done.is-error .tk-done-icon::before { font-size: 1.9rem; }

.tk-done h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin-bottom: 0.6rem; }
.tk-done p { color: var(--muted); }
.tk-done-no { margin-top: 0.8rem; }
.tk-done-no strong { color: var(--text); font-family: var(--font-head); letter-spacing: 0.04em; }

.tk-done-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.tk-done-actions button.btn { border: 0; font-family: inherit; cursor: pointer; }

/* ---------- Mobil ---------- */

@media (max-width: 900px) {
  /* blok düzen: sabit model tüm form boyunca üstte kalabilsin */
  .tk-layout { display: block; }

  /* model ekranın üstünde küçük ve sabit kalır, seçimler anında görünür */
  .tk-model-wrap {
    top: 4.4rem;
    margin: 0 -0.25rem 1.2rem;
  }

  .tk-model { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25); }
  #tkModel { aspect-ratio: auto; height: 30vh; height: 30svh; max-height: none; }
  .tk-model-hint { font-size: 0.72rem; }
  .tk-summary { display: none; }

  /* yazı yazarken klavyeye yer açılsın */
  .tk-page.typing .tk-model-wrap { position: static; }

  .tk-done { grid-column: 1; grid-row: auto; }
}

@media (max-width: 600px) {
  .tk-cards-3, .tk-cards-2 { grid-template-columns: 1fr; }
  .tk-fields { grid-template-columns: 1fr; }
  .tk-dims { gap: 0.7rem; }
  .tk-opts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 360px) {
  .tk-dims { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .tk-done, .tk-done-icon { animation: none; }
}
