/* Enhanced CSS for AI Train Induction Scheduler */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  text-align: center;
  color: white;
  margin-bottom: 10px;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
  text-align: center;
  color: #f0f0f0;
  margin-bottom: 30px;
  font-style: italic;
}

/* Tabs */
.tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  gap: 10px;
}

.tab-btn {
  padding: 12px 24px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.tab-btn:hover, .tab-btn.active {
  background: rgba(255,255,255,0.9);
  color: #333;
  transform: translateY(-2px);
}

.tab-content {
  display: none;
  background: white;
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.tab-content.active {
  display: block;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

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

.form-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

.form-group select,
.form-group input {
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
  margin: 0 auto;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-small {
  background: #667eea;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 15px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-small:hover {
  background: #5a6fd8;
}

/* Output Styles */
.output {
  margin-top: 30px;
  padding: 20px;
  background: #f8f9ff;
  border-radius: 10px;
  border-left: 5px solid #667eea;
}

.result-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.result-header {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-bottom: 15px;
}

.ai-score {
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  color: white;
}

.breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.breakdown-item {
  background: #e8f0fe;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  color: #1565c0;
}

.conflicts-section {
  margin-top: 20px;
  padding: 15px;
  background: #fff3e0;
  border-radius: 8px;
  border-left: 4px solid #ff9800;
}

.no-conflicts {
  margin-top: 15px;
  padding: 10px;
  background: #e8f5e8;
  border-radius: 8px;
  color: #2e7d32;
}

/* Status Colors */
.status-optimal { background: #4caf50; }
.status-good { background: #2196f3; }
.status-caution { background: #ff9800; }
.status-avoid { background: #f44336; }

/* Dashboard */
.dashboard {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.dashboard h3 {
  margin-bottom: 20px;
  color: #333;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

th {
  background: #f5f5f5;
  font-weight: 600;
  color: #555;
}

tr:hover {
  background: #f8f9ff;
}

.conflict-badge {
  background: #ff5722;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 5px;
}

/* Optimizer */
.optimizer-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
}

.optimizer-controls label {
  font-weight: 600;
}

.optimizer-controls input {
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
}

.optimization-summary {
  background: #f8f9ff;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.stat {
  text-align: center;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.stat-number {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #667eea;
}

.stat-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
}

.recommendations {
  display: grid;
  gap: 15px;
}

.recommendation-item {
  display: grid;
  grid-template-columns: 50px 1fr 200px;
  align-items: center;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-left: 4px solid;
}

.recommendation-item.status-optimal { border-left-color: #4caf50; }
.recommendation-item.status-good { border-left-color: #2196f3; }
.recommendation-item.status-caution { border-left-color: #ff9800; }
.recommendation-item.status-avoid { border-left-color: #f44336; }

.rank {
  font-size: 18px;
  font-weight: bold;
  color: #667eea;
}

.train-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.score {
  background: #e8f0fe;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: #1565c0;
}

.conflicts {
  grid-column: 2 / -1;
  margin-top: 10px;
  padding: 8px;
  background: #fff3e0;
  border-radius: 4px;
  font-size: 12px;
  color: #e65100;
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.metric-card {
  background: #f8f9ff;
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.metric-card h3 {
  margin-bottom: 15px;
  color: #333;
}

.metric {
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
}

.metric:last-child {
  border-bottom: none;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

.train-overview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.detail-section {
  background: #f8f9ff;
  padding: 15px;
  border-radius: 8px;
}

.detail-section h4 {
  margin-bottom: 10px;
  color: #667eea;
}

.ai-breakdown {
  margin-bottom: 20px;
}

.breakdown-bar {
  display: grid;
  grid-template-columns: 80px 1fr 50px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bar {
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transition: width 0.3s ease;
}

.recommendation {
  background: #e8f5e8;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #4caf50;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  h1 {
    font-size: 2em;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .optimizer-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .recommendation-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .train-overview {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .modal-content {
    width: 95%;
    margin: 2% auto;
  }
}