/* Advanced Data Center Designer - Modern Redesign */

/* CSS Variables - Vensysco Cloud Theme */
:root {
  /* Primary Colors - Your Brand Colors */
  --primary-color: #d83f1e;
  --secondary-color: #b8321a;
  --accent-color: #ff5722;
  --primary-50: #fef2f2;
  --primary-100: #fee2e2;
  --primary-500: #d83f1e;
  --primary-600: #b8321a;
  --primary-700: #991b02;
  --primary-900: #7f1d1d;
  /* 3D scene tuning */
  --scene-v-origin: 50%; /* controls vertical vanishing point; higher pushes content down */
  
  /* Neutral Colors */
  --dark-color: #2d1b0f;
  --gray-color: #6b4226;
  --light-gray: #f5f1ee;
  --lighter-gray: #faf7f4;
  --white: #ffffff;
  --gray-50: #faf7f4;
  --gray-100: #f5f1ee;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #6b4226;
  --gray-600: #475569;
  --gray-700: #2d1b0f;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Semantic Colors */
  --success-500: #10b981;
  --warning-500: #f59e0b;
  --error-500: #ef4444;
  --info-500: #3b82f6;
  
  /* Gradients - Using Your Brand Colors */
  --gradient-primary: linear-gradient(135deg, #d83f1e 0%, #ff5722 100%);
  --gradient-dark: linear-gradient(135deg, var(--dark-color) 0%, var(--gray-color) 100%);
  --gradient-surface: linear-gradient(145deg, #ffffff 0%, #faf7f4 100%);
  
  /* Shadows - Brand Color Based */
  --shadow: 0 4px 6px -1px rgba(216, 63, 30, 0.2), 0 2px 4px -1px rgba(216, 63, 30, 0.1);
  --shadow-sm: 0 1px 3px 0 rgba(216, 63, 30, 0.15), 0 1px 2px 0 rgba(216, 63, 30, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(216, 63, 30, 0.1), 0 2px 4px -1px rgba(216, 63, 30, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(216, 63, 30, 0.1), 0 4px 6px -2px rgba(216, 63, 30, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(216, 63, 30, 0.1), 0 10px 10px -5px rgba(216, 63, 30, 0.04);
  
  /* Typography */
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-primary: 'Poppins', sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  
  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.25s ease-out;
  --transition-slow: 0.35s ease-out;
  
  /* Z-index Stack */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1040;
  --z-popover: 1050;
  --z-tooltip: 1060;
}

/* Currency Toggle Styles */
.currency-toggle-container {
  margin-right: var(--space-4);
  display: flex;
  align-items: center;
}

.currency-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.currency-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.currency-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-500);
  padding: 0 var(--space-2);
}

.currency-slider {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  background-color: var(--gray-300);
  border-radius: 10px;
  transition: var(--transition-normal);
}

.currency-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: var(--white);
  border-radius: 50%;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.currency-toggle input:checked + .currency-slider {
  background-color: var(--primary-500);
}

.currency-toggle input:checked + .currency-slider:before {
  transform: translateX(20px);
}

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

.hidden { display: none !important; }

html {
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  font-weight: 400;
  line-height: 1.6;
  color: var(--dark-color);
  background: var(--lighter-gray);
  overflow-x: hidden;
}

/* Loading Screen - Vensysco Brand Style */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
}

.loading-logo i {
  font-size: 2rem;
  color: var(--primary-color);
  animation: pulse 2s infinite;
}

.loading-progress {
  width: 240px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 auto var(--space-4);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  width: 0%;
  animation: loadingProgress 2s ease-out forwards;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}


@keyframes loadingProgress {
  to { width: 100%; }
}

@keyframes pulse {
  0%, 100% { 
    transform: scale(1); 
    opacity: 1; 
  }
  50% { 
    transform: scale(1.1); 
    opacity: 0.8; 
  }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-text {
  font-size: 0.875rem;
  opacity: 0.8;
  margin-top: var(--space-4);
}

/* App Layout */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease-out;
}

.app.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* Header */
.app-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-sticky);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  max-width: 1920px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gray-900);
}

