/* ==========================================================================
   ARISTAS VISUAL MERCHANDISING APP - MODERN LUXURY DESIGN SYSTEM
   ========================================================================== */

:root {
  --color-primary: #181817;
  --color-accent: #C5A059;
  --color-accent-hover: #D4B26F;
  --color-terra: #D86B45;
  --color-emerald: #059669;
  --color-bg: #F9F6F0;
  --color-card-bg: #FFFFFF;
  --color-border: #E8E2D5;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 18px rgba(197, 160, 89, 0.45);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D4CDBC; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #A8A29E; }

/* Glassmorphism */
.glass-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

/* ==========================================================================
   CANVAS & STAGE STYLES
   ========================================================================== */

.canvas-viewport {
  position: relative;
  overflow: hidden;
  background-color: #ECE7DE;
  background-image: 
    radial-gradient(#D3CCC0 1.2px, transparent 1.2px),
    radial-gradient(#D3CCC0 1.2px, #ECE7DE 1.2px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  border-radius: 14px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.06);
  user-select: none;
  cursor: grab;
}

.canvas-viewport:active {
  cursor: grabbing;
}

.canvas-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1200px;
  height: 800px;
  transform-origin: 0 0;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.18);
  border-radius: 16px;
}

/* ==========================================================================
   FURNITURE SPRITES (LIMPIOS SIN FONDO BLANCO)
   ========================================================================== */

.canvas-furniture-item {
  position: absolute;
  cursor: move;
  user-select: none;
  touch-action: none;
  transform-origin: center center;
  z-index: 20;
  transition: filter 0.15s ease;
  contain: layout style;
}

.canvas-furniture-item.dragging {
  z-index: 55 !important;
  cursor: grabbing !important;
  will-change: left, top;
}

.canvas-furniture-item.dragging .furniture-sprite-img {
  filter: none !important;
  transition: none !important;
  transform: scale(1.04);
}

.furniture-sprite-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 8px;
}

.furniture-sprite-img {
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.22));
  transition: transform 0.15s ease, filter 0.15s ease;
}

.canvas-furniture-item:hover .furniture-sprite-img {
  transform: scale(1.05);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.3));
}

.canvas-furniture-item.selected .furniture-sprite-wrapper {
  outline: 2.5px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 8px;
  box-shadow: var(--shadow-glow);
  background: rgba(197, 160, 89, 0.08);
  z-index: 40 !important;
}

.canvas-furniture-item.collision-alert .furniture-sprite-wrapper {
  outline: 2.5px dashed #EF4444 !important;
  outline-offset: 3px;
  background: rgba(239, 68, 68, 0.12);
}

/* Thermal Heatmap Zones Layer */
.heatmap-zone-overlay {
  position: absolute;
  pointer-events: none;
  border-radius: 8px;
  z-index: 10;
}

.heatmap-zone-overlay.hot {
  background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0.28) 0%, rgba(249, 115, 22, 0.15) 70%, rgba(249, 115, 22, 0.02) 100%);
  border: 1.5px dashed rgba(239, 68, 68, 0.45);
}

.heatmap-zone-overlay.warm {
  background: radial-gradient(ellipse at center, rgba(234, 179, 8, 0.24) 0%, rgba(202, 138, 4, 0.12) 70%, rgba(202, 138, 4, 0.02) 100%);
  border: 1.5px dashed rgba(202, 138, 4, 0.4);
}

.heatmap-zone-overlay.cold {
  background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.22) 0%, rgba(14, 165, 233, 0.1) 70%, rgba(14, 165, 233, 0.02) 100%);
  border: 1.5px dashed rgba(59, 130, 246, 0.4);
}

.zone-badge-tag {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 9px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.88);
  padding: 1.5px 5px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Environment Zones Layer */
.environment-zone-overlay {
  position: absolute;
  border-radius: 10px;
  border: 1.5px solid;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.06);
  z-index: 12;
  transition: box-shadow 0.15s ease;
}

/* ==========================================================================
   DIRECT IN-BLUEPRINT EDITING (ZONAS TÉRMICAS & AMBIENTES)
   ========================================================================== */

.canvas-stage.editing-mode .canvas-furniture-item {
  pointer-events: none !important;
  opacity: 0.65;
  filter: grayscale(20%);
}

.heatmap-zone-overlay.editable {
  pointer-events: auto !important;
  cursor: move !important;
  border: 2px dashed #D86B45 !important;
  z-index: 50 !important;
  background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0.22) 0%, rgba(249, 115, 22, 0.12) 70%, rgba(249, 115, 22, 0.04) 100%) !important;
}

.heatmap-zone-overlay.editable:hover {
  box-shadow: 0 0 20px rgba(216, 107, 69, 0.5) !important;
}

.environment-zone-overlay.editable {
  pointer-events: auto !important;
  cursor: move !important;
  border: 2.5px dashed #C5A059 !important;
  z-index: 50 !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

.environment-zone-overlay.editable:hover {
  box-shadow: 0 0 20px rgba(197, 160, 89, 0.5) !important;
}

/* Floating Direct Action Chips Attached Directly to Zones on Canvas */
.zone-blueprint-chip, .env-blueprint-chip {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 3px 7px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.12);
  z-index: 60;
  pointer-events: auto !important;
  user-select: none;
}

