/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  min-height: 100vh;
  color: #e5e5e5;
  overflow-x: hidden;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Styles */
header {
  text-align: center;
  margin-bottom: 30px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 30px;
  border: 1px solid rgba(64, 64, 64, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);
}

h1 {
  font-size: 2.5rem;
  color: #ffffff;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
  margin-bottom: 10px;
}

.subtitle {
  color: #b3b3b3;
  font-size: 1.1rem;
}

/* Legend */
.legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 15px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 10px;
  border: 1px solid rgba(64, 64, 64, 0.2);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #cccccc;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #666666;
}

/* Main Content Grid */
.main-content {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 30px;
  flex: 1;
}

/* Panels */
.visualization-panel,
.controls-panel {
  background: linear-gradient(145deg, #0d0d0d, #1f1f1f);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(77, 77, 77, 0.2);
}

/* Graph Canvas */
.graph-canvas {
  width: 100%;
  height: 500px;
  background: linear-gradient(135deg, #141414 0%, #262626 100%);
  border-radius: 15px;
  border: 2px solid #404040;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Nodes */
.node {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2d2d2d, #1a1a1a);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  border: 3px solid #595959;
  z-index: 10;
}

.node:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.9);
  border-color: #808080;
}

.node.source {
  background: linear-gradient(145deg, #333333, #000000);
  border-color: #666666;
  color: #ffffff;
}

.node.visited {
  background: linear-gradient(145deg, #4d4d4d, #1a1a1a);
  border-color: #999999;
  color: #ffffff;
}

.node.current {
  background: linear-gradient(145deg, #666666, #000000);
  border-color: #cccccc;
  color: #ffffff;
  animation: pulse 1s infinite;
}

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

/* Edges */
.edge {
  position: absolute;
  background: linear-gradient(90deg, #595959, #404040);
  height: 3px;
  transform-origin: left center;
  transition: all 0.3s ease;
  z-index: 1;
}

.edge.highlight {
  background: linear-gradient(90deg, #808080, #666666);
  height: 5px;
  z-index: 5;
}

.edge-weight {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0d0d0d, #262626);
  border: 2px solid #666666;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #e5e5e5;
  z-index: 15;
  transition: all 0.3s ease;
}

.edge-weight.highlight {
  background: linear-gradient(145deg, #333333, #000000);
  border-color: #999999;
  color: #ffffff;
}

/* Controls */
.control-group {
  margin-bottom: 25px;
}

.control-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #cccccc;
  font-size: 14px;
}

.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

input[type="number"] {
  flex: 1;
  min-width: 60px;
  padding: 12px;
  background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
  border: 2px solid #404040;
  border-radius: 10px;
  font-size: 14px;
  color: #e5e5e5;
  transition: all 0.3s ease;
}

input[type="number"]:focus {
  outline: none;
  border-color: #666666;
  box-shadow: 0 0 0 3px rgba(102, 102, 102, 0.3);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(145deg, #333333, #000000);
  color: #ffffff;
  border: 1px solid #666666;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: linear-gradient(145deg, #4d4d4d, #1a1a1a);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
}

.btn-secondary {
  background: linear-gradient(145deg, #262626, #0d0d0d);
  color: #cccccc;
  border: 1px solid #404040;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: linear-gradient(145deg, #333333, #1a1a1a);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
}

.btn-success {
  background: linear-gradient(145deg, #404040, #1a1a1a);
  color: #ffffff;
  border: 1px solid #666666;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.btn-success:hover {
  transform: translateY(-2px);
  background: linear-gradient(145deg, #595959, #262626);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
}

.btn-danger {
  background: linear-gradient(145deg, #4d4d4d, #262626);
  color: #ffffff;
  border: 1px solid #808080;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.btn-danger:hover {
  transform: translateY(-2px);
  background: linear-gradient(145deg, #666666, #333333);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
}

/* Results Panel */
.results-panel {
  display: none;
  background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
  padding: 20px;
  border-radius: 15px;
  margin-top: 20px;
  border-left: 5px solid #666666;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

.results-title {
  font-weight: 600;
  margin-bottom: 15px;
  font-size: 16px;
  color: #ffffff;
}

.distance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: linear-gradient(145deg, #0d0d0d, #262626);
  border-radius: 8px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  transition: all 0.3s ease;
  border: 1px solid rgba(64, 64, 64, 0.3);
}

.distance-item:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.9);
  background: linear-gradient(145deg, #1a1a1a, #333333);
}

.node-label {
  font-weight: 600;
  color: #b3b3b3;
}

.distance-value {
  font-weight: bold;
  background: linear-gradient(145deg, #000000, #1a1a1a);
  padding: 4px 8px;
  border-radius: 6px;
  color: #ffffff;
  border: 1px solid #404040;
}

/* Status Messages */
.status-message {
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 500;
  transition: all 0.3s ease;
}

.status-info {
  background: rgba(0, 0, 0, 0.4);
  color: #b3b3b3;
  border: 1px solid rgba(77, 77, 77, 0.5);
}

.status-success {
  background: rgba(0, 0, 0, 0.4);
  color: #cccccc;
  border: 1px solid rgba(102, 102, 102, 0.5);
}

.status-error {
  background: rgba(0, 0, 0, 0.4);
  color: #999999;
  border: 1px solid rgba(128, 128, 128, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    order: -1;
  }

  .graph-canvas {
    height: 400px;
  }

  .node {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  header {
    padding: 20px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .graph-canvas {
    height: 300px;
  }

  .node {
    width: 35px;
    height: 35px;
    font-size: 12px;
  }
}