.logo i {
  color: var(--primary-600);
  font-size: 1.5rem;
}

.project-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.project-name-input {
  background: transparent;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  color: var(--gray-700);
  min-width: 200px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.project-name-input:focus {
  outline: none;
  background: var(--gray-50);
  box-shadow: 0 0 0 2px var(--primary-500);
}

.project-status {
  background: var(--warning-500);
  color: white;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--gray-500);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-toggle {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}

.btn-toggle.active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: white;
}

/* Main Content */
.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Configuration Panel */
.config-panel {
  width: 360px;
  background: white;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-200);
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
}

.panel-controls {
  display: flex;
  gap: var(--space-2);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.config-section {
  margin-bottom: var(--space-8);
}

.config-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--space-4);
}

/* Type Selector */
.type-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.type-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.type-option:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.type-option.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

.type-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  color: var(--gray-600);
  font-size: 1.25rem;
}

.type-option.active .type-icon {
  background: var(--primary-600);
  color: white;
}

.type-info h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--space-1);
}

.type-info p {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.4;
}

/* Form Controls */
.input-group {
  margin-bottom: var(--space-6);
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-3);
}

/* Text inputs with units */
.input-with-unit {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.text-input {
  flex: 1;
  height: 38px;
  padding: 0 var(--space-3);
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--gray-900);
  transition: var(--transition-fast);
}

.text-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(216, 63, 30, 0.15);
}

.input-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  text-align: center;
}

.input-unit span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
}

.input-unit small {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Sliders (kept for other parts of the UI) */
.slider-container {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--gray-200);
  border-radius: var(--radius-lg);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-600);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 8px rgba(14, 165, 233, 0.1);
}

.slider-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  text-align: center;
}

.slider-value span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
}

.slider-value small {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.mini-slider {
  width: 60px;
  height: 4px;
}

.select {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: white;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition-fast);
}

.select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--gray-700);
}

.checkbox-item input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
  background: var(--primary-600);
  border-color: var(--primary-600);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Visualization Area */
.visualization-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viz-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: white;
  border-bottom: 1px solid var(--gray-200);
}

.view-switcher {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: var(--space-1);
}

.view-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition-fast);
}

.view-btn.active {
  background: white;
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.zoom-level {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  min-width: 40px;
  text-align: center;
}

/* Visualization Container */
.viz-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: none;
  min-height: 0; /* allow child to fill flex height */
}

.viz-container.active {
  display: block;
}

/* 3D Visualization */
.datacenter-3d-advanced {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 50%, #0d1117 100%);
  position: relative;
  overflow: hidden;
}

.environment-controls {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  z-index: 10;
}

.control-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.control-group label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  min-width: 50px;
}

.scene-3d {
  width: 100%;
  height: 100%;
  position: relative;
  perspective: 1200px;
  perspective-origin: 50% var(--scene-v-origin);
  transform-style: preserve-3d;
}

.datacenter-floor {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) rotateX(90deg);
  width: 800px;
  height: 600px;
  background: 
    radial-gradient(circle at center, rgba(14, 165, 233, 0.1) 0%, transparent 50%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.datacenter-ceiling {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) rotateX(90deg) translateZ(300px);
  width: 800px;
  height: 600px;
  background: linear-gradient(45deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
  opacity: 0.3;
}

.environment-effects {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(14, 165, 233, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 60%);
}

/* Network Components */
.network-switch {
  z-index: 10;
  transition: all 0.3s ease;
}

.network-switch:hover {
  transform: translate3d(var(--x), -25px, var(--z)) scale(1.1) !important;
  box-shadow: 0 4px 12px rgba(var(--primary-color), 0.4) !important;
}

.switch-led {
  animation: ledBlink 2s infinite;
}

@keyframes ledBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.fiber-connection {
  z-index: 5;
  animation: dataFlow 3s infinite linear;
}

@keyframes dataFlow {
  0% { 
    background-position: 0% 50%; 
    opacity: 0.3;
  }
  50% { 
    opacity: 0.8; 
  }
  100% { 
    background-position: 100% 50%; 
    opacity: 0.3;
  }
}

#network-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform-style: preserve-3d;
}

