/* ==========================================================================
   STEP 2: DISEÑO INTERNO (CANVAS + INSPECTOR)
   ========================================================================== */

/* Contenedor Principal (Layout Flexible) */
#step-2 {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.workspace-container {
  display: flex;
  flex: 1;
  /* Ocupar todo el espacio vertical disponible inteligente */
  height: 100%;
  min-height: 0;
  overflow: hidden;
  gap: 10px;
  padding: 0 4px;
  box-sizing: border-box;
}

/* --- AREA IZQUIERDA: CANVAS (VISOR CAD PREMIUM) --- */
.canvas-area {
  flex: 1;
  /* Fondo Blueprint Milimétrico Técnico */
  background-color: #f8fafc;
  background-image: 
    radial-gradient(#cbd5e1 1.2px, transparent 1.2px),
    linear-gradient(to right, rgba(226, 232, 240, 0.4) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(226, 232, 240, 0.4) 1px, transparent 1px);
  background-size: 20px 20px, 100px 100px, 100px 100px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-width: 0;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
}

#canvas-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: transparent;
  overflow: hidden;
  position: relative;
}

/* Hover interactivo de alta precisión para nodos del Canvas */
.canvas-node {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.canvas-node:hover {
  border-color: #93c5fd !important;
  background-color: rgba(239, 246, 255, 0.6) !important;
}

/* Cotas Arquitectónicas Superiores CAD */
.cad-cota-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-bottom: 2px solid #64748b;
  transition: all 0.2s ease;
  box-sizing: border-box;
  background: transparent;
  outline: none;
}

.cad-cota-item:hover {
  border-bottom-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}

.cad-cota-val {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: #1e3a8a;
  background: white;
  padding: 1px 6px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #cbd5e1;
  white-space: nowrap;
  letter-spacing: 0.3px;
  transition: all 0.15s;
}

.cad-cota-item:hover .cad-cota-val {
  border-color: #93c5fd;
  color: #2563eb;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.15);
}

.cad-cota-val.manual {
  color: #be123c !important;
  border-color: #fecaca !important;
  background: #fff5f5 !important;
}

/* Marcas de cota diagonales a 45° */
.cad-tick {
  position: absolute;
  bottom: -4px;
  width: 9px;
  height: 2px;
  background: #64748b;
  transform: rotate(-45deg);
  pointer-events: none;
}

.cad-tick.left { left: -3px; }
.cad-tick.right { right: -3px; }

/* Botones de cota interior discretos */
.cad-inner-cota {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: #1e3a8a;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  cursor: pointer;
  z-index: 15;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.15s ease;
  outline: none;
}

.cad-inner-cota:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  transform: scale(1.06);
}

.cad-inner-cota.manual {
  color: #be123c !important;
  border-color: #fecaca !important;
  background: #fff5f5 !important;
}

/* Badge flotante de dimensiones de la celda seleccionada */
.selected-dim-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #2563eb;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
  z-index: 25;
  pointer-events: none;
  letter-spacing: 0.3px;
}

/* --- AREA DERECHA: INSPECTOR DE PROPIEDADES --- */
.inspector-panel {
  width: 260px;
  min-width: 260px;
  height: 100%;
  background: white;
  border-left: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 0 10px;
  overflow-y: auto;
  overflow-x: hidden !important;
  /* BLINDAJE: Scrollbar inteligente, sin scroll horizontal */
}

/* Evitar desbordamientos de hijos por el width de la barra vertical */
.inspector-panel * {
  max-width: 100%;
}

.inspector-header {
  font-size: 13px;
  font-weight: 800;
  color: #0b2240;
  text-transform: uppercase;
  letter-spacing: 0px;
  margin-bottom: 16px;
  padding-bottom: 0px;
  border-bottom: none;
  margin-top: 10px;
}

.prop-group {
  margin-bottom: 12px;
  background: #f4f5f7;
  border-radius: 12px;
  padding: 14px 12px;
  border: 1px solid #f1f5f9;
}

.prop-label {
  font-size: 9px;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 6px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.prop-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.prop-btn {
  flex: 1;
  padding: 8px;
  font-size: 11px;
  border-radius: 6px;
  border: none;
  background: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  cursor: pointer;
  color: #1e293b;
  font-weight: 700;
  transition: all 0.2s;
}

.prop-btn:hover {
  background: #f1f5f9;
}

.prop-btn:active {
  background: #e2e8f0;
}

.prop-btn.active {
  background: #1d4ed8;
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.prop-btn.active:hover {
  background: #1e40af;
}

.prop-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 11px;
  border: none;
  border-radius: 6px;
  background: white;
  color: #1e293b;
  font-weight: 600;
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.prop-select:focus {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Tabla de Cajones */
.drawer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.drawer-table th {
  text-align: left;
  color: #64748b;
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}

.drawer-table td {
  padding: 6px 4px 6px 0;
  border-bottom: 1px solid #f1f5f9;
}

.drawer-input {
  width: 100%;
  padding: 6px;
  border: none;
  border-radius: 4px;
  text-align: center;
  font-weight: 600;
  color: #334155;
  font-size: 11px;
  background: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.drawer-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}