/**
 * CSS Server Rack — Infrastructure Page Visual
 * Pure CSS/HTML animated server rack with blinking LEDs,
 * utilisation bars, and module labels.
 */

/* ---- Rack Frame ---- */
.server-rack {
  perspective: 800px;
}
.server-rack__frame {
  background: linear-gradient(180deg, #0a1628 0%, #0d1b2a 100%);
  border: 1px solid rgba(20,184,166,0.15);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(20,184,166,0.06),
    0 20px 60px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
}
.server-rack__frame::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(20,184,166,0.3), transparent);
}

/* ---- Header ---- */
.server-rack__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.server-rack__title {
  font-family: 'Space Grotesk', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.server-rack__status {
  font-family: 'Space Grotesk', monospace;
  font-size: 9px;
  font-weight: 600;
  color: #14b8a6;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.server-rack__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #14b8a6;
  animation: rack-pulse 2s ease-in-out infinite;
}

/* ---- Rack Units ---- */
.server-rack__unit {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.server-rack__unit:last-of-type {
  border-bottom: none;
}
.server-rack__face {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  position: relative;
}
.server-rack__unit--gpu .server-rack__face {
  padding: 14px 16px;
}

/* Module-specific subtle left accent */
.server-rack__unit--gpu    { border-left: 2px solid #14b8a6; }
.server-rack__unit--inference { border-left: 2px solid #8b5cf6; }
.server-rack__unit--storage { border-left: 2px solid #3b82f6; }
.server-rack__unit--network { border-left: 2px solid #f59e0b; }
.server-rack__unit--security { border-left: 2px solid #ef4444; }
.server-rack__unit--monitoring { border-left: 2px solid #06b6d4; }

/* ---- LEDs ---- */
.server-rack__leds {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
  width: 10px;
}
.led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.led--green {
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34,197,94,0.6);
}
.led--amber {
  background: #f59e0b;
  box-shadow: 0 0 4px rgba(245,158,11,0.6);
}
.led--blink-1 { animation: led-blink 1.5s ease-in-out infinite; }
.led--blink-2 { animation: led-blink 2.1s ease-in-out infinite 0.3s; }
.led--blink-3 { animation: led-blink 1.8s ease-in-out infinite 0.7s; }

/* ---- Info ---- */
.server-rack__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.server-rack__label {
  font-family: 'Space Grotesk', monospace;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 1.5px;
}
.server-rack__spec {
  font-family: 'Space Grotesk', monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.3px;
}

/* ---- GPU Utilisation Bars ---- */
.server-rack__bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 60px;
  flex-shrink: 0;
}
.server-rack__bar {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.server-rack__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #14b8a6, #22c55e);
  border-radius: 2px;
  animation: bar-shimmer 3s ease-in-out infinite;
}
.server-rack__bar:nth-child(2) .server-rack__bar-fill { animation-delay: 0.5s; }
.server-rack__bar:nth-child(3) .server-rack__bar-fill { animation-delay: 1s; }
.server-rack__bar:nth-child(4) .server-rack__bar-fill { animation-delay: 1.5s; }

/* ---- Inference Meter ---- */
.server-rack__meter {
  width: 60px;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.server-rack__meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
  border-radius: 3px;
  width: 0%;
}
.server-rack__meter-animate {
  animation: meter-sweep 2.5s ease-in-out infinite;
}

/* ---- Storage Disks ---- */
.server-rack__disks {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.server-rack__disk {
  width: 8px;
  height: 16px;
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 1px;
}
.server-rack__disk--active {
  background: rgba(59,130,246,0.4);
  animation: disk-pulse 1s ease-in-out infinite;
}

/* ---- Network Ports ---- */
.server-rack__ports {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.server-rack__port {
  width: 10px;
  height: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1px;
}
.server-rack__port--active {
  background: rgba(245,158,11,0.2);
  border-color: rgba(245,158,11,0.4);
  animation: port-blink 0.8s ease-in-out infinite;
}
.server-rack__port--active:nth-child(2) { animation-delay: 0.2s; }
.server-rack__port--active:nth-child(4) { animation-delay: 0.5s; }
.server-rack__port--active:nth-child(6) { animation-delay: 0.1s; }

/* ---- Security Shield ---- */
.server-rack__shield {
  font-family: 'Space Grotesk', monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: rgba(239,68,68,0.7);
  flex-shrink: 0;
}

/* ---- Rack Footer ---- */
.server-rack__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(255,255,255,0.06);
  font-family: 'Space Grotesk', monospace;
  font-size: 8px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.5px;
}

/* ---- Animations ---- */
@keyframes rack-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes led-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}
@keyframes bar-shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes meter-sweep {
  0% { width: 10%; }
  50% { width: 85%; }
  100% { width: 10%; }
}
@keyframes disk-pulse {
  0%, 100% { background: rgba(59,130,246,0.4); }
  50% { background: rgba(59,130,246,0.8); }
}
@keyframes port-blink {
  0%, 100% { background: rgba(245,158,11,0.2); }
  50% { background: rgba(245,158,11,0.5); }
}