/* Floor Plan View */
.floorplan-advanced {
  width: 100%;
  height: 100%;
  background: #f8fafc; /* Lighter background for better contrast */
  position: relative;
  overflow: hidden; /* Prevent scrollbars during animation */
}

.floorplan-controls {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--gray-200);
  border-radius: 50px; /* Pill shape */
  box-shadow: var(--shadow-lg);
  z-index: 10;
  width: auto;
  min-width: 600px;
}

.floorplan-controls .redundancy-label {
  margin-left: 12px;
  color: var(--gray-700);
  font-weight: 500;
  font-size: 0.9rem;
}

.floorplan-controls .controls-left { display:flex; align-items:center; gap:12px; }
.floorplan-controls .controls-right { display:flex; align-items:center; gap:20px; }

.layer-toggle { 
  font-size: 0.85rem; 
  color: var(--gray-600); 
  display:flex; 
  align-items:center; 
  gap:8px; 
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s;
}
.layer-toggle:hover { color: var(--gray-900); }

/* Redundancy Button Styling */
#toggle-redundancy-map {
  background: white;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

#toggle-redundancy-map:hover {
  border-color: var(--primary-500);
  color: var(--primary-500);
  background: var(--primary-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

#toggle-redundancy-map.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-md);
}

.floorplan-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to right, rgba(226, 232, 240, 0.6) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(226, 232, 240, 0.6) 1px, transparent 1px);
  background-size: 40px 40px; /* Larger grid */
}

