/* Device Card Styles */
.device-card {
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  overflow: hidden;
  margin-bottom: 20px;
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
}

.device-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.device-card.online {
  border-left: 4px solid #28a745;
}

.device-card.warning {
  border-left: 4px solid #ffc107;
}

.device-card.offline {
  border-left: 4px solid #dc3545;
}

/* Device Header */
.device-header {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  border-bottom: none;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-name {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}

.device-actions {
  display: flex;
  gap: 8px;
}

/* Device Body */
.device-body {
  padding: 20px;
  background: #fff;
}

/* Device Visual Container */
.device-visual {
  background: linear-gradient(145deg, #f8f9fa, #e9ecef);
  border-radius: 8px;
  padding: 16px;
  border: 2px solid #dee2e6;
  position: relative;
  min-height: 120px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.device-visual:hover {
  border-color: #007bff;
  box-shadow: 0 4px 15px rgba(0,123,255,0.2);
}

/* Device Type Specific Styles */
.router-device {
  background: linear-gradient(145deg, #fff5f5, #ffe6e6);
  border-color: #e74c3c;
}

.switch-device {
  background: linear-gradient(145deg, #f0f8ff, #e6f3ff);
  border-color: #3498db;
}

.server-device {
  background: linear-gradient(145deg, #f0fff0, #e6ffe6);
  border-color: #27ae60;
}

.firewall-device {
  background: linear-gradient(145deg, #fff8e1, #ffecb3);
  border-color: #f39c12;
}

/* Device Front Panel */
.device-front-panel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Device Labels */
.device-brand-label {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.device-model-label {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #495057;
}

/* Status LEDs */
.status-leds {
  position: absolute;
  top: 20px;
  left: 8px;
  display: flex;
  gap: 4px;
  flex-direction: column;
}

.led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid #333;
  transition: all 0.3s ease;
}

.led.power.on {
  background: #28a745;
  box-shadow: 0 0 8px #28a745;
}

.led.power.off {
  background: #6c757d;
}

.led.status.on {
  background: #007bff;
  box-shadow: 0 0 8px #007bff;
}

.led.status.off {
  background: #6c757d;
}

.led.activity {
  background: #ffc107;
  box-shadow: 0 0 8px #ffc107;
}

.led.security {
  background: #dc3545;
  box-shadow: 0 0 8px #dc3545;
}

.led.hdd {
  background: #17a2b8;
  box-shadow: 0 0 8px #17a2b8;
}

.led.blinking {
  animation: blink-led 1.5s infinite;
}

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

/* Port Sections */
.port-section {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.port-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.ports-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.ports-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  max-width: 200px;
}

/* Switch Specific Ports */
.switch-ports .ports-grid {
  grid-template-columns: repeat(12, 1fr);
  gap: 1px;
}

.sfp-ports .ports-row {
  gap: 6px;
}

.sfp-ports .device-port {
  width: 12px !important;
  height: 8px !important;
  border-radius: 2px !important;
}

/* Device Port Styles */
.device-port {
  transition: all 0.2s ease;
  position: relative;
}

.device-port:hover {
  transform: scale(1.2);
  z-index: 10;
}

/* Router Specific Styles */
.router-device .port-section {
  margin-top: 12px;
}

.router-device .ports-row {
  gap: 6px;
}

/* Server Specific Styles */
.server-device .drive-bays {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin-top: 12px;
  max-width: 120px;
}

.drive-bay {
  width: 20px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid #dee2e6;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drive-bay.occupied {
  background: linear-gradient(145deg, #28a745, #20c997);
  border-color: #28a745;
}

.drive-bay.empty {
  background: #f8f9fa;
  border-color: #dee2e6;
}

.drive-led {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
}

.drive-bay.occupied .drive-led {
  animation: blink-led 2s infinite;
}

/* Connection Indicators */
.connection-indicator {
  animation: pulse-connection 2s infinite;
}

@keyframes pulse-connection {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Device Details */
.device-details {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #e9ecef;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .device-visual {
    min-height: 100px;
    padding: 12px;
  }
  
  .device-brand-label,
  .device-model-label {
    font-size: 0.6rem;
  }
  
  .status-leds {
    top: 16px;
  }
  
  .led {
    width: 5px;
    height: 5px;
  }
  
  .ports-grid {
    grid-template-columns: repeat(8, 1fr);
    max-width: 150px;
  }
  
  .drive-bays {
    grid-template-columns: repeat(2, 1fr);
    max-width: 80px;
  }
}

/* Animation for device interactions */
.device-visual.selected {
  border-color: #007bff;
  box-shadow: 0 0 20px rgba(0,123,255,0.4);
  animation: device-selected 0.5s ease;
}

@keyframes device-selected {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* Port connection animation */
.device-port.connecting {
  animation: port-connecting 1s infinite;
}

@keyframes port-connecting {
  0%, 100% { 
    box-shadow: 0 0 6px #007bff;
    border-color: #007bff;
  }
  50% { 
    box-shadow: 0 0 12px #007bff;
    border-color: #0056b3;
  }
}

/* Tooltip enhancements */
.tooltip-inner {
  background-color: #2c3e50;
  color: white;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
  max-width: 200px;
}

.tooltip.show {
  opacity: 0.95;
}

/* Modal enhancements for connection creation */
.modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom: none;
}

.modal-header .close {
  color: white;
  opacity: 0.8;
}

.modal-header .close:hover {
  opacity: 1;
}

/* Form enhancements */
.form-control:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102,126,234,0.25);
}

/* Badge enhancements */
.badge {
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
}

/* Button enhancements */
.btn-outline-primary:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
}

/* Loading states */
.device-visual.loading {
  opacity: 0.6;
  pointer-events: none;
}

.device-visual.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Success states */
.device-visual.success {
  animation: success-flash 1s ease;
}

@keyframes success-flash {
  0%, 100% { background-color: inherit; }
  50% { background-color: rgba(40, 167, 69, 0.2); }
}

/* Error states */
.device-visual.error {
  animation: error-flash 1s ease;
}

@keyframes error-flash {
  0%, 100% { background-color: inherit; }
  50% { background-color: rgba(220, 53, 69, 0.2); }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .device-visual {
    border-width: 3px;
  }
  
  .led {
    border-width: 2px;
  }
  
  .device-port {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .device-card,
  .device-visual,
  .device-port,
  .led {
    transition: none;
  }
  
  .led.blinking,
  .connection-indicator {
    animation: none;
  }
} 