/* style.css — exp-02.1 planner-grafo (Fase 3.5) */

/* Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color-scheme: dark; }
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  background: #1a1a2e;
  color: #e0e0e0;
  overflow: hidden;
}

/* Header */
#header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: #16213e; border-bottom: 1px solid #0f3460; }
#header h1 { font-size: 14px; font-weight: 600; color: #00b4d8; letter-spacing: 0.05em; flex-shrink: 0; }
#input-nome { flex: 1; max-width: 360px; background: #0f3460; color: #e0e0e0; border: 1px solid #1a4a7a; border-radius: 4px; padding: 6px 10px; font-size: 13px; font-family: inherit; }
#input-nome:focus { outline: 1px solid #00b4d8; }

/* Main 3 colunas */
#main { display: grid; grid-template-columns: 240px 1fr 280px; overflow: hidden; }
#painel-esq, #painel-dir { background: #16213e; overflow-y: auto; padding: 12px 0; }
#painel-esq { border-right: 1px solid #0f3460; }
#painel-dir { border-left: 1px solid #0f3460; padding: 12px 14px; }
.painel-secao { padding: 0 14px 16px; }
.painel-titulo { font-size: 11px; font-weight: 600; color: #6b7db3; letter-spacing: 0.08em; margin-bottom: 8px; padding: 0; }
#painel-dir > .painel-titulo { margin-bottom: 12px; }

/* Toolbar tools (coluna esquerda) */
#toolbar-tools { display: flex; flex-direction: column; gap: 4px; }
.btn-tool { background: transparent; color: #d0d8f0; border: 1px solid transparent; border-radius: 5px; padding: 7px 10px; text-align: left; cursor: pointer; font-size: 13px; font-family: inherit; transition: background 0.12s, border-color 0.12s; }
.btn-tool:hover:not(:disabled) { background: #1e2d50; border-color: #2a3d6a; }
.btn-tool.ativo { background: #0f3460; color: #00b4d8; border-color: #00b4d8; }
.btn-tool:disabled { color: #4a5580; cursor: not-allowed; opacity: 0.6; }

/* Camada de marcação (overlay vindo do Marcador) */
.mk-tog { display: block; font-size: 11px; color: #c0c8e0; cursor: pointer; padding: 2px 0; }
.mk-tog input { vertical-align: middle; margin-right: 6px; }

/* Lista de cômodos */
#lista-comodos { display: flex; flex-direction: column; gap: 4px; }
.lista-vazia, .props-vazio { color: #6b7db3; font-size: 12px; font-style: italic; padding: 8px 4px; }
.item-comodo { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 5px; cursor: pointer; transition: background 0.12s; }
.item-comodo:hover { background: #1e2d50; }
.item-comodo.selecionado { background: #0f3460; }
.dot-cor { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.15); }
.item-comodo-nome { flex: 1; font-size: 12px; }
.item-comodo-tipo { font-size: 10px; color: #6b7db3; text-transform: uppercase; }

/* Canvas */
#canvas-area { position: relative; background: #1a1a2e; overflow: hidden; }
#editor-svg { width: 100%; height: 100%; display: block; cursor: crosshair; background: #1a1a2e; }
#editor-svg.mode-select { cursor: default; }
#editor-svg.mode-delete { cursor: not-allowed; }
#editor-svg.mode-zoom_region { cursor: crosshair; }
.grid-linha-menor { stroke: #2a3d6a; stroke-width: 0.5; opacity: 0.5; }
.grid-linha-maior { stroke: #3a4d7a; stroke-width: 0.8; opacity: 0.7; }

/* Cotas (paint-order: stroke cria halo de contraste em cima de fills e walls) */
.wall-label {
  fill: #cfe8ee;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  paint-order: stroke;
  stroke: #1a1a2e;
  stroke-width: 3px;
  stroke-linejoin: round;
  user-select: none;
}
.room-area {
  fill: #e0e0e0;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  paint-order: stroke;
  stroke: #1a1a2e;
  stroke-width: 3px;
  stroke-linejoin: round;
  user-select: none;
}

/* Painel propriedades */
.prop-group { margin-bottom: 14px; }
.prop-label { display: block; font-size: 11px; color: #6b7db3; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.prop-value-ro { font-size: 13px; color: #a8dadc; padding: 4px 0; }
.prop-input, .prop-select { width: 100%; background: #0f3460; color: #e0e0e0; border: 1px solid #1a4a7a; border-radius: 4px; padding: 6px 8px; font-size: 13px; font-family: inherit; }
.prop-input:focus, .prop-select:focus { outline: 1px solid #00b4d8; }
.prop-select option { background: #0f3460; }

/* Footer */
#footer { display: flex; align-items: center; gap: 16px; padding: 8px 14px; background: #16213e; border-top: 1px solid #0f3460; font-size: 12px; color: #6b7db3; }
#coords-cursor { font-family: 'Cascadia Code', 'Consolas', monospace; min-width: 240px; }
#msg-erro { flex: 1; color: #ff8888; }
#footer-botoes { display: flex; gap: 6px; }
.btn-footer { background: #0f3460; color: #d0d8f0; border: 1px solid #1a4a7a; border-radius: 4px; padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit; }
.btn-footer:hover { background: #1a4a7a; }
.btn-footer.btn-perigo:hover { background: #c0392b; border-color: #c0392b; color: #fff; }

/* ============== Cota flutuante (durante draw_wall) ============== */
#canvas-area { position: relative; }
#cota-floating {
  position: absolute;
  background: #00b4d8;
  color: #1a1a2e;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  z-index: 100;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transform: translate(12px, -28px);
}

/* ============== Modal de confirmação de cota ============== */
#cota-modal {
  position: absolute;
  background: #16213e;
  border: 1px solid #00b4d8;
  border-radius: 6px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  z-index: 200;
  min-width: 260px;
}
#cota-modal .modal-titulo {
  font-size: 11px; color: #00b4d8; letter-spacing: 0.05em;
  margin-bottom: 10px; text-transform: uppercase;
}
#cota-modal .modal-input-row {
  display: flex; gap: 6px; align-items: stretch; margin-bottom: 10px;
}
#cota-input {
  flex: 1; background: #0f3460; color: #e0e0e0;
  border: 1px solid #1a4a7a; border-radius: 4px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
#cota-input:focus { outline: 1px solid #00b4d8; }
#cota-modal .unit-toggle { display: flex; }
#cota-modal .unit-btn {
  background: #0f3460; color: #6b7db3;
  border: 1px solid #1a4a7a;
  padding: 6px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
#cota-modal .unit-btn:first-child { border-radius: 4px 0 0 4px; border-right: 0; }
#cota-modal .unit-btn:last-child  { border-radius: 0 4px 4px 0; }
#cota-modal .unit-btn.ativo { background: #00b4d8; color: #1a1a2e; border-color: #00b4d8; }
#cota-modal .modal-botoes { display: flex; gap: 6px; justify-content: flex-end; }
#cota-modal .btn-modal {
  background: #0f3460; color: #d0d8f0;
  border: 1px solid #1a4a7a; border-radius: 4px;
  padding: 7px 14px; font-size: 12px; cursor: pointer; font-family: inherit;
}
#cota-modal .btn-modal:hover { background: #1a4a7a; }
#cota-modal .btn-ok {
  background: #00b4d8; color: #1a1a2e; border-color: #00b4d8; font-weight: 600;
}
#cota-modal .btn-ok:hover { background: #0096c7; border-color: #0096c7; }

.hidden { display: none !important; }

/* ============== Linha-guia de alinhamento (no SVG) ============== */
.align-guide {
  stroke: #FFC107; stroke-width: 1; stroke-dasharray: 4 3;
  opacity: 0.6;
}
.align-marker {
  fill: #FFC107;
}

/* ============== Botões undo/redo no header ============== */
#header-acoes { display: flex; gap: 4px; }
.btn-header {
  background: #0f3460; color: #d0d8f0;
  border: 1px solid #1a4a7a; border-radius: 4px;
  padding: 4px 10px; font-size: 14px; cursor: pointer;
  font-family: inherit; min-width: 32px; line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.btn-header:hover:not(:disabled) { background: #1a4a7a; color: #fff; }
.btn-header:disabled { color: #4a5580; cursor: not-allowed; opacity: 0.5; }
.btn-header.ativo { background: #00b4d8; color: #1a1a2e; border-color: #00b4d8; }

/* ============== Modal de edição de localização de corner ============== */
#corner-modal {
  position: absolute;
  background: #16213e;
  border: 1px solid #00b4d8;
  border-radius: 6px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  z-index: 200;
  min-width: 300px;
}
#corner-modal .modal-titulo {
  font-size: 11px; color: #00b4d8; letter-spacing: 0.05em;
  margin-bottom: 10px; text-transform: uppercase;
}
#corner-modal .modal-input-row {
  display: flex; gap: 6px; align-items: stretch; margin-bottom: 10px;
}
#corner-input-x, #corner-input-y {
  background: #0f3460; color: #e0e0e0;
  border: 1px solid #1a4a7a; border-radius: 4px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
#corner-input-x:focus, #corner-input-y:focus { outline: 1px solid #00b4d8; }
#corner-modal .unit-toggle { display: flex; }
#corner-modal .unit-btn {
  background: #0f3460; color: #6b7db3;
  border: 1px solid #1a4a7a;
  padding: 6px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
#corner-modal .unit-btn:first-child { border-radius: 4px 0 0 4px; border-right: 0; }
#corner-modal .unit-btn:last-child  { border-radius: 0 4px 4px 0; }
#corner-modal .unit-btn.ativo { background: #00b4d8; color: #1a1a2e; border-color: #00b4d8; }
#corner-modal .modal-botoes { display: flex; gap: 6px; justify-content: flex-end; }
#corner-modal .btn-modal {
  background: #0f3460; color: #d0d8f0;
  border: 1px solid #1a4a7a; border-radius: 4px;
  padding: 7px 14px; font-size: 12px; cursor: pointer; font-family: inherit;
}
#corner-modal .btn-modal:hover { background: #1a4a7a; }
#corner-modal .btn-ok {
  background: #00b4d8; color: #1a1a2e; border-color: #00b4d8; font-weight: 600;
}
#corner-modal .btn-ok:hover { background: #0096c7; border-color: #0096c7; }

/* ============== Imagem de fundo — handles e marcadores ============== */
.bg-handle { fill: #FFC107; stroke: #1a1a2e; stroke-width: 1.5; cursor: nwse-resize; }
.bg-handle.alt { cursor: nesw-resize; }
.cal-marker { fill: #FFFF00; stroke: #FF00FF; stroke-width: 1.5; }
.cal-line { stroke: #00b4d8; stroke-width: 2; stroke-dasharray: 5 3; }

/* Modo calibrate_image — cursor magenta + ponto amarelo */
#editor-svg.mode-calibrate_image,
#editor-svg.mode-calibrate_image * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25'><circle cx='12.5' cy='12.5' r='10' fill='none' stroke='%23FF00FF' stroke-width='1'/><circle cx='12.5' cy='12.5' r='1.5' fill='%23FFFF00'/></svg>") 12 12, crosshair !important;
}

/* Modal de calibração da imagem */
#bg-cal-modal {
  position: absolute;
  left: 50%; top: 30%; transform: translateX(-50%);
  background: #16213e;
  border: 1px solid #00b4d8;
  border-radius: 6px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  z-index: 200;
  min-width: 320px;
}
#bg-cal-modal .modal-titulo {
  font-size: 11px; color: #00b4d8; letter-spacing: 0.05em;
  margin-bottom: 10px; text-transform: uppercase;
}
#bg-cal-modal .modal-input-row {
  display: flex; gap: 6px; align-items: stretch; margin-bottom: 10px;
}
#bg-cal-input {
  flex: 1; background: #0f3460; color: #e0e0e0;
  border: 1px solid #1a4a7a; border-radius: 4px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
#bg-cal-input:focus { outline: 1px solid #00b4d8; }
#bg-cal-modal .modal-botoes { display: flex; gap: 6px; justify-content: flex-end; }
#bg-cal-modal .unit-toggle { display: flex; }
#bg-cal-modal .unit-btn {
  background: #0f3460; color: #6b7db3;
  border: 1px solid #1a4a7a;
  padding: 6px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
#bg-cal-modal .unit-btn:first-child { border-radius: 4px 0 0 4px; border-right: 0; }
#bg-cal-modal .unit-btn:last-child  { border-radius: 0 4px 4px 0; }
#bg-cal-modal .unit-btn.ativo { background: #00b4d8; color: #1a1a2e; border-color: #00b4d8; }
#bg-cal-modal .btn-modal {
  background: #0f3460; color: #d0d8f0;
  border: 1px solid #1a4a7a; border-radius: 4px;
  padding: 7px 14px; font-size: 12px; cursor: pointer; font-family: inherit;
}
#bg-cal-modal .btn-modal:hover { background: #1a4a7a; }
#bg-cal-modal .btn-ok { background: #00b4d8; color: #1a1a2e; border-color: #00b4d8; font-weight: 600; }
#bg-cal-modal .btn-ok:hover { background: #0096c7; border-color: #0096c7; }
#bg-cal-modal .btn-cancelar:hover { background: #3d1a1a; border-color: #c0392b; color: #e0e0e0; }

/* T-snap marker (inline styles já aplicam; classes opcionais para override) */
.wall-snap-marker { fill: #FF9800; stroke: #1a1a2e; stroke-width: 2; }
.wall-snap-cross  { stroke: #1a1a2e; stroke-width: 2; }
