/* prvi.dodir — editor kartice (js/dizajner.js) i kartica sa svojim dizajnom (PD.renderSide u js/app.js).
   Koriste ga strana /svoj-dizajn i admin (Dizajn kartice, pregled na vrhu detalja). */

/* Kartica sa svojim dizajnom: jedan SVG u milimetrima; slika pozadine ide i preko napusta, pa se vidi
   samo deo do ivice kartice, kao posle sečenja. */
.dz-card {
  position: relative; overflow: hidden; width: 100%; aspect-ratio: 85.6 / 54; border-radius: var(--r-card);
  box-shadow: 0 20px 40px -24px rgba(11, 11, 11, .45), 0 0 0 1px rgba(11, 11, 11, .05);
}
.dz-card svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* ---------- Editor ---------- */
.dz { --zuta: #FFE14D; --zuta-svetla: #FFF6C9; display: grid; gap: 14px; min-width: 0; }
.dz-work { display: grid; gap: 16px; min-width: 0; }

/* Koju stranu sređuješ: dve pločice sa malim pregledom */
.dz-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dz-side {
  display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px 14px 10px 10px;
  border: 1.5px solid var(--linija); border-radius: 18px; background: var(--papir-svetli);
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: border-color .2s, background-color .2s, box-shadow .2s, transform .3s cubic-bezier(.3, 1.4, .5, 1);
}
.dz-side:hover { border-color: #BDBAB2; }
.dz-side[aria-selected="true"] { border-color: var(--ugalj); background: var(--zuta); box-shadow: 0 10px 22px -16px rgba(11, 11, 11, .6); }
.dz-side:focus-visible { outline: 2px solid var(--ugalj); outline-offset: 3px; }
.dz-side__mini { flex: none; width: 96px; }
.dz-side__mini .dz-card { border-radius: 6px; box-shadow: 0 8px 14px -10px rgba(11, 11, 11, .55), 0 0 0 1px rgba(11, 11, 11, .08); }
.dz-side__t { display: grid; gap: 2px; min-width: 0; }
.dz-side__t b { font-size: 15.5px; font-weight: 600; letter-spacing: -0.02em; }
.dz-side__t small { overflow: hidden; font-size: 13px; color: var(--grafit); text-overflow: ellipsis; white-space: nowrap; }
.dz-side[aria-selected="true"] small { color: var(--grafit-tamni); }

/* Scena: traka „Dodaj“ i kartica koja se okreće */
.dz-stage {
  display: grid; gap: 14px; padding: 14px 16px 16px; border-radius: 24px;
  background: radial-gradient(90% 70% at 50% 30%, rgba(255, 225, 77, .5) 0%, rgba(255, 225, 77, .12) 48%, rgba(255, 225, 77, 0) 75%), var(--pesak);
}
.dz-toolbar { position: relative; min-width: 0; }
.dz-tools {
  display: flex; align-items: center; gap: 2px; overflow-x: auto; padding: 4px; border-radius: 14px;
  background: var(--papir); box-shadow: inset 0 0 0 1px var(--linija); scrollbar-width: none;
}
.dz-tools::-webkit-scrollbar { display: none; }
.dz-tool {
  flex: none; display: inline-flex; flex-direction: column; align-items: center; gap: 3px; min-width: 58px; padding: 7px 8px 6px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ugalj); font: inherit; font-size: 11.5px; cursor: pointer;
  transition: background-color .2s;
}
.dz-tool .icon { width: 20px; height: 20px; }
.dz-tool:hover, .dz-tool[aria-expanded="true"] { background: var(--zuta); }
.dz-tool:focus-visible { outline: 2px solid var(--ugalj); outline-offset: -2px; }
.dz-tool--icon { min-width: 40px; justify-content: center; }
.dz-tool:disabled { opacity: .3; cursor: default; background: transparent; }
.dz-tools__sp { flex: 1 0 8px; }
.dz-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: grid; min-width: 210px; padding: 6px; border-radius: 14px;
  background: #fff; box-shadow: 0 18px 40px -14px rgba(11, 11, 11, .35), 0 0 0 1px rgba(11, 11, 11, .06);
}
.dz-menu button { padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ugalj); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; }
.dz-menu button:hover { background: var(--zuta); }

