/* Rack Visualizer Styles */
.rack-visualizer {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 2rem;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Rack Controls */
.rack-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.view-controls, .mode-controls {
  display: flex;
  gap: 0.5rem;
}

/* Rack Container */
.rack-container {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  background: #2c3e50;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-height: 80vh;
  overflow-y: auto;
}

.rack-frame {
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  gap: 1rem;
  background: #34495e;
  border-radius: 4px;
  padding: 1rem;
  position: relative;
}

/* Rack Rails */
.rack-rails {
  display: flex;
  flex-direction: column;
  background: #7f8c8d;
  border-radius: 4px;
  padding: 0.5rem 0;
}

.rack-unit-marker {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #95a5a6;
  position: relative;
}

.rack-unit-marker::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #bdc3c7;
  top: 50%;
  transform: translateY(-50%);
}

.unit-number {
  font-size: 10px;
  font-weight: bold;
  color: #2c3e50;
  background: #ecf0f1;
  padding: 2px 4px;
  border-radius: 2px;
  z-index: 1;
}

/* Rack Devices Grid */
.rack-devices {
  display: grid;
  gap: 2px;
  background: #2c3e50;
  padding: 0.5rem;
  border-radius: 4px;
}

/* Base Device Styles */
.rack-device {
  background: linear-gradient(135deg, #ecf0f1 0%, #bdc3c7 100%);
  border: 2px solid #95a5a6;
  border-radius: 4px;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto 1fr;
  gap: 0.25rem;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
  min-height: 40px;
}

.rack-device:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.device-label {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: bold;
  color: #2c3e50;
  text-align: center;
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 4px;
  border-radius: 2px;
}

.device-model {
  grid-column: 1 / -1;
  font-size: 10px;
  color: #7f8c8d;
  text-align: center;
}

.device-ports {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.device-status {
  grid-column: 2;
  grid-row: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Device Type Specific Styles */
.rack-device.router {
  background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
  border-color: #d63031;
}

.rack-device.switch {
  background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
  border-color: #0984e3;
}

.rack-device.server {
  background: linear-gradient(135deg, #55a3ff 0%, #003d82 100%);
  border-color: #003d82;
}

.rack-device.firewall {
  background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
  border-color: #e17055;
}

.rack-device.pdu {
  background: linear-gradient(135deg, #6c5ce7 0%, #5f3dc4 100%);
  border-color: #5f3dc4;
}

/* Port Styles */
.port {
  width: 12px;
  height: 8px;
  border: 1px solid #2c3e50;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.port:hover {
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.6);
}

.port.ethernet {
  background: #27ae60;
}

.port.ethernet.mgmt {
  background: #f39c12;
}

.port.ethernet.wan {
  background: #e74c3c;
}

.port.ethernet.lan {
  background: #3498db;
}

.port.ethernet.dmz {
  background: #9b59b6;
}

.port.sfp {
  background: #1abc9c;
  width: 16px;
  height: 10px;
}

.port.console {
  background: #34495e;
  border-radius: 50%;
  width: 8px;
  height: 8px;
}

.port.power {
  background: #2c3e50;
  border-radius: 50%;
  width: 10px;
  height: 10px;
}

.port.power-input {
  background: #e74c3c;
  width: 16px;
  height: 12px;
}

.port.small {
  width: 8px;
  height: 6px;
}

/* Port Groups and Sections */
.port-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.port-label {
  font-size: 8px;
  color: #2c3e50;
  font-weight: bold;
  min-width: 40px;
}

.port-section {
  margin-bottom: 0.25rem;
}

.section-label {
  font-size: 8px;
  color: #2c3e50;
  font-weight: bold;
  display: block;
  margin-bottom: 2px;
}

.port-row {
  display: flex;
  gap: 1px;
  flex-wrap: wrap;
}

/* Server Specific Elements */
.drive-bays {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-bottom: 0.25rem;
}

.drive-bay {
  width: 12px;
  height: 8px;
  background: #34495e;
  border: 1px solid #2c3e50;
  border-radius: 1px;
  position: relative;
}

.drive-led {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
}

.drive-led.active {
  background: #27ae60;
  animation: blink 2s infinite;
}

.front-panel {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.power-button {
  width: 8px;
  height: 8px;
  background: #e74c3c;
  border-radius: 50%;
  border: 1px solid #c0392b;
}

.status-display {
  display: flex;
  gap: 2px;
}

.expansion-slots {
  display: flex;
  gap: 1px;
  margin: 0.25rem 0;
}

.pci-slot {
  width: 20px;
  height: 4px;
  background: #7f8c8d;
  border: 1px solid #95a5a6;
}

.power-supplies {
  display: flex;
  gap: 0.25rem;
}

.psu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.psu-label {
  font-size: 6px;
  color: #2c3e50;
}

/* PDU Specific Elements */
.pdu-outlets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
}

.outlet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.outlet-socket {
  width: 6px;
  height: 8px;
  background: #2c3e50;
  border-radius: 1px;
}

.outlet-number {
  font-size: 6px;
  color: #2c3e50;
}

/* Status LEDs */
.status-led {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  margin: 1px;
}

.status-led.online, .status-led.on, .status-led.active {
  background: #27ae60;
  animation: pulse 2s infinite;
}

.status-led.warning {
  background: #f39c12;
  animation: blink 1s infinite;
}

.status-led.offline {
  background: #e74c3c;
}

.status-led.power {
  background: #3498db;
}

.status-led.hdd {
  background: #e67e22;
}

.status-led.network {
  background: #27ae60;
}

/* Cooling Elements */
.cooling-vents {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  height: 20px;
}

.cooling-vents::before {
  content: '';
  grid-column: 1 / -1;
  background: repeating-linear-gradient(
    90deg,
    #7f8c8d 0px,
    #7f8c8d 2px,
    transparent 2px,
    transparent 4px
  );
}

.cooling-fans {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  height: 20px;
}

.cooling-fans::before {
  content: '❋ ❋ ❋';
  font-size: 8px;
  color: #7f8c8d;
}

/* Power Elements */
.power-inlet {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.25rem 0;
}

.network-management {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.25rem 0;
}

/* View Transitions */
.rack-device.front-view .rear-only {
  display: none;
}

.rack-device.rear-view .front-only {
  display: none;
}

/* Connection Overlay */
.connection-overlay {
  pointer-events: none;
}

.connection-line {
  transition: opacity 0.3s ease;
}

.connection-line.hidden {
  opacity: 0.1;
}

.connection-line.visible {
  opacity: 1;
}

/* Connection Mode Alert */
.connection-mode-alert {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  max-width: 400px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px currentColor; }
  50% { box-shadow: 0 0 15px currentColor; }
}

/* Port Hover Effects in Connection Mode */
.rack-device[data-connection-mode="true"] .port:hover {
  animation: glow 0.5s infinite;
  z-index: 10;
}

/* Responsive Design */
@media (max-width: 768px) {
  .rack-visualizer {
    padding: 1rem;
  }
  
  .rack-controls {
    flex-direction: column;
    gap: 1rem;
  }
  
  .rack-container {
    max-width: 100%;
    padding: 1rem;
  }
  
  .rack-frame {
    grid-template-columns: 40px 1fr 40px;
  }
  
  .device-label {
    font-size: 10px;
  }
  
  .device-model {
    font-size: 8px;
  }
  
  .port {
    width: 10px;
    height: 6px;
  }
  
  .port.sfp {
    width: 12px;
    height: 8px;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .rack-device {
    border-width: 3px;
  }
  
  .port {
    border-width: 2px;
  }
  
  .status-led {
    border: 1px solid #000;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
} 