/* ============================================================================
   Railway Layout Creator - Styles
   ============================================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f0f0f0;
  overflow: hidden;
}

/* ============================================================================
   Container & Layout
   ============================================================================ */

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

.toolbar {
  display: flex;
  gap: 20px;
  padding: 10px 15px;
  background: #2c3e50;
  color: white;
  border-bottom: 2px solid #1a252f;
  overflow-x: auto;
  flex-shrink: 0;
}

.tool-section {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-right: 20px;
  border-right: 1px solid #445566;
}

.tool-section:last-child {
  border-right: none;
}

.tool-section h3 {
  font-size: 12px;
  font-weight: 600;
  margin-right: 10px;
  color: #95a5a6;
  text-transform: uppercase;
}

.main-area {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ============================================================================
   Canvas Container
   ============================================================================ */

.canvas-container {
  flex: 1;
  position: relative;
  background: #e8e8e8;
  overflow: hidden;
}

#layoutCanvas {
  display: block;
  cursor: crosshair;
  background: #ffffff;
  image-rendering: crisp-edges;
}

.canvas-info {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  pointer-events: none;
}

.canvas-info > div {
  margin: 2px 0;
}

/* ============================================================================
   Properties Panel
   ============================================================================ */

.properties-panel {
  width: 320px;
  background: #ecf0f1;
  border-left: 2px solid #bdc3c7;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.properties-panel h3 {
  background: #34495e;
  color: white;
  padding: 10px 15px;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.panel-content {
  padding: 15px;
}

.panel-content p {
  color: #7f8c8d;
  font-size: 14px;
  margin-bottom: 8px;
}

.panel-content .hint {
  font-size: 12px;
  font-style: italic;
}

.prop-group {
  margin-bottom: 15px;
}

.prop-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 5px;
}

.prop-group input[type="text"],
.prop-group input[type="number"],
.prop-group select,
.prop-group textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: white;
}

.prop-group textarea {
  resize: vertical;
  font-family: inherit;
}

.prop-group .hint {
  display: block;
  font-size: 11px;
  color: #95a5a6;
  margin-top: 3px;
}

.error-msg {
  display: block;
  color: #e74c3c;
  font-size: 11px;
  margin-top: 3px;
  font-weight: 600;
}

#connections-list {
  background: white;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 8px;
  min-height: 40px;
  max-height: 150px;
  overflow-y: auto;
}

.connection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: #ecf0f1;
  border-radius: 3px;
  margin-bottom: 4px;
  font-size: 12px;
  gap: 8px;
}

.connection-item:last-child {
  margin-bottom: 0;
}

.connection-item > span {
  flex: 1;
}

.connection-item button {
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}

.connection-item button:hover {
  background: #c0392b;
}

.connection-item button:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
  opacity: 0.5;
}

.connection-item button:disabled:hover {
  background: #bdc3c7;
  transform: none;
}

.metadata-section,
.stats-section {
  border-top: 1px solid #bdc3c7;
}

.stats-section {
  padding: 15px;
  background: #d5dbdd;
}

.stats-section > div > div {
  padding: 5px 0;
  font-size: 13px;
  color: #2c3e50;
}

.stats-section span {
  font-weight: 600;
  color: #27ae60;
}

/* ============================================================================
   Buttons
   ============================================================================ */

button {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  background: #3498db;
  color: white;
}

button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.tool-btn {
  background: #34495e;
  color: white;
  padding: 10px 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn span {
  font-size: 16px;
}

.tool-btn.active {
  background: #3498db;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

.tool-btn:hover {
  background: #415b76;
  transform: translateY(-1px);
}

.tool-btn.active:hover {
  background: #2980b9;
}

.primary-btn {
  background: #27ae60;
  color: white;
  font-weight: 600;
}

.primary-btn:hover {
  background: #229954;
}

.danger-btn {
  background: #e74c3c;
  color: white;
}

.danger-btn:hover {
  background: #c0392b;
}

.small-btn {
  padding: 6px 10px;
  font-size: 12px;
  background: #95a5a6;
}

.small-btn:hover {
  background: #7f8c8d;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.button-row button {
  flex: 1;
}

/* ============================================================================
   Status Bar
   ============================================================================ */

.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 8px 15px;
  background: #34495e;
  color: white;
  font-size: 12px;
  border-top: 2px solid #2c3e50;
  flex-shrink: 0;
}

#status-message {
  color: #ecf0f1;
}

#validation-status {
  color: #2ecc71;
  font-weight: 600;
}

#validation-status.error {
  color: #e74c3c;
}

/* ============================================================================
   Modal
   ============================================================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #ecf0f1;
}

.modal-header h3 {
  margin: 0;
  color: #2c3e50;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #95a5a6;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-close:hover {
  color: #e74c3c;
  transform: none;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #ecf0f1;
  display: flex;
  justify-content: flex-end;
}

.validation-item {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
  font-size: 13px;
}

.validation-item.error {
  background: #fadbd8;
  border-left: 4px solid #e74c3c;
  color: #c0392b;
}

.validation-item.warning {
  background: #fcf3cf;
  border-left: 4px solid #f39c12;
  color: #d68910;
}

.validation-item.success {
  background: #d5f4e6;
  border-left: 4px solid #27ae60;
  color: #1e8449;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.hidden {
  display: none !important;
}

label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: white;
  cursor: pointer;
}

label input[type="checkbox"] {
  cursor: pointer;
}

label input[type="number"] {
  background: #34495e;
  border: 1px solid #445566;
  color: white;
  padding: 4px 6px;
  border-radius: 3px;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 1200px) {
  .properties-panel {
    width: 280px;
  }
}

@media (max-width: 900px) {
  .toolbar {
    flex-wrap: wrap;
  }
  
  .properties-panel {
    width: 250px;
  }
  
  .tool-section h3 {
    display: none;
  }
}

