/* Editor tricou personalizat. Totul e sub .tc; ruleaza in iframe (srcdoc) sau standalone. */
html, body { margin: 0; padding: 0; background: transparent; }
html.in-frame, html.in-frame body { overflow: hidden; }

.tc {
  --accent: #ff5a36;
  --accent-soft: #fff3ef;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e8e7e4;
  --card: #ffffff;
  --stage: #f3f2ef;
  --radius: 16px;
  --shirt: #f5f5f2;
  --vis-top: 0px;
  --vis-h: 100vh;
  position: relative;
  box-sizing: border-box;
  padding: 16px;
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.tc *, .tc *::before, .tc *::after { box-sizing: border-box; }
.tc button { font: inherit; color: inherit; }
.tc [hidden] { display: none !important; }

/* Antet */
.tc-head { margin: 0 0 16px; }
.tc-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.tc-head p { margin: 4px 0 0; color: var(--muted); }

/* Layout */
.tc-layout {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

/* Unelte */
.tc-tools { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 12px; z-index: 30; }  /* deasupra scenei, altfel popover-ul Forme ramane in spate */
.tc-tool-wrap { position: relative; }
.tc-tool {
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 11px 4px 9px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); cursor: pointer;
  font-size: 11.5px; font-weight: 600;
  transition: transform .18s cubic-bezier(.2,.9,.3,1.3), box-shadow .18s, border-color .18s, opacity .18s;
}
.tc-tool:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,.08); border-color: #d9d8d4; }
.tc-tool:active:not(:disabled) { transform: translateY(0) scale(.97); }
.tc-tool:disabled { opacity: .38; cursor: default; }
.tc-tool.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.tc-sep { height: 1px; background: var(--line); margin: 4px 6px; }

.tc-pop {
  position: absolute; left: calc(100% + 10px); top: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 46px); gap: 6px;
  padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.14);
  opacity: 0; transform: translateX(-6px) scale(.96); transform-origin: left top;
  pointer-events: none; transition: opacity .18s, transform .22s cubic-bezier(.2,.9,.3,1.3);
}
.tc-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.tc-pop button {
  width: 46px; height: 46px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer;
  color: var(--accent); transition: transform .15s, background .15s;
}
.tc-pop button:hover { transform: scale(1.08); background: var(--accent-soft); }

/* Scena */
.tc-stage-col { min-width: 0; }
.tc-sides-wrap { text-align: center; margin-bottom: 12px; }
.tc-sides {
  position: relative; display: inline-grid; grid-template-columns: 1fr 1fr;
  background: #ebeae6; border-radius: 999px; padding: 4px;
}
.tc-sides-ind {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: #fff; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: transform .32s cubic-bezier(.2,.9,.3,1.2);
}
.tc-sides.back .tc-sides-ind { transform: translateX(100%); }
.tc-sides button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  padding: 7px 22px; font-weight: 700; color: var(--muted); transition: color .2s;
}
.tc-sides button.on { color: var(--ink); }
.tc-sides .dot {
  position: absolute; top: 6px; right: 10px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); transform: scale(0); transition: transform .25s cubic-bezier(.2,.9,.3,1.5);
}
.tc-sides button.has .dot { transform: scale(1); }

