/* ========================================
   Cantinho v2 — Estilos
   Tudo via menu de contexto. Simples.
   ======================================== */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  background: #fff;
  color: #1a1a2e;
}

.hidden { display: none !important; }

/* ---------- Canvas ---------- */
.canvas {
  position: fixed;
  inset: 0;
  overflow: auto;
  background: #ffffff;
}

.canvas.edit-mode {
  background-image: radial-gradient(circle, #d4d4d8 0.6px, transparent 0.6px);
  background-size: 20px 20px;
  background-color: #fafafa;
}

/* ---------- Elementos ---------- */
.element {
  position: absolute;
  user-select: none;
}

.element.editable { cursor: grab; }
.element.editable:active { cursor: grabbing; }

.element.selected {
  outline: 2px solid #3b82f6;
  outline-offset: 3px;
}

/* -- Texto -- */
.element-text .text-content {
  min-width: 40px;
  min-height: 20px;
  padding: 8px 12px;
  outline: none;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* -- Imagem -- */
.element-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* -- Botão -- */
.element-button .btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 8px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: filter 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.element-button .btn-content:hover { filter: brightness(1.08); }
.element-button.editable .btn-content { pointer-events: none; }

/* -- Hotspot -- */
.element-hotspot { background: transparent; }
.element-hotspot.editable {
  background: rgba(59, 130, 246, 0.06);
  border: 2px dashed rgba(59, 130, 246, 0.5);
  border-radius: 4px;
}
.element-hotspot.editable::after {
  content: '🔗 Hotspot';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  color: #3b82f6;
  opacity: 0.6;
  pointer-events: none;
}
.element-hotspot .hs-link {
  display: block;
  width: 100%;
  height: 100%;
}

/* ========================================
   Menu de Contexto
   ======================================== */
.ctx-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 4px;
  min-width: 210px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  z-index: 50000;
  font-size: 13px;
}

/* Submenu — aparece ao passar o mouse */
.ctx-sub {
  position: absolute;
  left: 100%;
  top: -4px;
  display: none;
}
.has-sub:hover > .ctx-sub {
  display: block;
}

/* Item do menu */
.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  color: #334155;
  transition: background 0.08s;
}
.ctx-item:hover { background: #f1f5f9; }
.ctx-item.danger { color: #dc2626; }
.ctx-item.danger:hover { background: #fef2f2; }

/* Ícone Material */
.ctx-ic {
  font-size: 18px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Swatch de cor */
.ctx-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
  flex-shrink: 0;
}

/* Label */
.ctx-lbl { flex-shrink: 0; }

/* Espaçador */
.ctx-spacer { flex: 1; }

/* Check ✓ */
.ctx-chk {
  font-size: 12px;
  color: #3b82f6;
  margin-left: 4px;
}

/* Seta de submenu */
.ctx-arrow {
  font-size: 14px;
  color: #94a3b8;
  margin-left: 4px;
}

/* Separador */
.ctx-sep {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 8px;
}

/* ========================================
   Dialogs
   ======================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60000;
}

.dialog {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  min-width: 340px;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.dialog h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 16px;
}
.dialog label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  margin-bottom: 12px;
}
.dialog input[type="text"],
.dialog input[type="url"] {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #334155;
  outline: none;
}
.dialog input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.dialog-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}
.dialog-btns button {
  padding: 8px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  color: #475569;
}
.dialog-btns button:hover { background: #f8fafc; }
.dialog-btns .primary {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
.dialog-btns .primary:hover { background: #2563eb; }

/* ========================================
   Indicador de Salvamento
   ======================================== */
.save-ind {
  position: fixed;
  bottom: 16px;
  right: 16px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  z-index: 40000;
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.save-ind.pending {
  background: #f0f4ff;
  color: #6366f1;
  border-color: #c7d2fe;
}
.save-ind.saving {
  background: #fffbeb;
  color: #d97706;
  border-color: #fde68a;
}
.save-ind.error {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

/* ---------- Scrollbar ---------- */
.canvas::-webkit-scrollbar { width: 6px; height: 6px; }
.canvas::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.canvas::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
