/* ============================================
   DEVCON DATA CENTER SAN JOSE - STYLES
   ============================================ */

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

body {
  overflow: hidden;
  background: #0a0a14;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  color: #e0e0e0;
  -webkit-tap-highlight-color: transparent;
}

#canvas-container {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* CSS2D label renderer overlay */
#canvas-container > div {
  position: absolute !important;
  top: 0; left: 0;
  pointer-events: none;
}

/* ---- UI Overlay ---- */

#ui-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

#ui-overlay > * {
  pointer-events: auto;
}

/* ---- Top bar ---- */

#top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 10px 16px;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

#top-bar h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #e8e8f0;
}

#top-bar .subtitle {
  font-weight: 400;
  color: #888;
  font-size: 12px;
}

/* ---- View controls ---- */

#view-controls {
  position: absolute;
  top: 52px; right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#view-controls button {
  width: 56px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(20, 20, 35, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ccc;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

#view-controls button:hover,
#view-controls button:active {
  background: rgba(60, 80, 120, 0.8);
  color: #fff;
}

.btn-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 2px 4px;
}

/* ---- Layer panel ---- */

#layer-panel {
  position: absolute;
  top: 52px; left: 12px;
  background: rgba(15, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  max-width: 170px;
}

.panel-header {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #aaa;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.caret {
  font-size: 8px;
  transition: transform 0.2s;
}

.panel-header.collapsed .caret {
  transform: rotate(-90deg);
}

#layer-list {
  padding: 2px 10px 10px;
}

#layer-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  min-height: 32px; /* touch-friendly */
}

#layer-list input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #5588cc;
  cursor: pointer;
}

/* ---- Legend ---- */

#legend {
  position: absolute;
  bottom: 16px; right: 12px;
  background: rgba(15, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  max-width: 170px;
}

#legend-list {
  padding: 2px 10px 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 2px;
  font-size: 11px;
  color: #bbb;
}

.swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

/* ---- Info panel ---- */

#info-panel {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 28, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(80, 140, 220, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 200px;
  max-width: 300px;
  display: none;
  text-align: center;
}

#info-close {
  position: absolute;
  top: 6px; right: 10px;
  font-size: 18px;
  cursor: pointer;
  color: #888;
  line-height: 1;
}

#info-close:hover { color: #fff; }

#info-content h3 {
  font-size: 14px;
  font-weight: 600;
  color: #88bbee;
  margin-bottom: 6px;
}

#info-content p {
  font-size: 11px;
  color: #aaa;
  line-height: 1.5;
}

/* ---- 3D scene labels (CSS2DObject) ---- */

.scene-label {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #ddd;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.scene-label.zone-label {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255,255,255,0.15);
}

.scene-label.zone-label.cooling { border-color: rgba(42, 138, 58, 0.5); color: #6dda6d; }
.scene-label.zone-label.power   { border-color: rgba(196, 120, 42, 0.5); color: #e8a84a; }
.scene-label.zone-label.network { border-color: rgba(122, 58, 154, 0.5); color: #b888dd; }
.scene-label.zone-label.hot     { color: #ff8866; }
.scene-label.zone-label.cold    { color: #66aaff; }

/* ---- Responsive / mobile ---- */

@media (max-width: 480px) {
  #top-bar { padding: 8px 12px; }
  #top-bar h1 { font-size: 13px; }

  #view-controls {
    top: 48px; right: 8px;
  }
  #view-controls button {
    width: 48px; height: 36px;
    font-size: 11px;
  }

  #layer-panel {
    top: 48px; left: 8px;
    max-width: 155px;
  }

  #legend {
    bottom: 10px; right: 8px;
    max-width: 150px;
  }

  #info-panel {
    bottom: 10px;
    min-width: 180px;
    max-width: 260px;
  }
}

@media (max-height: 500px) {
  /* Landscape phone — collapse panels */
  #layer-list, #legend-list { display: none; }
  .panel-header .caret { transform: rotate(-90deg); }
}
