:root {
  --bg-primary: #0b0f19;
  --bg-surface: rgba(18, 24, 38, 0.82);
  --bg-surface-hover: rgba(30, 41, 59, 0.92);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(56, 189, 248, 0.55);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-accent: #38bdf8;
  --accent-gold: #c5a059;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-float: 0 16px 36px -8px rgba(0, 0, 0, 0.45), 0 0 1px 1px rgba(255, 255, 255, 0.08);
  --blur-glass: blur(18px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 3D WebGL Canvas Container */
#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

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

/* Top Navigation Bar */
.top-nav {
  position: absolute;
  top: 18px;
  left: 20px;
  right: 20px;
  height: 60px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}

.brand-block {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.nav-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.28);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-tab.active {
  background: var(--text-accent);
  color: #0b0f19;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Floating Atmosphere Switcher (Left Side) */
.atmosphere-palette {
  position: absolute;
  top: 96px;
  left: 20px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-float);
  z-index: 10;
  max-width: 250px;
}

.palette-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.atm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.atm-button {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.atm-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.atm-button.active {
  border-color: var(--text-accent);
  background: rgba(56, 189, 248, 0.12);
}

.color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.atm-text strong {
  display: block;
  font-size: 12px;
  color: #ffffff;
}

.atm-text small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 175px;
}

/* Floating Room Pill Navigation Bar (Bottom) */
.bottom-nav {
  position: absolute;
  bottom: 24px;
  left: 20px;
  right: 220px; /* Leave room for mini-map */
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.room-bar-container {
  pointer-events: auto;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-info-pill {
  display: flex;
  flex-direction: column;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 130px;
}

.room-info-pill .eyebrow {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.room-info-pill strong {
  font-size: 14px;
  color: #ffffff;
}

.room-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}

.room-pills::-webkit-scrollbar {
  display: none;
}

.room-pill {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.room-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.room-pill.active {
  background: #ffffff;
  color: #0b0f19;
  font-weight: 600;
  border-color: #ffffff;
}

.btn-photoreal-trigger {
  pointer-events: auto;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #0b0f19;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn-photoreal-trigger:hover {
  transform: translateY(-2px);
}

/* Mini-Map (Bottom Right) */
.minimap-container {
  position: absolute;
  bottom: 24px;
  right: 20px;
  width: 180px;
  height: 160px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  z-index: 10;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.minimap-header {
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#minimap-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Contractor Vision Drawer */
.contractor-drawer {
  position: absolute;
  top: 96px;
  right: -420px;
  width: 380px;
  bottom: 24px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  z-index: 20;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.contractor-drawer.open {
  right: 20px;
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contractor-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-header strong {
  font-size: 13px;
  color: #ffffff;
}

.badge {
  background: rgba(56, 189, 248, 0.16);
  color: var(--text-accent);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.contractor-card p {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

.dim-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.dim-row span {
  color: var(--text-muted);
}

.dim-row strong {
  color: #ffffff;
}

.aisle-switcher {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.aisle-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.aisle-btn.active {
  background: var(--text-accent);
  color: #0b0f19;
  font-weight: 600;
  border-color: var(--text-accent);
}

/* Photoreal Fullscreen Modal */
.photoreal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 50;
  display: none;
  flex-direction: column;
}

.photoreal-overlay.visible {
  display: flex;
}

.photoreal-header {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.photoreal-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.photoreal-meta h2 {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.photoreal-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  color: #ffffff;
}

.btn-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.photoreal-viewer-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

#photoreal-img {
  max-width: 90%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75);
  transition: transform 0.15s ease-out;
}

.photoreal-footer {
  padding: 12px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.photoreal-footer p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Walk Controls Help Pill */
.controls-hint {
  position: absolute;
  top: 96px;
  right: 20px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-float);
  z-index: 10;
}

.kbd {
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: #ffffff;
  font-size: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .top-nav {
    left: 10px;
    right: 10px;
    height: 52px;
    padding: 0 12px;
  }
  .brand-subtitle {
    display: none;
  }
  .atmosphere-palette {
    top: 74px;
    left: 10px;
    max-width: 180px;
    padding: 10px;
  }
  .bottom-nav {
    left: 10px;
    right: 10px;
    bottom: 12px;
  }
  .minimap-container {
    display: none;
  }
  .controls-hint {
    display: none;
  }
}