.floorplan-legend {
  position: absolute;
  bottom: 30px;
  right: 30px;
  top: auto;
  left: auto;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(4px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  color: var(--gray-700);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
}

.legend-color.rack { background: var(--primary-600); }
.legend-color.cooling { background: var(--info-500); }
.legend-color.power { background: var(--warning-500); }

/* Floor plan entities */
#floorplan-racks, #floorplan-cooling, #floorplan-power,
#floorplan-network, #floorplan-generators, #floorplan-redundancy { position: relative; }

.floorplan-rack { cursor: pointer; }
.floorplan-cooling { cursor: pointer; }
.floorplan-power { cursor: pointer; }

/* Network switches */
.floorplan-switch {
  position: absolute;
  width: 36px;
  height: 16px;
  background: var(--gray-800);
  color: #fff;
  border: 1px solid var(--gray-600);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.floorplan-switch.primary { outline: 2px solid var(--primary-600); }
.floorplan-switch.redundant { outline: 2px dashed var(--success-500); }

/* Generators */
.floorplan-generator {
  position: absolute;
  width: 46px;
  height: 24px;
  background: linear-gradient(135deg, #374151, #1f2937);
  color: #fff;
  border: 1px solid #4b5563;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.floorplan-generator i { color: var(--warning-500); }
.floorplan-generator.primary { outline: 2px solid var(--warning-500); }
.floorplan-generator.redundant { outline: 2px dashed var(--success-500); }

/* Redundancy overlay */
.redundancy-path {
  position: absolute;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--primary-600), var(--primary-600) 10px, transparent 10px, transparent 18px);
  opacity: 0.6;
  pointer-events: none;
}
.redundancy-path.redundant {
  background: repeating-linear-gradient(90deg, var(--success-500), var(--success-500) 10px, transparent 10px, transparent 18px);
}

/* Inspector panel */
.floorplan-inspector {
  position: absolute;
  right: 16px;
  top: 72px;
  width: 300px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 6;
}
.floorplan-inspector.hidden { display:none; }
.floorplan-inspector .inspector-header {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding: 10px 12px; border-bottom: 1px solid var(--gray-200);
}
.floorplan-inspector .inspector-content { padding: 12px; font-size: 12px; color: var(--gray-700); }
.floorplan-inspector .kv { display:flex; align-items:center; justify-content:space-between; margin:6px 0; }
.floorplan-inspector .kv label { color: var(--gray-500); }
.floorplan-inspector .badges { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.floorplan-inspector .badge { background: var(--gray-100); color: var(--gray-700); padding:2px 6px; border-radius: 999px; font-size:10px; }

/* DR (Disaster Recovery) Topology View */
.dr-topology-view {
  padding: var(--space-6);
  background: var(--gray-50);
  height: 100%;
  overflow: auto;
}

.dr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--gray-200);
}

.dr-header h3 {
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dr-status {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: statusPulse 2s infinite;
}

.status-dot.healthy { background: var(--success-500); }
.status-dot.warning { background: var(--warning-500); }
.status-dot.error { background: var(--error-500); }

.dr-controls {
  display: flex;
  gap: var(--space-2);
}

.dr-topology-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  align-items: center;
}

.dr-site {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
}

.dr-site:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.site-header {
  margin-bottom: var(--space-4);
}

.site-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.site-title h4 {
  margin: 0;
  color: var(--gray-700);
}

.site-status {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.site-status.active {
  background: var(--success-500);
  color: white;
}

.site-status.standby {
  background: var(--gray-400);
  color: white;
}

.site-status.failed {
  background: var(--error-500);
  color: white;
}

.site-location {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.site-visualization {
  min-height: 80px;
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin: var(--space-4) 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.dr-rack {
  transition: all var(--transition-normal);
}

.site-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.metric span:first-child {
  color: var(--gray-500);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.metric span:last-child {
  font-weight: 600;
  color: var(--gray-700);
}

.metric .healthy { color: var(--success-500); }
.metric .standby { color: var(--gray-500); }

.replication-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.flow-line {
  width: 100px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.flow-animation {
  position: absolute;
  top: 0;
  left: -20px;
  width: 20px;
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 2px;
}

.flow-info {
  text-align: center;
}

.flow-type {
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.flow-metrics {
  display: flex;
  gap: var(--space-4);
  font-size: 0.875rem;
  color: var(--gray-600);
}

.dr-statistics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--primary-50);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-600);
}

.dr-disabled-message {
  text-align: center;
  padding: var(--space-12);
  color: var(--gray-600);
}

.dr-disabled-message i {
  font-size: 4rem;
  color: var(--gray-300);
  margin-bottom: var(--space-4);
}

.dr-disabled-message h3 {
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.dr-disabled-message p {
  margin-bottom: var(--space-6);
}

/* Toggle Switch for DR */
.toggle-switch {
  position: relative;
  display: inline-block;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-label {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background-color: var(--gray-300);
  border-radius: 24px;
  cursor: pointer;
  transition: background-color var(--transition-normal);
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  transition: transform var(--transition-normal);
}

.toggle-input:checked + .toggle-label {
  background-color: var(--primary-color);
}

.toggle-input:checked + .toggle-label .toggle-slider {
  transform: translateX(20px);
}

/* Animations */
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes rackPulse {
  0%, 100% { 
    box-shadow: 0 0 0 0 rgba(216, 63, 30, 0.7);
  }
  50% { 
    box-shadow: 0 0 0 4px rgba(216, 63, 30, 0);
  }
}

@keyframes standbyPulse {
  0%, 100% { 
    opacity: 0.7;
  }
  50% { 
    opacity: 1;
  }
}

/* Notification */
.notification {
  position: fixed;
  top: 80px;
  right: var(--space-6);
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 1000;
  min-width: 300px;
  border-left: 4px solid var(--primary-color);
}

.notification.success {
  border-left-color: var(--success-500);
}

.notification.warning {
  border-left-color: var(--warning-500);
}

.notification.error {
  border-left-color: var(--error-500);
}

.notification i {
  color: var(--primary-color);
  font-size: 1.25rem;
}

.notification.success i { color: var(--success-500); }
.notification.warning i { color: var(--warning-500); }
.notification.error i { color: var(--error-500); }

/* Analytics Dashboard */
.analytics-dashboard {
  padding: var(--space-6);
  background: var(--gray-50);
  height: 100%;
  overflow-y: auto;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
}

.metric-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  transition: var(--transition-normal);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.metric-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
}

.metric-header i {
  font-size: 1.25rem;
  color: var(--primary-600);
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.metric-value span {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.metric-value small {
  font-size: 1rem;
  color: var(--gray-500);
}

.metric-chart {
  height: 80px;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

/* Optimization card */
.opt-stats { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: var(--space-2); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opt-row label { color: var(--gray-600); font-size: 0.9rem; }
.opt-row div { font-weight: 600; color: var(--gray-800); }
.muted { color: var(--gray-500); font-size: 0.8rem; }

/* Rack Heatmap */
.heatmap { display: grid; gap: 4px; grid-template-columns: repeat(4, 1fr); aspect-ratio: 4 / 3; background: var(--gray-50); padding: 6px; border-radius: var(--radius-md); }
.heatmap .cell { border-radius: 4px; height: 100%; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.heatmap .cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.heatmap-legend { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.heatmap-legend .legend-bar { flex: 1; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444); position: relative; }
.heatmap-legend .legend-bar i { position: absolute; width: 2px; height: 12px; background: #111827; left: 50%; top: -2px; opacity: 0.25; }

/* Power Bars */
.power-bars { display: flex; flex-direction: column; gap: 10px; }
.power-bars .bar { display: flex; align-items: center; gap: 10px; }
.power-bars .bar label { min-width: 90px; color: var(--gray-600); }
.bar-fill { position: relative; flex: 1; height: 12px; border-radius: 999px; background: var(--gray-200); overflow: hidden; }
.bar-fill.actual { background: linear-gradient(90deg, #22c55e, #10b981); }
.bar-fill.provisioned { background: linear-gradient(90deg, #ef4444, #f59e0b); }
.bar-fill span { position: absolute; right: 8px; top: -22px; font-size: 0.8rem; color: var(--gray-700); }

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  background: var(--gray-900);
  color: white;
  font-size: 0.875rem;
}

.status-left,
.status-right {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.status-item i {
  color: var(--primary-400);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .config-panel {
    width: 320px;
  }
  
  .analytics-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: var(--space-3) var(--space-4);
  }
  
  .project-info {
    display: none;
  }
  
  .config-panel {
    position: absolute;
    top: 0;
    left: -360px;
    height: 100%;
    z-index: var(--z-modal);
    transition: left var(--transition-normal);
  }
  
  .config-panel.open {
    left: 0;
  }
  
  .status-left,
  .status-right {
    gap: var(--space-4);
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

.slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.bounce-in {
  animation: bounceIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

/* WebGL 3D Scene Enhancements */
#webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  border-radius: 12px;
}

#webgl-canvas:active {
  cursor: grabbing;
}

.scene-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

.scene-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.7);
  padding: 15px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: auto;
  min-width: 200px;
}

.scene-controls h4 {
  margin: 0 0 10px 0;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.control-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0;
  gap: 10px;
}

.control-item label {
  color: #ccc;
  font-size: 12px;
  min-width: 80px;
}

.control-item input[type="range"] {
  flex: 1;
  min-width: 100px;
  accent-color: var(--primary-color);
}

.control-item button {
  background: var(--primary-color);
  border: none;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.control-item button:hover {
  background: var(--primary-dark);
}

.control-item span {
  color: var(--accent-color);
  font-size: 11px;
  min-width: 40px;
  text-align: right;
}

.scene-info {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0,0,0,0.7);
  padding: 15px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: auto;
  color: #fff;
  font-size: 12px;
  min-width: 180px;
}

.scene-info div {
  margin: 4px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scene-info strong {
  color: var(--accent-color);
}

/* Enhanced 3D Scene Container for WebGL */
.scene-3d {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 
    0 10px 30px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 0 20px rgba(216, 63, 30, 0.1);
}

/* ===== Responsive tweaks for short viewports ===== */
@media (max-height: 900px) {
  :root { --scene-v-origin: 58%; }
  .viz-toolbar { padding: var(--space-3) var(--space-4); }
}

@media (max-height: 750px) {
  :root { --scene-v-origin: 60%; }
  .viz-toolbar { padding: var(--space-2) var(--space-3); }
}

@media (max-height: 650px) {
  :root { --scene-v-origin: 62%; }
  .viz-toolbar { padding: var(--space-2) var(--space-3); }
}

/* Performance indicator */
.fps-counter {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0,0,0,0.8);
  color: #0f0;
  padding: 5px 10px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  pointer-events: none;
  z-index: 20;
}
/*needs to be tweeked further*/

/* Modal for project submission */
.dc-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.dc-modal.open {
  display: flex;
}

.dc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
}

.dc-modal-content {
  position: relative;
  max-width: 460px;
  width: 100%;
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  padding: 20px 24px 24px;
  z-index: 2001;
  font-family: var(--font-family);
}

.dc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dc-modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.dc-modal-close {
  border: none;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 16px;
}

.dc-modal-body {
  margin-top: 4px;
}

.dc-modal-description {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 16px;
}

.dc-modal-field {
  margin-bottom: 12px;
}

.dc-modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.dc-modal-field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dc-modal-field input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 1px rgba(216, 63, 30, 0.2);
}

.dc-modal-message {
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
}

.dc-modal-error {
  color: var(--error-500);
}

.dc-modal-success {
  color: var(--success-500);
}

.dc-modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* Liquid Glass Power Component - Enhanced */
.liquid-glass-wrapper {
  position: relative;
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  height: 52px;
  display: flex;
  align-items: center;
  margin-top: var(--space-2);
}

.liquid-glass-wrapper:hover, .liquid-glass-wrapper:focus-within {
  border-color: var(--primary-500);
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.02),
    0 0 0 4px rgba(216, 63, 30, 0.1);
  background: white;
  transform: translateY(-1px);
}

.liquid-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 100%;
  width: var(--fill-level, 0%);
  background: linear-gradient(90deg, 
    rgba(216, 63, 30, 0.08) 0%, 
    rgba(216, 63, 30, 0.25) 100%
  );
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 0;
  pointer-events: none;
  border-right: 2px solid rgba(216, 63, 30, 0.5);
}

/* Animated wave/shimmer effect */
.liquid-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.6) 50%, 
    transparent 100%
  );
  transform: skewX(-20deg) translateX(-150%);
  animation: liquid-shimmer 3s infinite ease-in-out;
}

@keyframes liquid-shimmer {
  0% { transform: skewX(-20deg) translateX(-150%); }
  100% { transform: skewX(-20deg) translateX(250%); }
}

.liquid-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 var(--space-4);
}

.liquid-input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  height: 100% !important;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 1.25rem !important;
  color: var(--gray-900);
  width: 100%;
  letter-spacing: -0.02em;
}

.liquid-input:focus {
  outline: none;
}

.liquid-glass-wrapper .input-unit {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  margin-left: 12px;
  transition: background 0.2s;
  min-width: 40px;
}

.liquid-glass-wrapper:hover .input-unit {
  background: rgba(0, 0, 0, 0.08);
}

.liquid-glass-wrapper .input-unit select {
  color: var(--gray-800) !important;
  font-weight: 600;
  font-size: 0.85rem;
  background: transparent !important;
  border: none;
  cursor: pointer;
  padding: 0;
  text-shadow: none;
}

.liquid-glass-wrapper .input-unit span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.liquid-glass-wrapper .input-unit small {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-left: 4px;
    font-weight: 500;
}
