/* ==========================================================================
   Kutuvera — Kutunu Tasarla arayüzü (2D editör + 3D önizleme)
   ========================================================================== */

.dz {
  --panel-bg: var(--cream-soft);
  --panel-line: var(--line);
  padding-block: clamp(1.25rem, 3vw, 2.25rem) clamp(2rem, 4vw, 3.5rem);
}

.dz__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.dz__top h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

.dz__top p {
  margin: 0.35rem 0 0;
  max-width: 62ch;
  font-size: 0.9rem;
  color: var(--muted);
}

.dz-tabs {
  display: inline-flex;
  padding: 4px;
  background: var(--beige);
  border-radius: 999px;
  gap: 2px;
}

.dz-tab {
  padding: 0.5rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--coffee);
  border-radius: 999px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.dz-tab[aria-selected='true'] {
  background: var(--green-800);
  color: var(--cream);
}

.dz__layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 300px;
  grid-template-areas: 'left stage right';
  gap: 1rem;
  align-items: start;
}

.dz__panel {
  display: grid;
  gap: 1px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  overflow: hidden;
}

.dz__panel--left {
  grid-area: left;
}

.dz__panel--right {
  grid-area: right;
}

.dz-section {
  padding: 1rem 1rem 1.15rem;
  background: var(--panel-bg);
}

.dz-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.dz-section__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brown);
}

.dz-section__value {
  font-size: 0.72rem;
  color: var(--muted);
}

.dz-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--coffee);
}

.dz-hint {
  margin: 0.5rem 0 0;
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--muted);
}

.dz-error {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--bordo);
}

.dz-error:empty {
  display: none;
}

/* ------------------------------ Model kartları -------------------------- */
.dz-models {
  display: grid;
  gap: 0.4rem;
}

.dz-model {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  padding: 0.5rem 0.55rem;
  text-align: start;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.dz-model:hover {
  border-color: var(--brown);
}

.dz-model[aria-pressed='true'] {
  border-color: var(--green-700);
  background: rgba(49, 92, 75, 0.08);
}

.dz-model__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background: var(--beige);
  color: var(--green-800);
}

.dz-model__icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.dz-model__name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--coffee);
}

.dz-model__sub {
  display: block;
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--muted);
}

/* ------------------------------- Ölçü alanları -------------------------- */
.dz-dims {
  display: grid;
  gap: 0.55rem;
}

.dz-field {
  display: grid;
  grid-template-columns: 1fr 92px;
  align-items: center;
  gap: 0.5rem;
}

.dz-input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--coffee);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.dz-input:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(49, 92, 75, 0.14);
}

.dz-input[aria-invalid='true'] {
  border-color: var(--bordo);
}

.dz-unit {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--beige);
  border-radius: 999px;
  margin-top: 0.6rem;
}

.dz-unit button {
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  color: var(--coffee);
}

.dz-unit button[aria-pressed='true'] {
  background: var(--green-800);
  color: var(--cream);
}

/* -------------------------------- Renkler ------------------------------- */
.dz-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dz-swatch {
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(68, 53, 44, 0.22);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.dz-swatch:hover {
  transform: scale(1.08);
}

.dz-swatch[aria-pressed='true'] {
  box-shadow: 0 0 0 2px var(--panel-bg), 0 0 0 4px var(--green-700);
}

.dz-swatch--custom {
  position: relative;
  overflow: hidden;
  background: conic-gradient(#803d3a, #795b45, #183c32, #e8ddca, #803d3a);
}

.dz-swatch--custom input[type='color'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  border: 0;
}

.dz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dz-chip {
  padding: 0.4rem 0.7rem;
  font-size: 0.76rem;
  color: var(--coffee);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.dz-chip:hover {
  border-color: var(--brown);
}

.dz-chip[aria-pressed='true'] {
  background: var(--green-800);
  border-color: var(--green-800);
  color: var(--cream);
}

/* ------------------------------- Aşama (stage) -------------------------- */
.dz-stage {
  grid-area: stage;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  overflow: hidden;
  min-height: 420px;
}

.dz-stage__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--cream-soft);
  border-bottom: 1px solid var(--line);
}

.dz-stage__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brown);
}