.dz-scene { width: min(100%, 580px); justify-self: center; perspective: 1800px; border-radius: 14px; outline: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.dz-scene:focus-visible { outline: 2px solid var(--ugalj); outline-offset: 8px; }
.dz-flip { position: relative; aspect-ratio: 85.6 / 54; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .9s cubic-bezier(.2, .8, .2, 1); }
.dz-flip.is-back { transform: rotateY(180deg); }
.dz-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform: rotateY(0deg); }
.dz-face--back { transform: rotateY(180deg); }
/* Safari ponekad ne sakrije poleđinu lica (backface-visibility), pa se strane menjaju i same, kad je kartica bokom */
.dz-face--back, .dz-flip.is-back .dz-face--front { visibility: hidden; transition: visibility 0s linear .12s; }
.dz-face--front, .dz-flip.is-back .dz-face--back { visibility: visible; transition: visibility 0s linear .12s; }
.dz-face__card .dz-card { cursor: default; box-shadow: 0 30px 50px -28px rgba(11, 11, 11, .55), 0 0 0 1px rgba(11, 11, 11, .06); }
.dz.is-busy .dz-scene { opacity: .55; transition: opacity .2s; }

/* Izbor, ručke, linije poravnanja, sigurna zona */
.dz-ov { position: absolute; inset: 0; pointer-events: none; }
.dz-sel { position: absolute; border-radius: 2px; outline: 1.5px solid var(--zuta); box-shadow: 0 0 0 1.5px rgba(11, 11, 11, .55), inset 0 0 0 1px rgba(11, 11, 11, .25); }
.dz-h { position: absolute; width: 12px; height: 12px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1.5px var(--ugalj), 0 2px 6px rgba(11, 11, 11, .3); pointer-events: auto; }
.dz-h::before { content: ""; position: absolute; inset: -10px; }
.dz-h--se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.dz-h--e { right: -8px; top: 50%; height: 18px; margin-top: -9px; width: 10px; cursor: ew-resize; }
.dz-h--s { bottom: -8px; left: 50%; width: 18px; height: 10px; margin-left: -9px; cursor: ns-resize; }
.dz-guide { position: absolute; }
.dz-guide--v { top: -6%; bottom: -6%; border-left: 1px dashed #FF3B7F; }
.dz-guide--h { left: -4%; right: -4%; border-top: 1px dashed #FF3B7F; }
.dz-safe { position: absolute; left: calc(3 / 85.6 * 100%); right: calc(3 / 85.6 * 100%); top: calc(3 / 54 * 100%); bottom: calc(3 / 54 * 100%); border: 1px dashed rgba(255, 59, 127, .55); border-radius: 3px; }
.dz-hint { font-size: 13px; color: var(--grafit); text-align: center; }

/* Podešavanja izabranog elementa ili pozadine */
.dz-props { display: grid; gap: 18px; align-content: start; min-width: 0; padding: 18px; border: 1px solid var(--linija); border-radius: 20px; background: var(--papir-svetli); }
.dz-props__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.dz-kicker { display: block; margin-bottom: 2px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--grafit); }
.dz-props__head b { font-size: 19px; font-weight: 600; letter-spacing: -0.03em; }
.dz-acts, .dz-aligns { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dz-aligns .dz-ibtn:nth-child(4) { margin-left: 10px; }
.dz-ibtn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--pesak); color: var(--ugalj); cursor: pointer; transition: background-color .2s, color .2s; }
.dz-ibtn:hover { background: #DCDAD2; }
.dz-ibtn.is-del:hover { background: #F2E4E0; color: #A1281D; }
.dz-ibtn .icon { width: 18px; height: 18px; }
.dz-mini-btn { height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--ugalj); color: var(--papir); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.dz-mini-btn:hover { background: #2A2A28; }
.dz-row { display: grid; gap: 10px; min-width: 0; }
.dz-row--2 { grid-template-columns: 1fr 1fr; gap: 18px; }
.dz-label { font-size: 14px; font-weight: 500; }
.dz-text { min-height: 66px; resize: vertical; }
.dz-note { padding: 10px 12px; border-radius: 12px; background: var(--pesak); font-size: 13.5px; line-height: 1.45; color: var(--grafit-tamni); }
.dz-tip { font-size: 13px; line-height: 1.5; color: var(--grafit); }
.dz-link { justify-self: start; padding: 0; border: 0; background: none; color: var(--ugalj); font: inherit; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.dz-range { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "l o" "i i"; align-items: center; gap: 6px 10px; }
.dz-range .dz-label { grid-area: l; }
.dz-range output { grid-area: o; font-family: var(--mono); font-size: 12px; color: var(--grafit); }
.dz-range input { grid-area: i; width: 100%; accent-color: var(--ugalj); }

.dz-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; justify-self: start; padding: 3px; border-radius: 12px; background: var(--pesak); }
.dz-seg label { position: relative; cursor: pointer; }
.dz-seg input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dz-seg span { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 9px; font-size: 14px; color: var(--grafit-tamni); transition: background-color .2s, color .2s, box-shadow .2s; }
.dz-seg label:hover span { color: var(--ugalj); }
.dz-seg input:checked + span { background: var(--zuta); color: var(--ugalj); font-weight: 500; box-shadow: 0 1px 2px rgba(11, 11, 11, .14); }
.dz-seg input:focus-visible + span { outline: 2px solid var(--ugalj); outline-offset: 2px; }

.dz-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.dz-color { position: relative; flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(11, 11, 11, .16); cursor: pointer; transition: transform .2s; }
.dz-color:hover { transform: scale(1.08); }
.dz-color.is-on { box-shadow: inset 0 0 0 1px rgba(11, 11, 11, .16), 0 0 0 2px var(--papir-svetli), 0 0 0 3.5px var(--ugalj); }
.dz-color--custom { background: conic-gradient(from 90deg, #ff5a5a, #ffb547, #f2e94e, #5bd46b, #45c8f0, #5b6cff, #c25bff, #ff5a5a); }
.dz-color--custom::after { content: ""; position: absolute; inset: 27%; border-radius: 50%; background: var(--c); }
.dz-color--custom input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.dz-color:focus-visible, .dz-color--custom:focus-within { outline: 2px solid var(--ugalj); outline-offset: 3px; }

.dz-toggles { display: grid; border: 1px solid var(--linija); border-radius: 14px; background: #fff; }
.dz-tog { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; cursor: pointer; }
.dz-tog + .dz-tog { border-top: 1px solid var(--linija); }
.dz-tog__t { display: grid; gap: 2px; min-width: 0; }
.dz-tog__t b { font-size: 14.5px; font-weight: 500; }
.dz-tog__t small { font-size: 13px; line-height: 1.4; color: var(--grafit); }
.dz .switch input:checked::after { background: var(--zuta); }

.dz-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.dz-check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--pesak); font-size: 14px; cursor: pointer; }
.dz-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ugalj); }

.dz-file { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--pesak); }
.dz-file img { flex: none; width: 66px; height: 42px; border-radius: 6px; object-fit: cover; }
.dz-file span { flex: 1; display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.dz-file small { font-size: 12.5px; color: var(--grafit); }
.dz-add { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 1.5px dashed #BDBAB2; border-radius: 14px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .2s, background-color .2s; }
.dz-add:hover { border-color: var(--ugalj); background: rgba(233, 231, 225, .5); }
.dz-add .icon { flex: none; width: 24px; height: 24px; }
.dz-add span { display: grid; gap: 2px; }
.dz-add b { font-size: 15px; font-weight: 500; }
.dz-add small { font-size: 13px; color: var(--grafit); }
.dz-finished { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border-radius: 16px; background: var(--zuta-svetla); }
.dz-finished__t { flex: 1 1 260px; display: grid; gap: 4px; }
.dz-finished__t b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.dz-finished__t small { font-size: 13px; line-height: 1.45; color: var(--grafit-tamni); }
.dz-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.dz-tpl { display: grid; gap: 6px; padding: 6px 6px 8px; border: 1px solid var(--linija); border-radius: 12px; background: #fff; color: inherit; font: inherit; font-size: 12.5px; text-align: center; cursor: pointer; transition: border-color .2s, transform .3s cubic-bezier(.3, 1.4, .5, 1); }
.dz-tpl:hover { border-color: var(--ugalj); transform: translateY(-2px); }
.dz-tpl__mini .dz-card { border-radius: 5px; box-shadow: 0 0 0 1px rgba(11, 11, 11, .08); }

/* Široko (admin): kartica levo, podešavanja desno */
@media (min-width: 1100px) {
  .dz--wide .dz-work { grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); align-items: start; }
  .dz--wide .dz-stage { position: sticky; top: calc(var(--header-h) + 16px); }
}

/* Telefon: traka i kartica ostaju gore dok se menjaju podešavanja */
@media (max-width: 700px) {
  .dz-stage { position: sticky; top: calc(var(--header-h) + 6px); z-index: 6; gap: 10px; padding: 10px; border-radius: 20px; box-shadow: 0 10px 24px -18px rgba(11, 11, 11, .45); }
  .dz-scene { width: min(100%, 320px); }
  .dz-hint { display: none; }
  .dz-side { gap: 10px; padding: 8px 10px 8px 8px; }
  .dz-side__mini { width: 62px; }
  .dz-side__t b { font-size: 14.5px; }
  .dz-row--2 { grid-template-columns: minmax(0, 1fr); }
  .dz-props { padding: 14px; }
  .dz-tool { min-width: 52px; }
  /* traka se skroluje: desna ivica bledi, da se vidi da ima još dugmića */
  .dz-tools { -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); padding-right: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .dz-flip, .dz-side, .dz-tpl { transition: none; }
}
