@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

:root {
  --bg-deep: #08090d;
  --panel-bg: rgba(16, 20, 28, 0.72);
  --panel-border: rgba(255, 255, 255, 0.1);
  --panel-hover: rgba(255, 255, 255, 0.16);
  --accent-amber: #f59e0b;
  --accent-orange: #f97316;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Glassmorphism Panel Utility */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Top App Bar */
.top-nav {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 20;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #38bdf8;
  font-size: 18px;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.top-center-stats {
  display: flex;
  align-items: center;
  gap: 18px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.lang-switch {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lang-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Left Model & Atmosphere Controls Drawer */
.left-controls {
  position: absolute;
  top: 96px;
  left: 24px;
  width: 290px;
  padding: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.panel-header h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.control-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #38bdf8;
  font-weight: 700;
}

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), 0 0 6px var(--accent-amber);
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.ticks-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}

/* Toggle Switches */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.12);
  transition: .3s;
  border-radius: 34px;
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-switch {
  background-color: var(--accent-amber);
}

input:checked + .slider-switch:before {
  transform: translateX(16px);
}

/* Right Smart Room & IoT Control Panel */
.right-controls {
  position: absolute;
  top: 96px;
  right: 24px;
  width: 320px;
  padding: 22px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.right-controls::-webkit-scrollbar {
  width: 4px;
}
.right-controls::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.room-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-dropdown {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 12px;
  outline: none;
  cursor: pointer;
  width: 170px;
}

.room-dropdown option {
  background: #0f172a;
  color: #fff;
}

.room-stat-count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-amber);
}

/* Tab Switcher for Devices */
.device-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
}

.device-tab {
  flex: 1;
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.device-tab.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Presets Grid (2x2) */
.presets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preset-card {
  padding: 14px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.preset-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.preset-card.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.18);
}

.preset-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.preset-card.active .preset-indicator {
  background: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

.preset-icon {
  font-size: 20px;
}

.preset-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.preset-sub {
  font-size: 10px;
  color: var(--text-muted);
}

/* Mechanical Action Rows (Door & Drying Rack) */
.mechanical-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mech-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.mech-btn-row {
  display: flex;
  gap: 8px;
}

.mech-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mech-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.mech-btn.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* Bottom Center View / Mode Pill Switcher */
.bottom-nav {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 12px;
  padding: 8px 12px;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.mode-tab.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mode-tab.active.xray-mode {
  background: rgba(6, 182, 212, 0.25);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 25px rgba(6, 182, 212, 0.3);
}

/* 3D Label Markers (Floating over rooms) */
.room-tag-3d {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.room-tag-3d:hover {
  transform: translate(-50%, -50%) scale(1.12);
  background: var(--accent-amber);
  color: #000;
  border-color: #fff;
}

.room-tag-3d .tag-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .left-controls {
    display: none;
  }
  .right-controls {
    width: 260px;
    padding: 16px;
    right: 12px;
    top: 80px;
  }
  .top-center-stats {
    display: none;
  }
  .top-nav {
    left: 12px;
    right: 12px;
    top: 12px;
    padding: 0 14px;
  }
  .bottom-nav {
    bottom: 16px;
    width: 92%;
    justify-content: center;
  }
}
