:root{
  --bg: #f5f5f7;
  --panel: #ffffff;
  --border-subtle: #e5e7eb;
  --border-strong: #d1d5db;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent: #16a34a;
  --accent-soft: #dcfce7;
  --chip-bg: #f3f4f6;
  --radius: 18px;
  --shadow-soft: 0 10px 35px rgba(15,23,42,0.12);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text-main);
}

/* SHELL */
.editor-app{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

/* HEADER */
.editor-header{
  position:sticky;
  top:0;
  z-index:20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 24px;
  border-bottom:1px solid var(--border-subtle);
  backdrop-filter:blur(16px);
  background:rgba(245,245,247,0.9);
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:inherit;
}
.brand-logo{
  width:36px;
  height:36px;
  border-radius:12px;
  object-fit:cover;
  box-shadow:0 4px 10px rgba(15,23,42,0.15);
}
.brand-text{
  display:flex;
  flex-direction:column;
}
.brand-title{
  font-weight:600;
  font-size:16px;
}
.brand-sub{
  font-size:12px;
  color:var(--text-muted);
}

.header-right{
  display:flex;
  gap:8px;
}

/* BUTOANE */
.btn-ghost,
.btn-primary,
.btn-chip{
  border-radius:999px;
  border:1px solid transparent;
  padding:7px 14px;
  font-size:13px;
  cursor:pointer;
  background:#fff;
  color:var(--text-main);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  transition:background .15s ease, box-shadow .15s ease, transform .1s ease, border-color .15s ease;
}
.btn-ghost{
  border-color:var(--border-subtle);
}
.btn-ghost:hover{
  background:#f9fafb;
  box-shadow:0 2px 8px rgba(15,23,42,.08);
}
.btn-primary{
  background:var(--accent);
  color:#f9fafb;
  border-color:var(--accent);
  font-weight:600;
}
.btn-primary:hover{
  background:#16a34a;
  box-shadow:0 4px 14px rgba(22,163,74,.28);
  transform:translateY(-1px);
}

.btn-chip{
  background:var(--chip-bg);
  border-color:var(--border-subtle);
  font-size:12px;
  padding:5px 12px;
}
.btn-chip-active{
  background:var(--accent-soft);
  color:#166534;
  border-color:#bbf7d0;
}

/* MAIN LAYOUT */
.editor-main{
  display:grid;
  grid-template-columns:320px minmax(0,1fr);
  gap:16px;
  padding:16px 20px 12px;
}

/* SIDEBAR */
.sidebar{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.side-block{
  background:var(--panel);
  border-radius:var(--radius);
  border:1px solid var(--border-subtle);
  padding:14px 14px 12px;
}
.side-title{
  font-size:13px;
  font-weight:600;
  margin-bottom:8px;
}
.side-hint{
  margin-top:6px;
  font-size:12px;
  color:var(--text-muted);
}

/* Fields */
.field-label{
  display:block;
  font-size:12px;
  color:var(--text-muted);
  margin-bottom:4px;
}
.field-input{
  width:100%;
  border-radius:12px;
  border:1px solid var(--border-subtle);
  padding:8px 10px;
  font-size:13px;
  background:#f9fafb;
  outline:none;
}
.field-input:focus{
  border-color:#22c55e;
  box-shadow:0 0 0 1px rgba(34,197,94,.3);
  background:#ffffff;
}
textarea.field-input{
  resize:vertical;
  min-height:50px;
}
.field-color{
  width:100%;
  height:34px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  padding:0;
  background:#f9fafb;
}

.field-row{
  display:flex;
  gap:8px;
  margin-top:8px;
}
.field-col{
  flex:1;
}

/* Checkbox */
.checkbox-line{
  display:flex;
  align-items:center;
  gap:6px;
  margin-top:8px;
  font-size:12px;
  color:var(--text-muted);
}
.checkbox-line input{
  accent-color:#16a34a;
}

/* Preț */
.price-card{
  margin-top:10px;
  padding:8px 9px;
  border-radius:14px;
  border:1px dashed var(--border-strong);
  background:#f9fafb;
  font-size:12px;
}
.price-title{
  font-weight:600;
  margin-bottom:4px;
  color:var(--text-muted);
}
.price-badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:3px;
}
.price-badges span{
  border-radius:999px;
  padding:3px 8px;
  background:#fff;
  border:1px solid var(--border-subtle);
}
.price-meta{
  font-size:11px;
  color:var(--text-muted);
}

/* STAGE (canvas) */
.stage{
  background:var(--panel);
  border-radius:var(--radius);
  border:1px solid var(--border-subtle);
  padding:12px 14px 10px;
  display:flex;
  flex-direction:column;
  min-height:420px;
  box-shadow:var(--shadow-soft);
}
.stage-top{
  display:flex;
  align-items:center;
  gap:8px;
  justify-content:space-between;
  margin-bottom:8px;
}
.stage-buttons{
  display:flex;
  gap:6px;
}

.chip{
  padding:4px 9px;
  border-radius:999px;
  background:var(--chip-bg);
  border:1px solid var(--border-subtle);
  font-size:11px;
}
.chip-muted{
  color:var(--text-muted);
}

.stage-canvas{
  position:relative;
  border-radius:16px;
  border:1px solid #e5e7eb;
  overflow:hidden;
  background:radial-gradient(circle at top, #fdfcfb 0, #f3f4f6 55%, #e5e7eb 100%);
  min-height:320px;
}
#viewport{
  width:100%;
  height:100%;
  display:block;
}

.stage-help{
  margin-top:8px;
  font-size:11px;
  color:var(--text-muted);
}

/* TEMPLATES */
.templates{
  margin:8px 20px 4px;
  padding:12px 14px 16px;
  background:transparent;
}
.templates-header{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom:8px;
}
.templates-header h2{
  font-size:14px;
  font-weight:600;
}
.templates-header p{
  font-size:12px;
  color:var(--text-muted);
}
.templates-filters{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:flex-end;
}

.filter-pill{
  border-radius:999px;
  border:1px solid var(--border-subtle);
  padding:4px 10px;
  font-size:11px;
  background:#ffffff;
  color:var(--text-muted);
  cursor:pointer;
  transition:background .15s ease, color .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.filter-pill:hover{
  background:#f3f4f6;
}

.filter-pill-active{
  background:var(--accent-soft);
  color:#166534;
  border-color:#bbf7d0;
  box-shadow:0 2px 6px rgba(22,163,74,.18);
}
.tpl-grid{
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding-bottom:4px;
}
.tpl-card{
  flex:0 0 180px;
  border-radius:16px;
  background:#ffffff;
  border:1px solid var(--border-subtle);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.tpl-thumb{
  width:100%;
  aspect-ratio:4/3;
  background:#f3f4f6;
  display:flex;
  align-items:center;
  justify-content:center;
}
.tpl-thumb img{
  max-width:100%;
  max-height:100%;
  display:block;
}
.tpl-body{
  padding:8px 9px 8px;
}
.tpl-title{
  font-size:13px;
  margin-bottom:4px;
}
.tpl-body p{
  margin:0;
}
.tpl-actions{
  margin-top:6px;
  display:flex;
  gap:6px;
}
.btn-small{
  font-size:11px;
  padding:5px 8px;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:#f9fafb;
  cursor:pointer;
}
.btn-small:hover{
  background:#eef2ff;
}

/* LISTE JOS */
.bottom-lists{
  margin:0 20px 20px;
  padding:12px 0 4px;
  border-top:1px solid var(--border-subtle);
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}
.bottom-col h3{
  font-size:14px;
  margin-bottom:4px;
}
.bottom-sub{
  font-size:12px;
  color:var(--text-muted);
  margin-bottom:8px;
}

.thumb-grid{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.thumb-item{
  width:132px;
  border-radius:14px;
  overflow:hidden;
  background:#ffffff;
  border:1px solid var(--border-subtle);
  text-decoration:none;
  color:var(--text-main);
  font-size:11px;
}
.thumb-item img{
  width:100%;
  height:82px;
  object-fit:cover;
  display:block;
}
.thumb-body{
  padding:6px 7px;
}
.thumb-title{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* RESPONSIVE */
@media (max-width:1100px){
  .editor-main{
    grid-template-columns:minmax(0,1fr);
  }
  .sidebar{
    order:2;
  }
  .stage{
    order:1;
  }
}
@media (max-width:768px){
  .editor-header{
    flex-direction:column;
    align-items:flex-start;
    gap:8px;
  }
  .header-right{
    width:100%;
    justify-content:flex-end;
    flex-wrap:wrap;
  }
  .bottom-lists{
    grid-template-columns:1fr;
  }
}
/* HUD deasupra canvas-ului (info selecție) */
.editor-hud{
  position:absolute;
  left:14px;
  bottom:12px;
  pointer-events:none;
  font-size:11px;
  z-index:5;
}
.editor-hud .hud-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:5px 9px;
  border-radius:999px;
  background:rgba(15,23,42,0.88);
  color:#f9fafb;
  box-shadow:0 6px 18px rgba(15,23,42,0.45);
}
.editor-hud .hud-target{
  font-weight:600;
}
.editor-hud .hud-dims{
  opacity:0.9;
}

.shape-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.shape-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
}

.shape-btn.is-active {
  background: #0f172a;
  color: #f9fafb;
  border-color: #0f172a;
}
