/* Şapkanı Tasarla — 3D tasarım aracı */
body[data-page="designer"] { background: #ece9e1; }
body[data-page="designer"] .site-footer { margin-top: 0; }
body[data-page="designer"] .wa-float { display: none; }

.designer {
  --panel-w: 420px;
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  height: calc(100vh - var(--header-h) - 38px);
  height: calc(100dvh - var(--header-h) - 38px);
  min-height: 560px;
}

/* ---------- stage ---------- */
.stage { position: relative; overflow: hidden; background: radial-gradient(90% 80% at 50% 28%, #ffffff 0%, #f0ede6 50%, #e3ded2 100%); }
.stage #viewer { position: absolute; inset: 0; }
.stage #viewer canvas { display: block; touch-action: none; }
.stage-top { position: absolute; left: 18px; right: 18px; top: 16px; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.model-badge { background: rgba(255, 255, 255, .92); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); }
.model-badge b { display: block; font-family: var(--display); font-size: 1.1rem; line-height: 1.1; }
.model-badge small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.hint-pill { align-self: start; display: inline-flex; align-items: center; gap: 8px; background: rgba(15, 26, 20, .78); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.hint-pill svg { width: 16px; height: 16px; }
.view-bar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 999px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-lg);
  max-width: calc(100% - 24px); overflow-x: auto; scrollbar-width: none;
}
.view-bar::-webkit-scrollbar { display: none; }
.view-bar button { border: 0; background: none; padding: 8px 13px; border-radius: 999px; font-weight: 700; font-size: .84rem; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.view-bar button:hover { background: var(--paper); }
.view-bar button.on { background: var(--ink); color: #fff; }
.armed-banner {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 3;
  background: var(--green); color: #fff; padding: 10px 16px 10px 18px; border-radius: 999px; box-shadow: var(--shadow-lg);
  display: none; align-items: center; gap: 12px; font-weight: 700; font-size: .9rem;
}
.armed-banner.on { display: flex; }
.armed-banner button { border: 0; background: rgba(255, 255, 255, .2); color: #fff; border-radius: 999px; padding: 5px 10px; font-weight: 700; cursor: pointer; font-size: .8rem; }
.busy {
  position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
  background: rgba(236, 233, 225, .82); backdrop-filter: blur(4px); font-weight: 700;
}
.busy.on { display: flex; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(23, 145, 63, .2); border-top-color: var(--green); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.webgl-error { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 30px; }
.webgl-error.on { display: grid; }

/* ---------- panel ---------- */
.panel { background: #fff; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 12px 12px 0; border-bottom: 1px solid var(--line); }
.tab {
  border: 0; background: none; cursor: pointer; padding: 10px 4px 12px; font-weight: 700; font-size: .82rem; color: var(--muted);
  border-bottom: 3px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tab i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); font-size: .8rem; }
.tab.on { color: var(--ink); border-bottom-color: var(--green); }
.tab.on i { background: var(--green); color: #fff; }
.tab.done i { background: var(--green-tint); color: var(--green-deep); }
.panes { flex: 1; overflow-y: auto; padding: 20px; min-height: 0; }
.pane { display: none; }
.pane.on { display: block; }
.pane h3 { font-size: 1.25rem; margin-bottom: 4px; }
.pane .sub { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.group { margin-bottom: 22px; }
.group > label, .group-title { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.group-title output { font-family: var(--font); text-transform: none; letter-spacing: 0; color: var(--ink); font-size: .88rem; }

.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: #fff; }
.panel-foot .btn { width: 100%; }

/* model cards */
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.model-group { grid-column: 1 / -1; font-family: var(--font); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 8px 0 -2px; }
.model-group:first-child { margin-top: 0; }
.model-card {
  border: 1.5px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; padding: 14px 12px 12px; text-align: left;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.model-card:hover { border-color: #c9c3b6; transform: translateY(-1px); }
.model-card.on { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34, 177, 76, .16); }
.model-card svg { width: 100%; height: 62px; color: var(--ink-2); }
.model-card.on svg { color: var(--green-deep); }
.model-card b { font-size: .95rem; }
.model-card small { color: var(--muted); font-size: .78rem; font-weight: 600; line-height: 1.3; }
.opt-block { margin-top: 12px; }
.opt-title { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.switch-row { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--paper); font-weight: 600; font-size: .92rem; margin-top: 10px; }

/* switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cfcabe; transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--green-bright); outline-offset: 2px; }

/* colors */
.zones { display: grid; gap: 8px; margin-bottom: 16px; }
.zone {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; text-align: left;
}
.zone.on { border-color: var(--ink); }
.zone .sw { width: 34px; height: 34px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); flex: none; }
.zone b { display: block; font-size: .92rem; }
.zone small { color: var(--muted); font-size: .78rem; font-weight: 600; }
.zone .edit { margin-left: auto; font-size: .78rem; font-weight: 700; color: var(--green); }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 8px; }
.palette button {
  aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer; padding: 0; position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); transition: transform .12s;
}
.palette button:hover { transform: scale(1.08); }
.palette button.on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2.5px solid var(--ink); }
.color-name { font-size: .86rem; color: var(--muted); font-weight: 600; margin-top: 10px; min-height: 1.3em; }
.custom-color { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.custom-color input[type=color] { width: 44px; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; cursor: pointer; }
.custom-color input[type=text] { width: 110px; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); font-family: ui-monospace, Consolas, monospace; font-size: .88rem; text-transform: uppercase; }

/* upload */
.drop {
  border: 2px dashed #cbc5b8; border-radius: 18px; padding: 22px 16px; text-align: center; cursor: pointer; background: var(--paper);
  transition: border-color .15s, background .15s; display: block;
}
.drop:hover, .drop.over { border-color: var(--green); background: var(--green-tint); }
.drop svg { width: 34px; height: 34px; color: var(--green); margin: 0 auto 8px; display: block; }
.drop b { display: block; }
.drop small { color: var(--muted); font-size: .8rem; font-weight: 600; }
.drop input { display: none; }
.add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

.text-editor { display: none; margin-top: 12px; padding: 14px; border-radius: 16px; background: var(--paper); }
.text-editor.on { display: block; }
.text-editor textarea { width: 100%; min-height: 70px; border-radius: 12px; border: 1.5px solid var(--line); padding: 10px 12px; resize: vertical; font-weight: 700; }
.text-editor .row { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.text-editor select { flex: 1; padding: 9px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; }
.text-editor input[type=color] { width: 44px; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; }

.layers { display: grid; gap: 8px; margin-top: 18px; }
.layer {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer;
}
.layer.on { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34, 177, 76, .14); }
.layer .th {
  width: 46px; height: 46px; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(#ece9e2 0% 25%, #fff 0% 50%) 50% / 12px 12px;
}
.layer .th img { max-width: 90%; max-height: 90%; object-fit: contain; }
.layer .nm { flex: 1; min-width: 0; }
.layer .nm b { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer .nm small { color: var(--muted); font-size: .76rem; font-weight: 600; }
.chip { display: inline-block; font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: var(--paper); color: var(--ink-2); letter-spacing: .02em; }
.chip.emb { background: #efe3ff; color: #5b2c83; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--paper); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.empty-layers { text-align: center; color: var(--muted); font-size: .88rem; padding: 14px; border-radius: 14px; background: var(--paper); margin-top: 18px; }

.editor { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); display: none; }
.editor.on { display: block; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--paper); border-radius: 14px; }
.seg button { border: 0; background: none; padding: 9px 6px; border-radius: 10px; font-weight: 700; font-size: .86rem; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #f3ecff; color: #3f1d63; font-size: .85rem; margin-top: 10px; align-items: flex-start; }
.note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.note.green { background: var(--green-tint); color: var(--green-deep); }
.note.min-note { background: #f4f2ec; color: #3d3a33; }
.note.min-note a { color: inherit; text-decoration: underline; }
.note.min-note.multi { background: #fff3dc; color: #6b4300; }
.min-state { display: block; margin-top: 6px; font-weight: 700; }
.min-state:empty { display: none; }
.qty-note { display: block; margin-top: 6px; font-size: .78rem; font-weight: 600; color: #6b4300; }
.qty-note.low { color: #a3122a; }
.sum-warn { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #fff3dc; color: #6b4300; font-size: .82rem; font-weight: 600; }
.note label { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 700; cursor: pointer; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: .82rem; font-weight: 700; cursor: pointer; }
.presets button:hover { border-color: var(--ink); }
.presets button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.place-btn { margin-top: 10px; width: 100%; }
.range { display: flex; align-items: center; gap: 12px; }
.range input[type=range] { flex: 1; accent-color: var(--green); height: 28px; }
.range .btn { padding: .5em .8em; }
.toggles { display: grid; gap: 8px; }
.toggles .switch-row { margin-top: 0; }
.editor-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.loc-text { font-size: .82rem; color: var(--muted); margin-top: 8px; font-weight: 600; }

/* summary */
.sum-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 16px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.sum-row:last-child { border-bottom: 0; }
.sum-row span { color: var(--muted); font-weight: 600; }
.sum-row b { text-align: right; }
.sum-sw { display: inline-flex; align-items: center; gap: 6px; }
.sum-sw i { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); display: inline-block; }
.sum-layer { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.sum-layer:last-child { border-bottom: 0; }
.sum-layer .th { width: 40px; height: 40px; border-radius: 8px; flex: none; display: grid; place-items: center; background: repeating-conic-gradient(#ece9e2 0% 25%, #fff 0% 50%) 50% / 10px 10px; }
.sum-layer .th img { max-width: 90%; max-height: 90%; }
.sum-layer small { display: block; color: var(--muted); }
.code-tag { font-family: ui-monospace, Consolas, monospace; background: var(--paper); padding: 3px 8px; border-radius: 8px; font-size: .85rem; }
.quote-form .field { margin-bottom: 10px; }
.quote-form .field input, .quote-form .field textarea { padding: 10px 12px; }
.quote-form .field textarea { min-height: 80px; }
.quote-form .form-grid { gap: 10px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: .9rem; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1080px) {
  .designer { --panel-w: 380px; }
}
@media (max-width: 860px) {
  .designer { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .stage { height: 58vh; height: 58svh; min-height: 360px; position: sticky; top: var(--header-h); z-index: 2; }
  .panel { border-left: 0; }
  .panes { overflow: visible; }
  .panel-foot { position: sticky; bottom: 0; z-index: 3; box-shadow: 0 -8px 20px rgba(0, 0, 0, .06); }
  .hint-pill { display: none; }
}
@media (max-width: 520px) {
  .stage { height: 50vh; height: 50svh; }
  .model-badge small { display: none; }
  .view-bar button { padding: 7px 10px; font-size: .78rem; }
  .panes { padding: 16px; }
  .panel-foot { padding: 10px 16px; }
}