.dz-stage__tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dz-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--coffee);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.dz-icon-btn:hover {
  background: var(--cream);
  border-color: var(--brown);
}

.dz-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dz-stage__body {
  position: relative;
  flex: 1;
  display: grid;
  min-height: 340px;
  background:
    linear-gradient(rgba(121, 91, 69, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 91, 69, 0.07) 1px, transparent 1px),
    var(--cream-soft);
  background-size: 22px 22px, 22px 22px, auto;
}

.dz-stage__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-top: 1px solid var(--line);
  background: var(--cream-soft);
  font-size: 0.72rem;
  color: var(--muted);
}

/* --------------------------------- 2D ---------------------------------- */
.dz2d {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  touch-action: none;
  user-select: none;
}

.dz2d svg {
  width: 100%;
  height: auto;
  max-height: 460px;
  overflow: visible;
}

.dz2d__panel {
  fill: #fffdf7;
  stroke: rgba(68, 53, 44, 0.45);
  stroke-width: 0.8;
  stroke-dasharray: 4 3;
}

.dz2d__panel.is-active {
  stroke: var(--green-700);
  stroke-width: 1.6;
  stroke-dasharray: none;
}

.dz2d__panel-label {
  font-family: var(--font-sans);
  font-size: 9px;
  letter-spacing: 0.08em;
  fill: rgba(68, 53, 44, 0.55);
  text-anchor: middle;
  pointer-events: none;
}

.dz2d__fold {
  stroke: rgba(68, 53, 44, 0.22);
  stroke-width: 0.6;
  stroke-dasharray: 3 3;
  fill: none;
}

.dz2d__el {
  cursor: grab;
}

.dz2d__el.is-selected {
  outline: none;
}

.dz2d__el-box {
  fill: none;
  stroke: var(--green-700);
  stroke-width: 1;
  stroke-dasharray: 3 2;
  opacity: 0;
}

.dz2d__el.is-selected .dz2d__el-box {
  opacity: 1;
}

.dz2d__handle {
  fill: var(--green-700);
  stroke: var(--white);
  stroke-width: 0.8;
  cursor: nwse-resize;
}

.dz2d__rotate {
  fill: var(--bordo);
  stroke: var(--white);
  stroke-width: 0.8;
  cursor: grab;
}

.dz2d__empty {
  position: absolute;
  inset-inline: 1rem;
  bottom: 0.75rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  pointer-events: none;
}

/* --------------------------------- 3D ---------------------------------- */
.dz3d {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 360px;
  padding: 1.5rem;
  perspective: 1100px;
  touch-action: none;
  cursor: grab;
  overflow: hidden;
}

.dz3d.is-dragging {
  cursor: grabbing;
}

.dz3d__box {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.15s linear;
  will-change: transform;
}

.dz3d__face {
  position: absolute;
  background-size: cover;
  background-position: center;
  box-sizing: border-box;
  backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px rgba(40, 30, 22, 0.18);
  overflow: hidden;
}

.dz3d__face::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--shade, 0));
  pointer-events: none;
  transition: background 0.3s var(--ease);
}

.dz3d__floor {
  position: absolute;
  inset-block-end: 8%;
  width: 55%;
  max-width: 320px;
  height: 26px;
  background: radial-gradient(ellipse at center, rgba(68, 53, 44, 0.28), transparent 70%);
  filter: blur(2px);
  pointer-events: none;
}

.dz3d__hint {
  position: absolute;
  inset-block-end: 0.55rem;
  inset-inline: 0;
  margin: 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  pointer-events: none;
}

.dz3d__badge {
  position: absolute;
  inset-block-start: 0.6rem;
  inset-inline-start: 0.6rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
  background: rgba(24, 60, 50, 0.85);
  border-radius: 999px;
}

/* --------------------------- Sağ panel / öğeler ------------------------- */
.dz-upload {
  display: grid;
  gap: 0.5rem;
}

