/* ControlPanel Styles */

.control-panel {
  padding: 1rem; /* Reduced from 1.5rem */
  background: var(--primary-bg);
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal overflow */
  display: flex;
  flex-direction: column;
  gap: 1rem; /* Reduced from 1.5rem */
  box-sizing: border-box;
}

.panel-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.panel-title {
  color: var(--primary-text);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.control-section {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem; /* Reduced from 1.5rem */
  box-sizing: border-box;
}

.section-header {
  margin-bottom: 1rem;
}

.section-header h4 {
  color: var(--primary-text);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem; /* Reduced from 1rem */
}

.control-button {
  background: transparent;
  border: 2px solid var(--border-color);
  color: var(--secondary-text);
  padding: 0.7rem 0.5rem; /* Reduced from 1rem */
  font-family: inherit;
  font-size: 0.8rem; /* Reduced from 0.9rem */
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem; /* Reduced from 0.5rem */
  box-sizing: border-box;
  min-height: 44px; /* Ensure touch target size */
}

.control-button:hover {
  border-color: var(--primary-text);
  color: var(--primary-text);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.control-button.start {
  border-color: var(--success-text);
  color: var(--success-text);
}

.control-button.start:hover {
  background: var(--success-text);
  color: var(--primary-bg);
  box-shadow: 0 0 20px var(--success-text);
}

.control-button.stop {
  border-color: var(--warning-text);
  color: var(--warning-text);
}

.control-button.stop:hover {
  background: var(--warning-text);
  color: var(--primary-bg);
  box-shadow: 0 0 20px var(--warning-text);
}

.control-button.spawn-agent {
  grid-column: 1 / -1;
  background: var(--primary-text);
  color: var(--primary-bg);
  border-color: var(--primary-text);
  font-weight: 700;
}

.control-button.spawn-agent:hover {
  background: transparent;
  color: var(--primary-text);
}

.agent-spawn-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  color: var(--secondary-text);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.agent-type-select {
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  color: var(--primary-text);
  padding: 0.8rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.agent-type-select:focus {
  outline: none;
  border-color: var(--primary-text);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.visualization-controls,
.network-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.control-row label {
  color: var(--secondary-text);
  font-size: 0.9rem;
  font-weight: 500;
  flex: 1;
}

.control-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--primary-text);
  cursor: pointer;
}

.control-slider {
  flex: 1;
  height: 6px;
  background: var(--primary-bg);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.control-slider::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary-text);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px var(--glow-color);
}

.control-input {
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  color: var(--primary-text);
  padding: 0.5rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  width: 80px;
}

.control-input:focus {
  outline: none;
  border-color: var(--primary-text);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.control-select {
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  color: var(--primary-text);
  padding: 0.5rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.control-select:focus {
  outline: none;
  border-color: var(--primary-text);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.performance-metrics {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.metric-label {
  color: var(--secondary-text);
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 80px;
}

.metric-bar {
  flex: 1;
  height: 8px;
  background: var(--primary-bg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.metric-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-text), var(--secondary-text));
  transition: width 0.5s ease;
  box-shadow: 0 0 10px var(--glow-color);
}

.metric-value {
  color: var(--primary-text);
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.quick-action-btn {
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  color: var(--secondary-text);
  padding: 0.8rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.quick-action-btn:hover {
  border-color: var(--primary-text);
  color: var(--primary-text);
  background: var(--secondary-bg);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
}

/* Responsive Design - Switch to single column earlier */
@media (max-width: 1400px) {
  .control-grid {
    grid-template-columns: 1fr; /* Single column for narrow sidebars */
  }
  
  .quick-actions {
    grid-template-columns: 1fr;
  }
  
  .control-button {
    padding: 0.6rem 0.5rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 1024px) {
  .control-panel {
    padding: 0.8rem;
    gap: 0.8rem;
  }
  
  .control-section {
    padding: 0.8rem;
  }
}

@media (max-width: 768px) {
  .control-panel {
    padding: 1rem;
    gap: 1rem;
  }
  
  .control-section {
    padding: 1rem;
  }
  
  .control-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .control-row label {
    margin-bottom: 0.2rem;
  }
  
  .metric-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .metric-bar {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .control-button {
    padding: 0.8rem;
    font-size: 0.8rem;
  }
  
  .quick-action-btn {
    padding: 0.6rem;
    font-size: 0.75rem;
  }
  
  .form-group {
    gap: 0.3rem;
  }
  
  .agent-type-select,
  .control-input,
  .control-select {
    padding: 0.6rem;
    font-size: 0.8rem;
  }
}