.zone-blueprint-chip .chip-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  font-size: 10px;
  color: #181817;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 4px;
  background: #F3EFEA;
}

.zone-blueprint-chip .chip-id:hover {
  background: #E8E2D5;
}

.zone-blueprint-chip .chip-types {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #FAF8F5;
  padding: 1px 2px;
  border-radius: 6px;
  border: 1px solid #EAE5DC;
}

.chip-btn-type {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.1s ease;
}

.chip-btn-type.active.hot {
  background: #EF4444;
  color: white;
}

.chip-btn-type.active.warm {
  background: #F59E0B;
  color: white;
}

.chip-btn-type.active.cold {
  background: #3B82F6;
  color: white;
}

.chip-dim {
  font-family: ui-monospace, monospace;
  font-size: 8.5px;
  color: #78716C;
  background: #FAF8F5;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid #EAE5DC;
}

.chip-del {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  padding: 2px;
  line-height: 1;
  color: #9CA3AF;
  transition: color 0.15s ease, transform 0.1s ease;
}

.chip-del:hover {
  color: #DC2626;
  transform: scale(1.15);
}

/* Environment Chip */
.env-blueprint-chip .chip-title-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  max-width: 110px;
}

.env-blueprint-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.env-blueprint-chip .chip-name {
  font-weight: 800;
  font-size: 10px;
  color: #181817;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.env-blueprint-chip .chip-select {
  font-size: 9px;
  font-weight: 700;
  background: #FAF8F5;
  border: 1px solid #EAE5DC;
  border-radius: 4px;
  padding: 1px 3px;
  color: #181817;
  cursor: pointer;
}

.env-blueprint-chip .chip-color-picker {
  width: 16px;
  height: 16px;
  border: none;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
}

/* Resize Handles */
.zone-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #FFFFFF;
  border: 3px solid #181817;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 60;
  pointer-events: auto !important;
  transition: transform 0.1s ease, background 0.1s ease;
}

.zone-resize-handle:hover {
  transform: scale(1.3);
  background: #C5A059;
  border-color: #181817;
}

.zone-resize-handle.nw { top: -7px; left: -7px; cursor: nwse-resize; }
.zone-resize-handle.ne { top: -7px; right: -7px; cursor: nesw-resize; }
.zone-resize-handle.se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.zone-resize-handle.sw { bottom: -7px; left: -7px; cursor: nesw-resize; }