.tc-stage {
  position: relative;
  background: radial-gradient(circle at 50% 38%, #ffffff 0, var(--stage) 72%);
  border-radius: 24px; padding: 22px;
  overflow: hidden;
}
.tc-stage-inner {
  position: relative; width: 100%; max-width: 600px; margin: 0 auto;
  aspect-ratio: 600 / 640;
}
.tc-stage-inner.flip-out { animation: tcFlipOut .17s ease-in forwards; }
.tc-stage-inner.flip-in { animation: tcFlipIn .28s cubic-bezier(.2,.8,.3,1.1); }
@keyframes tcFlipOut { to { transform: perspective(1000px) rotateY(90deg) scale(.95); opacity: .6; } }
@keyframes tcFlipIn { from { transform: perspective(1000px) rotateY(-90deg) scale(.95); opacity: .6; } to { transform: none; opacity: 1; } }

.tc-shirt, .tc-shirt svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tc-shirt svg { filter: drop-shadow(0 18px 22px rgba(0,0,0,.13)); }
.tc-shirt .tc-fill { transition: fill .45s ease; }

.tc-area { position: absolute; }
.tc-area::before {
  content: ""; position: absolute; inset: -1px; z-index: 4; pointer-events: none;
  border: 1.5px dashed rgba(0,0,0,.3); border-radius: 4px;
  opacity: 0; transition: opacity .25s;
}
.tc-area::after {
  content: attr(data-label); position: absolute; left: 50%; top: -24px; z-index: 4;
  transform: translate(-50%, 4px); white-space: nowrap; pointer-events: none;
  font-size: 11px; font-weight: 600; color: rgba(0,0,0,.5);
  opacity: 0; transition: opacity .25s, transform .25s;
}
.tc-stage:hover .tc-area::before, .tc-area.active::before, .tc-area:not(.has-content)::before { opacity: 1; }
.tc-stage:hover .tc-area::after, .tc-area.active::after { opacity: 1; transform: translate(-50%, 0); }
.tc.dark .tc-area::before { border-color: rgba(255,255,255,.5); }
.tc.dark .tc-area::after { color: rgba(255,255,255,.75); }

.tc-guide { position: absolute; z-index: 5; background: var(--accent); opacity: 0; pointer-events: none; transition: opacity .12s; }
.tc-guide.v { left: 50%; top: 0; bottom: 0; width: 1px; }
.tc-guide.h { top: 50%; left: 0; right: 0; height: 1px; }
.tc-guide.on { opacity: .9; }

.tc-empty {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; padding: 12px; color: rgba(0,0,0,.45); font-size: 13px; font-weight: 600;
  transition: opacity .3s, transform .3s;
}
.tc-empty svg { animation: tcFloat 2.4s ease-in-out infinite; }
.tc.dark .tc-empty { color: rgba(255,255,255,.7); }
.tc-area.has-content .tc-empty { opacity: 0; transform: scale(.94); }
@keyframes tcFloat { 50% { transform: translateY(-5px); } }

.tc-spin {
  position: absolute; left: 50%; top: 50%; z-index: 6; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%; border: 3px solid rgba(255,90,54,.25); border-top-color: var(--accent);
  animation: tcSpin .8s linear infinite; display: none;
}
.tc-area.busy .tc-spin { display: block; }
@keyframes tcSpin { to { transform: rotate(360deg); } }

.tc-drop {
  position: absolute; inset: 10px; z-index: 10; border-radius: 18px;
  border: 2px dashed var(--accent); background: rgba(255,90,54,.07);
  display: grid; place-items: center; font-weight: 700; color: var(--accent);
  opacity: 0; transform: scale(.98); pointer-events: none; transition: opacity .18s, transform .18s;
}
.tc-stage.dragging .tc-drop { opacity: 1; transform: none; }

.tc-hint { text-align: center; color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

/* Panou */
.tc-panel { min-width: 0; }
.tc-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.tc-card h3 {
  margin: 0 0 12px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.tc-sel.anim { animation: tcSlideIn .3s cubic-bezier(.2,.9,.3,1.15); }
@keyframes tcSlideIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } }

.tc-label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 6px; }
.tc-label:first-of-type { margin-top: 0; }
.tc-input {
  width: 100%; resize: vertical; min-height: 44px;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  font: inherit; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.tc-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,90,54,.15); }

