/* =============================================================
   Estúdio Camisetas — layout espelhado do Estúdio Dimona
   ============================================================= */
:root {
  --sidebar-bg: #1a1a1a;
  --sidebar-fg: #e0e0e0;
  --sidebar-active: #2a2a2a;
  --panel-bg: #ffffff;
  --canvas-bg: #f0f0f0;
  --accent: #c9a84c;
  --accent-dark: #a88c3a;
  --ink: #1a1a1a;
  --muted: #888888;
  --line: #e0e0e0;
  --danger: #e02020;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(20, 20, 40, .14);
  --font: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

@keyframes spin { to { transform: rotate(360deg); } }

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #app { height: 100%; overflow: hidden; }
body { font-family: var(--font); color: var(--ink); background: var(--canvas-bg); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.hidden { display: none !important; }

#app { display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 30; position: relative;
}
.topbar-left, .topbar-right { flex: 1; display: flex; align-items: center; gap: 10px; }
.topbar-right { justify-content: flex-end; }
.badge-local {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; padding: 4px 10px; border-radius: 20px;
}
.logo { font-size: 22px; font-weight: 900; letter-spacing: .12em; }
.logo span { color: var(--accent); font-weight: 400; }
.btn-ghost {
  display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
}
.btn-ghost:hover { background: #f4f4f8; }
.menu-wrap { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow); min-width: 250px;
  padding: 6px; z-index: 50; border: 1px solid var(--line);
}
.dropdown button {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  border-radius: 6px; font-size: 13.5px;
}
.dropdown button:hover { background: #f2f7f4; color: var(--accent-dark); }
.dropdown hr { border: none; border-top: 1px solid var(--line); margin: 5px 4px; }

/* ---------- Workspace ---------- */
.workspace { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 76px; background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column; align-items: stretch; padding: 8px 0; z-index: 20;
}
.side-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 13px 4px; color: var(--sidebar-fg); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.side-btn svg { width: 22px; height: 22px; }
.side-btn:hover { color: #fff; }
.side-btn.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side-spacer { flex: 1; }

.panel {
  width: 292px; background: var(--panel-bg); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 18px; z-index: 15;
}
.panel h2 { font-size: 15px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .04em; }
.panel h3 { font-size: 13px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; }
.panel p { font-size: 13px; color: var(--muted); line-height: 1.55; margin-bottom: 10px; }

.upload-box {
  border: 2px dashed var(--accent); border-radius: var(--radius); padding: 20px 14px;
  text-align: center; color: var(--accent-dark); cursor: pointer; transition: background .15s;
}
.upload-box:hover, .upload-box.dragover { background: #eefaf3; }
.upload-box strong { display: block; font-size: 14px; margin-bottom: 6px; }
.upload-box small { color: var(--muted); font-size: 11.5px; line-height: 1.5; display: block; }

.dica-box { background: #f6f6fa; border-radius: var(--radius); padding: 14px; margin-top: 16px; }
.dica-box h4 { font-size: 13.5px; margin-bottom: 8px; }
.dica-box p { font-size: 12.5px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid #c9c9d2;
  cursor: pointer; transition: transform .12s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { outline: 3px solid var(--accent); outline-offset: 2px; }

.estampa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.estampa-item {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color .12s, background .12s; background: #fafafc;
}
.estampa-item:hover { border-color: var(--accent); background: #eefaf3; }
.estampa-item svg { width: 60%; height: 60%; fill: #2a2a35; }

.texto-preset { display: block; width: 100%; text-align: left; padding: 12px 10px; border-radius: 8px; }
.texto-preset:hover { background: #f2f7f4; }
.texto-preset.g { font-size: 30px; font-weight: 800; }
.texto-preset.m { font-size: 21px; font-weight: 600; }
.texto-preset.p { font-size: 14px; }

.produto-info { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.produto-info b { display: block; font-size: 15px; margin-bottom: 2px; }
.produto-info .medida { font-size: 12px; color: var(--muted); margin-top: 6px; }
.btn-block {
  display: block; width: 100%; padding: 11px; border-radius: 8px; font-weight: 700;
  font-size: 13.5px; text-align: center; margin-top: 10px;
  background: var(--ink); color: #fff;
}
.btn-block:hover { background: #34344a; }
.btn-block.outline { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-block.outline:hover { background: #f4f4f8; }

/* camadas */
.layer-row {
  display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: 7px; cursor: pointer; background: #fff; font-size: 13px;
}
.layer-row.active { border-color: var(--accent); background: #eefaf3; }
.layer-row .layer-thumb {
  width: 34px; height: 34px; border-radius: 6px; background: #f0f0f4;
  display: flex; align-items: center; justify-content: center; font-size: 16px; overflow: hidden;
}
.layer-row .layer-thumb img { max-width: 100%; max-height: 100%; }
.layer-row .layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row button { padding: 3px 6px; color: var(--muted); border-radius: 5px; font-size: 13px; }
.layer-row button:hover { background: #e8e8ef; color: var(--ink); }

/* ---------- Canvas ---------- */
.canvas-area { flex: 1; position: relative; min-width: 0; background: var(--canvas-bg); }
.canvas-area canvas { display: block; }

.float-tools {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px; z-index: 10;
}
.float-tools button {
  width: 46px; min-height: 46px; background: #fff; border-radius: 10px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; padding: 6px 2px;
}
.float-tools button em { font-style: normal; font-size: 9.5px; font-weight: 700; }
.float-tools button:hover { background: #f4f4f8; }
.float-tools button.active { outline: 2px solid var(--accent); color: var(--accent-dark); }

.side-switch {
  position: absolute; right: 16px; bottom: 18px; display: flex; flex-direction: column;
  gap: 8px; z-index: 10;
}
.side-switch button {
  width: 62px; background: #fff; border-radius: 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted);
}
.side-switch button.active { outline: 2px solid var(--accent); color: var(--accent-dark); }
.side-switch button:hover { background: #f4f4f8; }

.obj-toolbar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 10px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 4px; padding: 6px 8px; z-index: 12;
}
.obj-toolbar button {
  min-width: 32px; height: 32px; border-radius: 7px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; padding: 0 7px;
}
.obj-toolbar button:hover { background: #f0f0f5; }
.obj-toolbar button.on { background: #eefaf3; color: var(--accent-dark); }
.obj-toolbar button.danger:hover { background: #fdeaea; color: var(--danger); }
.tool-sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }
.tool-color input { width: 30px; height: 30px; border: none; border-radius: 7px; cursor: pointer; background: none; }
.tool-font { height: 32px; border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; max-width: 130px; }

/* ---------- Bottombar ---------- */
.bottombar {
  height: 76px; background: #fff; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 16px; z-index: 20;
}
.project-slots { display: flex; gap: 10px; overflow-x: auto; }
.project-slot {
  width: 54px; height: 54px; border: 2px solid var(--line); border-radius: 9px;
  background: #fafafc center/cover no-repeat; cursor: pointer; flex: 0 0 auto;
  position: relative;
}
.project-slot.active { border-color: var(--accent); }
.project-slot .slot-x {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px;
  background: var(--ink); color: #fff; border-radius: 50%; font-size: 10px;
  display: none; align-items: center; justify-content: center;
}
.project-slot:hover .slot-x { display: flex; }
.btn-add {
  width: 54px; height: 54px; border: 2px dashed #b9b9c6; border-radius: 9px;
  font-size: 24px; color: var(--muted);
}
.btn-add:hover { border-color: var(--accent); color: var(--accent-dark); }
.bottombar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.resumo-preco { font-size: 13px; color: var(--muted); text-align: right; }
.resumo-preco b { color: var(--ink); font-size: 16px; }
.btn-concluir {
  background: var(--accent); color: #fff; font-weight: 800; letter-spacing: .06em;
  padding: 14px 28px; border-radius: 9px; font-size: 14px;
}
.btn-concluir:hover { background: var(--accent-dark); }

/* ---------- Modais ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(15, 15, 25, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  width: 520px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column;
}
.modal-wide { width: 980px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .04em; }
.modal-close { font-size: 16px; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: #f2f2f6; color: var(--danger); }
.modal-body { padding: 22px; overflow-y: auto; }

.prod-cat { font-size: 15px; font-weight: 800; text-transform: uppercase; margin: 18px 0 12px; }
.prod-cat:first-child { margin-top: 0; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.prod-card { text-align: center; }
.prod-card .prod-img {
  background: #f4f4f8; border-radius: 10px; padding: 8px; cursor: pointer;
  transition: box-shadow .15s;
}
.prod-card .prod-img:hover { box-shadow: 0 0 0 2px var(--accent); }
.prod-card .prod-img svg { width: 100%; height: auto; display: block; }
.prod-card .prod-img img { width: 100%; height: auto; display: block; }
.prod-card h3 { font-size: 13.5px; margin: 10px 0 2px; text-transform: uppercase; }
.prod-card .mini-swatches { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 8px; }
.prod-card .mini-swatches span {
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid #c2c2cc; cursor: pointer;
}
.prod-card .mini-swatches span:hover { transform: scale(1.25); }

/* orçamento */
.qty-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.qty-table th, .qty-table td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.qty-table input {
  width: 62px; padding: 7px; text-align: center; border: 1px solid var(--line);
  border-radius: 7px; font-size: 14px;
}
.qty-resumo { background: #f6f6fa; border-radius: 10px; padding: 14px 16px; font-size: 13.5px; line-height: 1.9; }
.qty-resumo .total { font-size: 19px; font-weight: 800; color: var(--accent-dark); }
.qty-resumo .desconto { color: var(--accent-dark); font-weight: 600; }
.qty-obs { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; }

/* ---------- Visualização 3D ---------- */
.view3d {
  position: absolute; inset: 0; background: var(--canvas-bg); z-index: 40;
}
.view3d-stage { position: absolute; inset: 0; }
.view3d-stage canvas { display: block; width: 100%; height: 100%; }
.view3d-close {
  position: absolute; top: 14px; right: 16px; width: 42px; height: 42px;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow);
  font-size: 16px; color: var(--ink);
}
.view3d-close:hover { background: #fdeaea; color: var(--danger); }
.view3d-hint {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,.9); padding: 7px 14px; border-radius: 20px;
  font-size: 12px; color: var(--muted); box-shadow: var(--shadow);
}
.view3d-credito {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: #a2a2ad;
}

/* toast */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 9px;
  font-size: 13.5px; z-index: 200; box-shadow: var(--shadow);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* botão de fechar o painel — só existe (visualmente) no modo overlay abaixo */
.panel-close { display: none; }

/* responsivo básico (uso em notebook pequeno) */
@media (max-width: 900px) {
  .panel { position: absolute; left: 76px; top: 0; bottom: 0; box-shadow: var(--shadow); }
  .modal-wide { width: 96vw; }

  /* no overlay, o painel cobre o canvas — sem isso não dava pra ver a camiseta */
  .panel-close {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 66px; right: 12px; z-index: 26;
    width: 34px; height: 34px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow); font-size: 16px; color: var(--ink);
  }
  .panel-close:hover { background: #fdeaea; color: var(--danger); }
}

/* celular: painel ocupa toda a largura restante (292px fixos deixava só uma tira do canvas) */
@media (max-width: 600px) {
  .panel { right: 0; width: auto; }
}
