/* Kalıp Çizim — terzi atölyesi kimliği
   Zemin: sıcak kalıp kağıdı · Vurgu: terzi çizim mavisi · İşaret: iplik kırmızısı
   İmza: aktif araçta ve bölüm başlıklarında teyel (dikiş izi) kesik çizgileri */
:root {
  --paper: #ece7de;        /* uygulama zemini, kalıp kağıdı */
  --surface: #fbf9f4;      /* kartlar, araç çubuğu */
  --canvas: #ffffff;       /* çizim alanı */
  --ink: #2b2620;          /* metin */
  --ink-soft: #857b6c;     /* ikincil metin */
  --line: #dcd5c8;         /* kenarlıklar */
  --accent: #3555c8;       /* terzi çizim mavisi */
  --accent-soft: #e7ebfa;  /* mavi zemin tonu */
  --thread: #c8442e;       /* iplik kırmızısı */
  --radius: 8px;
  --ui: "Avenir Next", "Avenir", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 13px/1.45 var(--ui);
  color: var(--ink); background: var(--paper);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

/* ---------- araç çubuğu ---------- */
#toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 7px 12px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 6px; padding-right: 4px; user-select: none; }
.brand svg { width: 17px; height: 17px; align-self: center; stroke: var(--thread); fill: none; stroke-width: 1.5; }
.brand b { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.brand span { font-size: 11px; color: var(--ink-soft); letter-spacing: 0.14em; text-transform: uppercase; }

.grp { display: flex; align-items: center; gap: 5px; padding: 0 12px 0 0; border-right: 1px dashed var(--line); }
.grp.right { border-right: none; margin-left: auto; padding-right: 0; }

button {
  font: inherit; font-weight: 500; padding: 5px 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
}
button:hover { background: #f1ede3; border-color: #c9c1af; }
button:active { background: #e9e4d6; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.icon { padding: 5px 9px; font-size: 14px; line-height: 1; }
button.icon svg { width: 14px; height: 14px; display: block; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* araç düğmeleri: ikon + etiket; aktif olan teyelli mavi yama */
.tools .tool { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-color: transparent; background: transparent; }
.tools .tool svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tools .tool:hover { background: #f1ede3; border-color: var(--line); }
.tools .tool.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  outline: 1px dashed rgba(255,255,255,0.55); outline-offset: -3.5px;
}
button.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  outline: 1px dashed rgba(255,255,255,0.5); outline-offset: -3.5px;
}
button.primary:hover { background: #2c48ad; }
button.danger { color: var(--thread); border-color: #e0b9ae; }
button.danger:hover { background: #f9ece8; }
button.wide { width: 100%; margin-top: 8px; padding: 7px 10px; }

select, input[type=number], input[type=text], input:not([type]) {
  font: inherit; padding: 4px 7px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--ink);
}
input[type=number] { width: 68px; font-family: var(--mono); font-size: 12px; }
#fileName { width: 108px; }
#zoomLabel { min-width: 48px; text-align: center; font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* yakalama chip'leri */
.snaps { gap: 4px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 3.5px 9px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; line-height: 1.3;
  background: transparent; transition: background 0.12s, color 0.12s;
}
.chip:hover span { border-color: #c9c1af; color: var(--ink); }
.chip input:checked + span { background: var(--accent-soft); border-color: #b9c4ec; color: #24398c; font-weight: 500; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* renk örnekleri */
#swatches { display: flex; gap: 5px; align-items: center; }
.swatch {
  width: 18px; height: 18px; padding: 0; border-radius: 50%;
  background: var(--c); border: 1px solid rgba(0,0,0,0.2); cursor: pointer;
}
.swatch:hover { transform: scale(1.12); background: var(--c); }
.swatch.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }

/* ---------- ana alan ---------- */
main { flex: 1; display: flex; min-height: 0; }
#canvasWrap { flex: 1; position: relative; background: var(--canvas); min-width: 0; }
#canvas { position: absolute; inset: 0; display: block; cursor: crosshair; touch-action: none; }

/* ---------- sağ panel ---------- */
#panel {
  width: 302px; background: var(--surface); border-left: 1px solid var(--line);
  overflow-y: auto; padding: 4px 14px 14px;
}
#panel section { padding: 12px 0; border-bottom: 1px dashed var(--line); }
#panel section:last-child { border-bottom: none; }
#panel h3 {
  margin: 0 0 8px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft);
}
#panel .row { display: flex; align-items: center; gap: 7px; margin: 5px 0; }
#panel .row input:not([type=checkbox]), #panel .row select { flex: 1; min-width: 0; }
#panel .row input[type=number] { flex: 0 0 74px; }
.hidden { display: none !important; }
.hint { margin: 0; color: #5d5546; font-size: 12.5px; }
.hint.small { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.muted { color: var(--ink-soft); }
.sub { font-weight: 600; margin-top: 8px; color: #5d5546; }
.info {
  font-family: var(--mono); font-size: 11.5px; color: #4c463c; white-space: pre-wrap;
  margin: 8px 0 2px; padding: 8px 9px; max-height: 200px; overflow: auto;
  background: #f4f0e7; border-radius: 6px; border: 1px solid #e7e1d3;
}
.btns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.btns button { font-size: 12px; padding: 4px 8px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 11.5px; color: var(--ink-soft); }
.keys b {
  color: var(--ink); font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  background: #f1ecdf; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-right: 2px;
}

/* ---------- bildirim (toast) ---------- */
#toast {
  position: fixed; top: 54px; left: 50%; transform: translateX(-50%);
  max-width: min(560px, 86vw); z-index: 60;
  background: var(--ink); color: #fdfbf6;
  padding: 10px 16px; border-radius: 10px; font-size: 13px; line-height: 1.45;
  box-shadow: 0 6px 22px rgba(43,38,32,0.35);
  outline: 1px dashed rgba(255,255,255,0.35); outline-offset: -4px;
}

/* ---------- paylaşım modalı ---------- */
.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(43,38,32,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 0;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; width: min(600px, 92vw);
  box-shadow: 0 14px 44px rgba(43,38,32,0.4);
  outline: 1px dashed var(--line); outline-offset: -6px;
}
.modal-card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.share-row { display: flex; gap: 6px; margin: 12px 0 8px; }
.share-row input {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px;
  padding: 7px 9px; color: #4c463c; background: #f4f0e7; border-color: #e7e1d3;
}
.right-btns { justify-content: flex-end; margin-top: 12px; }

/* ---------- durum çubuğu ---------- */
#status {
  display: flex; gap: 18px; align-items: center; padding: 4px 12px;
  background: var(--surface); border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px; color: #4c463c;
}
#status .right { margin-left: auto; font-family: var(--ui); }
.typed { color: var(--accent); font-weight: 600; }

/* dar ekranlar */
@media (max-width: 1100px) {
  .tools .tool span { display: none; }
  .brand span { display: none; }
}
@media (max-width: 860px) {
  #panel { width: 250px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