.tc-fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tc-font {
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
  font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-color .15s, background .15s, transform .15s;
}
.tc-font:hover { transform: translateY(-1px); border-color: #d6d5d1; }
.tc-font.on { border-color: var(--accent); background: var(--accent-soft); }

.tc-colors { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tc-swatch {
  position: relative; width: 32px; height: 32px; border-radius: 50%; padding: 0;
  border: 1px solid rgba(0,0,0,.14); cursor: pointer;
  transition: transform .18s cubic-bezier(.2,.9,.3,1.4), box-shadow .18s;
}
.tc-swatch.sm { width: 26px; height: 26px; }
.tc-swatch:hover { transform: scale(1.12); }
.tc-swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); transform: scale(1.05); }
.tc-custom {
  display: inline-block; overflow: hidden;
  background: conic-gradient(#ff5a5a, #ffd25a, #5aff8a, #5ad2ff, #8a5aff, #ff5ad2, #ff5a5a);
}
.tc-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

.tc-toggles { display: flex; gap: 6px; margin-top: 12px; }
.tc-tog {
  flex: 1; padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  cursor: pointer; font-size: 12.5px; transition: background .15s, border-color .15s, color .15s;
}
.tc-tog.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.tc-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.tc-act {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  cursor: pointer; font-size: 11.5px; font-weight: 600;
  transition: transform .15s, border-color .15s, background .15s;
}
.tc-act:hover { transform: translateY(-1px); border-color: #d6d5d1; }
.tc-act.danger { color: #d92d20; }
.tc-act.danger:hover { background: #fff1f0; border-color: #f5c2bd; }

.tc-badge {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px;
  font-size: 13px; font-weight: 600; transition: background .2s, color .2s;
}
.tc-badge small { display: block; font-weight: 500; opacity: .85; }
.tc-badge.good { background: #e8f6ed; color: #11703a; }
.tc-badge.ok { background: #fff5df; color: #8a5a00; }
.tc-badge.bad { background: #fdeceb; color: #b42318; }

.tc-warn { font-size: 12.5px; color: #b42318; background: #fdeceb; border-radius: 10px; padding: 8px 10px; margin: 0 0 12px; }

.tc-cta {
  position: relative; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--accent); color: #fff !important; font-weight: 800; font-size: 16px;
  box-shadow: 0 10px 22px rgba(255,90,54,.32);
  transition: transform .18s cubic-bezier(.2,.9,.3,1.3), box-shadow .18s, background .25s;
}
.tc-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(255,90,54,.38); }
.tc-cta:active { transform: translateY(0) scale(.98); }
.tc-cta:disabled { opacity: .5; pointer-events: none; }
.tc-cta.loading { pointer-events: none; opacity: .85; }
.tc-cta.loading svg { animation: tcSpin .8s linear infinite; }
.tc-cta.done { background: #16a34a; box-shadow: 0 10px 22px rgba(22,163,74,.3); }
.tc-cta.shake { animation: tcShake .4s; }
@keyframes tcShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.tc-ghost {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; cursor: pointer; font-weight: 700; transition: background .15s, transform .15s;
}
.tc-ghost:hover { background: #f7f6f3; transform: translateY(-1px); }
/* Toast-uri si modal: pozitionate pe partea vizibila a iframe-ului */
.tc-toasts {
  position: absolute; left: 0; right: 0; z-index: 50; pointer-events: none;
  top: calc(var(--vis-top) + var(--vis-h) - 18px); transform: translateY(-100%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.tc-toast {
  max-width: min(92%, 440px); padding: 11px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  animation: tcToastIn .35s cubic-bezier(.2,.9,.3,1.3);
}
.tc-toast.ok { background: #15803d; }
.tc-toast.warn { background: #b45309; }
.tc-toast.err { background: #b42318; }
.tc-toast.out { animation: tcToastOut .25s forwards; }
@keyframes tcToastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes tcToastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }

.tc-modal {
  position: absolute; left: 0; right: 0; z-index: 60;
  top: var(--vis-top); height: var(--vis-h);
  display: flex; align-items: center; justify-content: center;
  background: rgba(18,18,24,.45); backdrop-filter: blur(3px);
  animation: tcFade .2s;
}
@keyframes tcFade { from { opacity: 0; } }
.tc-modal-box {
  width: calc(100% - 32px); max-width: 880px; max-height: calc(100% - 32px); overflow: auto;
  background: #fff; border-radius: 22px; padding: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.3);
  animation: tcPop .32s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes tcPop { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.tc-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tc-modal-head h3 { margin: 0; font-size: 18px; }
.tc-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f2f1ee; cursor: pointer; display: grid; place-items: center; }
.tc-x:hover { background: #e7e6e2; }
.tc-prev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tc-prev-grid figure { margin: 0; }
.tc-prev-img {
  aspect-ratio: 600 / 640; border-radius: 16px; overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #fff 0, var(--stage) 72%);
  display: grid; place-items: center;
}
.tc-prev-img img { width: 100%; height: 100%; object-fit: contain; animation: tcFade .3s; }
.tc-prev-img.loading::after {
  content: ""; width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(255,90,54,.25); border-top-color: var(--accent); animation: tcSpin .8s linear infinite;
}
.tc-prev-grid figcaption { text-align: center; font-weight: 700; margin-top: 8px; }
.tc-prev-foot { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tc-muted { color: var(--muted); font-size: 12.5px; }
.tc-prev-dl { display: flex; gap: 8px; flex-wrap: wrap; }
.tc-prev-dl button {
  display: inline-flex; gap: 6px; align-items: center; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600;
}
.tc-prev-dl button:hover { background: #f7f6f3; }

/* Ecrane mai inguste (si iframe-ul din Gomag, daca pagina e ingusta) */
@media (max-width: 960px) {
  .tc-layout { grid-template-columns: 78px minmax(0, 1fr); gap: 14px; }
  .tc-panel { grid-column: 1 / -1; }
  .tc-prev-grid { grid-template-columns: 1fr 1fr; }
}

/* Telefon: uneltele pe un rand, deasupra tricoului; Forme se deschide in jos, peste tricou */
@media (max-width: 640px) {
  .tc { padding: 10px; }
  .tc-layout { grid-template-columns: 1fr; gap: 12px; }
  .tc-tools { position: relative; top: auto; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .tc-tools .tc-tool, .tc-tool-wrap { flex: 1 1 0; min-width: 58px; }
  .tc-tool { padding: 8px 2px 6px; font-size: 10.5px; }
  .tc-sep { display: none; }
  .tc-pop { left: 0; top: calc(100% + 8px); transform: translateY(-6px) scale(.96); }
  .tc-stage { padding: 8px; }
  .tc-hint { display: none; }
  .tc-prev-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .tc *, .tc *::before, .tc *::after { animation: none !important; transition: none !important; }
}
