/* ============================================================
   designer.css — Canopy 3D Designer | Print Pros Inc
   ============================================================ */

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #111827;
  --surface:  #1f2937;
  --surface2: #374151;
  --accent:   #f97316;
  --accent2:  #3b82f6;
  --ok:       #22c55e;
  --danger:   #ef4444;
  --text:     #f9fafb;
  --muted:    #9ca3af;
  --border:   rgba(255,255,255,.08);
  --radius:   10px;
  --left:     300px;
  --right:    220px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 2px; }

/* ══════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════ */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 52px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  flex-shrink: 0;
}
.brand { font-size: 14px; font-weight: 800; color: var(--accent); letter-spacing: .5px; }
.brand em { color: var(--text); font-style: normal; }
.header-logo { height: 24px; width: auto; object-fit: contain; flex-shrink: 0; }
.spacer { flex: 1; }

/* Header buttons */
.hbtn {
  padding: 7px 14px;
  border-radius: 7px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .3px;
}
.hbtn-ghost  { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.hbtn-ghost:hover  { background: var(--surface2); color: var(--text); }
.hbtn-orange { background: var(--accent); color: #fff; }
.hbtn-orange:hover { background: #ea6a00; }
.hbtn-green  { background: var(--ok); color: #fff; }
.hbtn-green:hover  { background: #16a34a; }
.hbtn-blue   { background: var(--accent2); color: #fff; }
.hbtn-blue:hover   { background: #2563eb; }

/* ══════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════ */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ══════════════════════════════════════════════
   LEFT SIDEBAR
   ══════════════════════════════════════════════ */
aside {
  width: var(--left);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1;
  padding: 10px 4px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
}
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Tab panes */
.tabpane {
  display: none;
  flex-direction: column;
  padding: 14px;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}
.tabpane.on { display: flex; }

/* ══════════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════════ */
.lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 3px;
}
.sep { border-top: 1px solid var(--border); margin: 4px 0; }

input[type=text],
input[type=number],
select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  outline: none;
  width: 100%;
  transition: border-color .15s;
}
input:focus,
select:focus,
textarea:focus { border-color: var(--accent); }

textarea      { resize: vertical; min-height: 52px; }
input[type=color] {
  width: 36px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
}
input[type=range] { width: 100%; accent-color: var(--accent); }

.row { display: flex; gap: 8px; align-items: center; }
.row label { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ══════════════════════════════════════════════
   PANEL GRID
   ══════════════════════════════════════════════ */
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pbtn {
  padding: 8px 6px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  transition: all .15s;
}
.pbtn:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
.pbtn.sel   { border-color: var(--accent); background: rgba(249,115,22,.12); color: var(--accent); }
.pbtn.span2 { grid-column: span 2; }

/* ══════════════════════════════════════════════
   COLOR SWATCHES
   ══════════════════════════════════════════════ */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .12s;
  flex-shrink: 0;
}
.sw:hover { transform: scale(1.2); }
.sw.on    { border-color: #fff; transform: scale(1.2); }

/* ══════════════════════════════════════════════
   ARTWORK UPLOAD
   ══════════════════════════════════════════════ */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all .15s;
}
.dropzone:hover { border-color: var(--accent); background: rgba(249,115,22,.04); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon { font-size: 26px; margin-bottom: 6px; }
.dz-txt  { font-size: 11px; color: var(--muted); line-height: 1.5; }
.dz-txt strong { color: var(--text); display: block; margin-bottom: 2px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  cursor: pointer;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.thumb:hover .t-apply { opacity: 1; }
.t-apply {
  position: absolute;
  inset: 0;
  background: rgba(249,115,22,.82);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}
.t-del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* ══════════════════════════════════════════════
   STEP & REPEAT SLOTS
   ══════════════════════════════════════════════ */
.slot {
  background: var(--surface2);
  border-radius: 8px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
}
.slot-prev {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.slot-prev img { width: 100%; height: 100%; object-fit: contain; }
.slot-info { flex: 1; min-width: 0; }
.slot-lbl  { font-size: 9px; text-transform: uppercase; font-weight: 700; letter-spacing: .6px; color: var(--muted); }
.slot-name { font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.slot-btn  {
  font-size: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.slot-btn:hover { color: var(--text); border-color: rgba(255,255,255,.3); }

.apply-btn {
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  background: var(--accent);
  color: #fff;
}
.apply-btn:hover { background: #ea6a00; }

/* ══════════════════════════════════════════════
   3D VIEWPORT
   ══════════════════════════════════════════════ */
.vp {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 60%, #1e3a5f 0%, #0a1628 100%);
}
#c { display: block; }

.vp-bottom {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.vbtn {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(10,22,40,.7);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all .15s;
}
.vbtn:hover { background: rgba(255,255,255,.1); }
.vbtn.on    { background: var(--accent); border-color: var(--accent); }

/* Loader overlay */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  z-index: 10;
  transition: opacity .4s;
}
.spin {
  width: 38px;
  height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   RIGHT PANEL PROPERTIES
   ══════════════════════════════════════════════ */
.props {
  width: var(--right);
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 10px;
  flex-shrink: 0;
  overflow-y: auto;
}
.props-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.props-empty { font-size: 11px; color: var(--muted); text-align: center; margin-top: 24px; line-height: 1.7; }

.props-body       { display: none; flex-direction: column; gap: 9px; }
.props-body.on    { display: flex; }

.prop             { display: flex; flex-direction: column; gap: 3px; }
.prop .lbl        { margin-bottom: 0; }
.selected-name    { font-size: 13px; font-weight: 700; color: var(--accent); }

.clear-btn {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--danger);
  border-radius: 7px;
  padding: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}
.clear-btn:hover { background: rgba(239,68,68,.25); }

/* ══════════════════════════════════════════════
   SAVED PROJECTS LIST
   ══════════════════════════════════════════════ */
.saved-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.saved-item {
  background: var(--surface2);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
}
.saved-thumb {
  width: 60px;
  height: 40px;
  border-radius: 5px;
  background: #000;
  flex-shrink: 0;
  overflow: hidden;
}
.saved-thumb img { width: 100%; height: 100%; object-fit: cover; }
.saved-info      { flex: 1; min-width: 0; }
.saved-name      { font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-id        { font-size: 10px; color: var(--muted); font-family: monospace; }
.saved-date      { font-size: 10px; color: var(--muted); margin-top: 1px; }
.saved-actions   { display: flex; gap: 5px; flex-shrink: 0; }
.saved-load {
  font-size: 10px;
  background: var(--accent2);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
}
.saved-load:hover { background: #2563eb; }
.saved-del {
  font-size: 10px;
  background: rgba(239,68,68,.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 5px;
  padding: 4px 8px;
  cursor: pointer;
}
.saved-del:hover { background: rgba(239,68,68,.3); }

/* ══════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-head span { font-weight: 700; font-size: 14px; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.status-draft        { background: rgba(156,163,175,.2); color: var(--muted); }
.status-submitted    { background: rgba(59,130,246,.2); color: #60a5fa; }
.status-in_production{ background: rgba(249,115,22,.2); color: var(--accent); }
.status-complete     { background: rgba(34,197,94,.2); color: var(--ok); }

/* ══════════════════════════════════════════════
   TOAST NOTIFICATION
   ══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ok);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  transform: translateY(70px);
  opacity: 0;
  transition: all .25s;
  z-index: 9999;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.err  { background: var(--danger); }

/* ══════════════════════════════════════════════
   RESPONSIVE — collapse right panel on narrow screens
   ══════════════════════════════════════════════ */
@media (max-width: 1100px) {
  :root { --right: 180px; --left: 260px; }
}
@media (max-width: 860px) {
  .props { display: none; }
  :root  { --left: 240px; }
}