.dz-upload__drop {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  padding: 1rem 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--white);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.dz-upload__drop:hover,
.dz-upload__drop.is-over {
  border-color: var(--green-600);
  background: rgba(49, 92, 75, 0.05);
}

.dz-upload__drop svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--brown);
  stroke-width: 1.6;
}

.dz-upload input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dz-elements {
  display: grid;
  gap: 0.35rem;
  max-height: 190px;
  overflow-y: auto;
}

.dz-element {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.dz-element[aria-current='true'] {
  border-color: var(--green-700);
  background: rgba(49, 92, 75, 0.08);
}

.dz-element__meta {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.dz-element__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--coffee);
}

.dz-element__sub {
  font-size: 0.65rem;
  color: var(--muted);
}

.dz-element__actions {
  display: flex;
  gap: 0.2rem;
}

.dz-element__actions button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  color: var(--coffee);
}

.dz-element__actions button:hover {
  background: var(--cream);
}

.dz-element__actions svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.dz-empty {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.dz-range {
  width: 100%;
  accent-color: var(--green-700);
}

.dz-colorrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dz-colorrow input[type='color'] {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: none;
}

.dz-summary {
  display: grid;
  gap: 0.3rem;
  font-size: 0.74rem;
}

.dz-summary div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dotted var(--line);
}

.dz-summary dt {
  color: var(--muted);
}

.dz-summary dd {
  margin: 0;
  text-align: end;
  color: var(--coffee);
  font-weight: 600;
}

/* -------------------------------- İşlemler ------------------------------ */
.dz__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dz__actions .dz-save-note {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.dz__actions-spacer {
  flex: 1;
}

.dz-toast {
  position: fixed;
  inset-block-end: 1.25rem;
  inset-inline-start: 50%;
  transform: translate(-50%, 20px);
  z-index: 150;
  max-width: min(420px, 90vw);
  padding: 0.75rem 1.1rem;
  font-size: 0.82rem;
  color: var(--cream);
  background: var(--green-800);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
}

.dz-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.dz-toast.is-error {
  background: var(--bordo);
}

/* ------------------------------ Responsive ----------------------------- */
@media (max-width: 1180px) {
  .dz__layout {
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-areas:
      'left stage'
      'right right';
  }

  .dz__panel--right {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    display: grid;
  }

  .dz__panel--right .dz-section {
    border-top: 1px solid var(--panel-line);
  }
}

@media (max-width: 860px) {
  .dz__layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'stage'
      'left'
      'right';
  }

  .dz__panel--left {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    display: grid;
  }

  .dz__panel--left .dz-section {
    border-top: 1px solid var(--panel-line);
  }

  .dz-stage {
    min-height: 0;
  }

  .dz-stage__body {
    min-height: 300px;
  }

  .dz3d {
    min-height: 280px;
  }

  .dz__actions {
    position: sticky;
    bottom: 0;
    z-index: 40;
    box-shadow: 0 -10px 30px -24px rgba(36, 28, 23, 0.6);
  }

  .dz__actions .btn--primary {
    flex: 1 1 100%;
  }
}

@media (max-width: 520px) {
  .dz-model {
    grid-template-columns: 28px 1fr;
  }

  .dz-model__icon {
    width: 28px;
    height: 28px;
  }

  .dz-stage__foot {
    font-size: 0.68rem;
  }

  .dz2d svg {
    max-height: 300px;
  }

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

/* --------------------------- Görünüm panelleri -------------------------- */
.dz-pane {
  position: relative;
  display: grid;
  min-height: 0;
  width: 100%;
}

.dz-pane[hidden] {
  display: none;
}

.dz-pane[data-pane='2d'] {
  place-items: stretch;
}

.dz-pane[data-pane='3d'] {
  place-items: stretch;
}

.dz2d {
  min-height: 340px;
}

@media (max-width: 860px) {
  .dz2d {
    min-height: 300px;
  }
}

/* Son katman: tasarım sahnesi çerçevesi */
.dz-stage {
  border: 1.5px solid rgba(121, 91, 69, 0.28);
}