/* Sidebars Collapsed State */
.sidebar-panel {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-panel.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Symmetrical Sidebar Edge Restore Tabs (Vertically Centered) */
.sidebar-edge-tab {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 45;
  width: 22px;
  height: 52px;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  color: #181817;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.sidebar-edge-tab:hover {
  background: #181817;
  color: #FFFFFF;
  border-color: #181817;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.sidebar-edge-tab.left {
  left: 0;
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.sidebar-edge-tab.right {
  right: 0;
  border-right: none;
  border-radius: 8px 0 0 8px;
}

/* Canvas Viewport Edit Banner (HUD Flotante de Lujo) */
.canvas-edit-banner {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid #E8E2D5;
  box-shadow: 0 12px 30px -6px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.04);
  pointer-events: auto;
  animation: bannerSlideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bannerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.canvas-edit-banner.heatmaps {
  border-color: rgba(216, 107, 69, 0.5);
  box-shadow: 0 10px 25px -5px rgba(216, 107, 69, 0.15), 0 4px 10px rgba(0, 0, 0, 0.04);
}

.canvas-edit-banner.environments {
  border-color: rgba(197, 160, 89, 0.6);
  box-shadow: 0 10px 25px -5px rgba(197, 160, 89, 0.18), 0 4px 10px rgba(0, 0, 0, 0.04);
}

.banner-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.banner-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.banner-title-icon.heatmaps {
  background: rgba(216, 107, 69, 0.14);
  color: #D86B45;
}

.banner-title-icon.environments {
  background: rgba(197, 160, 89, 0.2);
  color: #96742B;
}

.banner-title-text {
  font-size: 12.5px;
  font-weight: 800;
  color: #181817;
  line-height: 1.2;
}

.banner-subtitle {
  font-size: 10px;
  color: #78716C;
  font-weight: 500;
  margin-top: 1px;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.banner-btn:active {
  transform: scale(0.96);
}

.banner-btn.add-heat {
  background: #D86B45;
  color: #FFFFFF;
}

.banner-btn.add-heat:hover {
  background: #C45731;
  box-shadow: 0 4px 12px rgba(216, 107, 69, 0.35);
}

.banner-btn.add-env {
  background: #C5A059;
  color: #FFFFFF;
}

.banner-btn.add-env:hover {
  background: #B38E46;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.4);
}

.banner-btn.finish {
  background: #181817;
  color: #FFFFFF;
}

.banner-btn.finish:hover {
  background: #2D2C29;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Floating Canvas Controls */
.canvas-floating-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  padding: 4px 8px;
  border-radius: 9999px;
  box-shadow: var(--shadow-lg);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Toolbar Segmented Controls and Pills */
.toolbar-seg-pill {
  display: inline-flex;
  align-items: center;
  background: #F3EFEA;
  padding: 2px;
  border-radius: 9px;
  border: 1px solid #E8E2D5;
  gap: 2px;
}

.toolbar-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3.5px 8px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
  color: #78716C;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.toolbar-seg-btn:hover {
  color: #181817;
}

.toolbar-seg-btn.active-heat {
  background: #FFFFFF;
  color: #D86B45;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 800;
}

.toolbar-seg-btn.active-env {
  background: #FFFFFF;
  color: #96742B;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 800;
}

.toolbar-seg-btn.active-grid {
  background: #FFFFFF;
  color: #1E3A8A;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 800;
}

.toolbar-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.toolbar-action-pill.heat {
  background: #FFFFFF;
  border: 1px solid rgba(216, 107, 69, 0.35);
  color: #D86B45;
}

.toolbar-action-pill.heat:hover {
  background: rgba(216, 107, 69, 0.08);
}

.toolbar-action-pill.heat.active {
  background: #D86B45 !important;
  color: #FFFFFF !important;
  border-color: #D86B45 !important;
  box-shadow: 0 2px 8px rgba(216, 107, 69, 0.35) !important;
}

.toolbar-action-pill.env {
  background: #FFFFFF;
  border: 1px solid rgba(197, 160, 89, 0.45);
  color: #96742B;
}

.toolbar-action-pill.env:hover {
  background: rgba(197, 160, 89, 0.1);
}

.toolbar-action-pill.env.active {
  background: #C5A059 !important;
  color: #FFFFFF !important;
  border-color: #C5A059 !important;
  box-shadow: 0 2px 8px rgba(197, 160, 89, 0.4) !important;
}

/* ==========================================================================
   FLOATING PRODUCT DRAWER BUBBLE
   ========================================================================== */

.product-drawer-bubble {
  transform-origin: top right;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s ease;
  box-shadow: 0 25px 60px -15px rgba(24, 24, 23, 0.22),
              0 0 0 1px rgba(232, 226, 213, 0.85);
}

.product-drawer-bubble.open {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.product-drawer-bubble.is-dragging {
  transition: none !important;
  user-select: none !important;
  box-shadow: 0 30px 70px -10px rgba(24, 24, 23, 0.35),
              0 0 0 2px rgba(197, 160, 89, 0.6) !important;
  cursor: grabbing !important;
}

/* ==========================================================================
   DIRECT ON-CANVAS SCALE HANDLES (ESQUINAS INTERACTIVAS DE ESCALADO)
   ========================================================================== */

.selection-corner {
  width: 14px !important;
  height: 14px !important;
  background-color: #D86B45 !important;
  border: 2.5px solid #FFFFFF !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(216, 107, 69, 0.4) !important;
  pointer-events: auto !important;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  z-index: 50 !important;
  user-select: none;
  touch-action: none;
}

.selection-corner:hover {
  transform: scale(1.4) !important;
  background-color: #B94F2D !important;
  box-shadow: 0 3px 12px rgba(216, 107, 69, 0.5), 0 0 0 2px #FFFFFF !important;
}

.selection-corner:active {
  transform: scale(1.2) !important;
  background-color: #93381B !important;
}

.selection-corner-tl {
  cursor: nwse-resize !important;
  top: -7px !important;
  left: -7px !important;
}

.selection-corner-tr {
  cursor: nesw-resize !important;
  top: -7px !important;
  right: -7px !important;
}

.selection-corner-bl {
  cursor: nesw-resize !important;
  bottom: -7px !important;
  left: -7px !important;
}

.selection-corner-br {
  cursor: nwse-resize !important;
  bottom: -7px !important;
  right: -7px !important;
}

/* ==========================================================================
   METRIC 1M² ARCHITECTURAL GRID OVERLAY (CALIBRATED & BOUNDED)
   ========================================================================== */

.canvas-grid-layer {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  box-sizing: border-box;
  border: 1.5px solid rgba(160, 110, 45, 0.65);
  box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.25);
  background-image: 
    /* 5m Accent Major Grid Lines */
    linear-gradient(to right, rgba(140, 95, 30, 0.55) 1.5px, transparent 1.5px),
    linear-gradient(to bottom, rgba(140, 95, 30, 0.55) 1.5px, transparent 1.5px),
    /* 1m Standard Grid Lines (1m x 1m = 1.0 m²) */
    linear-gradient(to right, rgba(160, 115, 45, 0.32) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(160, 115, 45, 0.32) 1px, transparent 1px);
  background-position: 0 0;
}

.grid-scale-legend {
  position: absolute;
  bottom: 12px;
  left: 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(197, 160, 89, 0.7);
  border-radius: 8px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #3D3220;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  z-index: 10;
  user-select: none;
}

.grid-cell-sample {
  width: 12px;
  height: 12px;
  border: 1.5px solid #C5A059;
  background: rgba(197, 160, 89, 0.45);
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}



