/* Resource Allocation Optimizer - App-Specific Styles */

/* ======== Quick Start Guide ======== */
.quick-start-section {
  margin-bottom: 2rem;
}

.quick-start-details {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.quick-start-summary {
  padding: 1.5rem 2rem;
  cursor: pointer;
  color: white;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  user-select: none;
  list-style: none;
}

.quick-start-summary::-webkit-details-marker {
  display: none;
}

.quick-start-icon {
  font-size: 2rem;
  animation: pulse 2s ease-in-out infinite;
}

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

.quick-start-toggle {
  margin-left: auto;
  font-size: 0.85rem;
  opacity: 0.9;
  font-weight: normal;
}

.quick-start-content {
  background: white;
  padding: 2rem;
}

.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.quick-start-step {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: #f8f9fb;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  transition: transform 0.2s, box-shadow 0.2s;
}

.quick-start-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.step-number {
  font-size: 2rem;
  font-weight: bold;
  color: #667eea;
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.step-content h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: #333;
}

.step-content p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #555;
}

.step-content code {
  background: #e3f2fd;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  color: #1565c0;
}

.step-example {
  font-style: italic;
  color: #666 !important;
  font-size: 0.85rem !important;
}

.quick-start-footer {
  padding: 1rem 1.5rem;
  background: #fff3e0;
  border-left: 4px solid #ff9800;
  border-radius: 8px;
}

.quick-start-footer p {
  margin: 0;
  color: #e65100;
  font-size: 0.95rem;
}

/* ======== Intro Notes ======== */
.intro-notes {
  margin-top: 12px;
}

/* ======== Section Explanations ======== */
.section-explanation {
  background: #f0f7ff;
  border-left: 4px solid var(--app-accent);
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 4px;
  font-size: 0.95em;
  line-height: 1.6;
}

.section-explanation strong {
  color: var(--app-accent);
  font-weight: 600;
}

/* ======== Help Text ======== */
.help-text {
  font-size: 0.85em;
  color: #666;
  font-weight: normal;
  font-style: italic;
}

.info-text {
  background: #fff9e6;
  border-left: 4px solid #ffb020;
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: 4px;
  font-size: 0.9em;
  line-height: 1.5;
}

/* ======== Scenario Details ======== */
.scenario-detail {
  padding: 16px;
  background: #f8f9fb;
  border-radius: 8px;
  border-left: 4px solid var(--app-accent);
}

.scenario-detail h4 {
  margin: 0 0 12px 0;
  color: var(--app-accent);
}

.scenario-detail p {
  margin: 8px 0;
  line-height: 1.6;
}

.scenario-detail strong {
  color: var(--app-text);
  font-weight: 600;
}

/* ======== Model Selection ======== */
.model-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.model-selection label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 2px solid var(--app-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.model-selection label:hover {
  border-color: var(--app-accent);
  background-color: #f8f9fb;
}

.model-selection input[type="radio"] {
  margin-top: 2px;
  flex-shrink: 0;
}

.manual-model-select {
  margin: 16px 0;
  padding: 16px;
  background: #f8f9fb;
  border-radius: 8px;
}

.manual-model-select label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.manual-model-select select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  font-size: 14px;
}

/* ======== Constraints Grid ======== */
.constraint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 16px 0;
}

.constraint-item label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--app-text);
}

.constraint-item input[type="number"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  font-size: 14px;
}

.constraint-item input[type="checkbox"] {
  margin-right: 8px;
}

.advanced-constraints {
  margin-top: 20px;
  padding: 16px;
  background: #f8f9fb;
  border-radius: 8px;
}

.advanced-constraints summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--app-accent);
}

#cardinality-inputs,
#equity-inputs,
#baseline-inputs {
  margin-top: 12px;
  padding-left: 24px;
}

#cardinality-inputs label,
#equity-inputs label,
#baseline-inputs label {
  display: block;
  margin: 8px 0 4px 0;
  font-weight: normal;
  font-size: 14px;
}

#cardinality-inputs input,
#equity-inputs input,
#baseline-inputs input {
  width: 100%;
  max-width: 200px;
}

/* ======== Results Summary ======== */
.results-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.result-stat {
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fb 0%, #e8eef5 100%);
  border-radius: 8px;
  border-left: 4px solid var(--app-accent);
}

.result-stat-label {
  font-size: 13px;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.result-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--app-text);
}

.result-stat-unit {
  font-size: 16px;
  color: var(--app-muted);
  margin-left: 4px;
}

.scenario-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ======== Allocation Table ======== */
.allocation-table-container {
  overflow-x: auto;
  margin: 16px 0;
}

.allocation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.allocation-table th {
  background: var(--app-accent);
  color: white;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.allocation-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--app-border);
}

.allocation-table tr:hover {
  background: #f8f9fb;
}

.allocation-table input[type="number"] {
  width: 100px;
  padding: 6px 8px;
  border: 1px solid var(--app-border);
  border-radius: 4px;
  font-size: 13px;
}

.allocation-table input[type="number"]:focus {
  outline: none;
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px rgba(42, 125, 225, 0.1);
}

.table-controls {
  margin-bottom: 12px;
}

.table-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

/* ======== Model Fit Results Table ======== */
.model-fit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 16px 0;
}

.model-fit-table th {
  background: #f0f4f8;
  padding: 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--app-border);
}

.model-fit-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e8eef5;
}

.model-fit-table tr:hover {
  background: #f8fbff;
}

.model-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.model-badge.linear {
  background: #e0f2fe;
  color: #0369a1;
}

.model-badge.log {
  background: #fef3c7;
  color: #92400e;
}

.model-badge.power {
  background: #dbeafe;
  color: #1e40af;
}

.model-badge.quadratic {
  background: #e9d5ff;
  color: #6b21a8;
}

.model-badge.sqrt {
  background: #d1fae5;
  color: #065f46;
}

.model-badge.logistic {
  background: #fce7f3;
  color: #9f1239;
}

.model-badge.bounded_log {
  background: #fef3c7;
  color: #92400e;
}

.fit-quality-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.fit-quality-badge.excellent {
  background: #d1fae5;
  color: #065f46;
}

.fit-quality-badge.good {
  background: #bfdbfe;
  color: #1e40af;
}

.fit-quality-badge.fair {
  background: #fed7aa;
  color: #9a3412;
}

.fit-quality-badge.poor {
  background: #fecaca;
  color: #991b1b;
}

/* ======== Diagnostics ======== */
.diagnostics-details {
  margin-top: 12px;
}

.diagnostics-details summary {
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  color: var(--app-accent);
  margin-bottom: 12px;
}

.diagnostic-section {
  margin: 20px 0;
  padding: 16px;
  background: #f8f9fb;
  border-radius: 8px;
  border-left: 4px solid var(--app-accent);
}

.diagnostic-section h4 {
  margin: 0 0 12px 0;
  color: var(--app-text);
  font-size: 15px;
}

.diagnostic-item {
  margin: 10px 0;
  padding: 10px;
  background: white;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.6;
}

.diagnostic-label {
  font-weight: 600;
  color: var(--app-muted);
  display: block;
  margin-bottom: 4px;
}

.diagnostic-value {
  color: var(--app-text);
}

.diagnostic-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.diagnostic-status.success {
  background: #d1fae5;
  color: #065f46;
}

.diagnostic-status.warning {
  background: #fed7aa;
  color: #9a3412;
}

.diagnostic-status.error {
  background: #fecaca;
  color: #991b1b;
}

.diagnostic-status.info {
  background: #dbeafe;
  color: #1e40af;
}

.practical-considerations {
  margin-top: 20px;
  padding: 16px;
  background: #fffbeb;
  border-left: 4px solid var(--app-warning);
  border-radius: 8px;
}

.practical-considerations h4 {
  margin: 0 0 12px 0;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.practical-considerations h4::before {
  content: "💡";
  font-size: 18px;
}

.practical-considerations ul {
  margin: 8px 0;
  padding-left: 24px;
}

.practical-considerations li {
  margin: 8px 0;
  line-height: 1.6;
}

/* ======== Scenario Comparison ======== */
.scenarios-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.scenario-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f8f9fb;
  border: 2px solid var(--app-border);
  border-radius: 8px;
  transition: all 0.2s;
}

.scenario-item:hover {
  border-color: var(--app-accent);
}

.scenario-item input[type="checkbox"] {
  margin: 0;
}

.scenario-info {
  flex: 1;
}

.scenario-name {
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 4px;
}

.scenario-meta {
  font-size: 12px;
  color: var(--app-muted);
}

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

.scenario-actions-inline button {
  padding: 6px 12px;
  font-size: 13px;
}

/* ======== Sensitivity Analysis ======== */
.sensitivity-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: end;
  margin: 16px 0;
}

.sensitivity-controls label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.sensitivity-controls input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
}

.sensitivity-controls button {
  width: 100%;
}

/* ======== Chart Styling ======== */
.chart-placeholder {
  min-height: 400px;
  background: #f8f9fb;
  border-radius: 8px;
  margin: 16px 0;
}

.chart-note {
  font-size: 14px;
  color: var(--app-muted);
  font-style: italic;
  margin-top: 12px;
  line-height: 1.6;
}

.visual-settings {
  margin-top: 20px;
  padding: 16px;
  background: #f8f9fb;
  border-radius: 8px;
}

.visual-settings summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--app-accent);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.settings-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.settings-grid input[type="number"] {
  width: 100px;
  padding: 6px 8px;
  border: 1px solid var(--app-border);
  border-radius: 4px;
}

/* ======== Utility Classes ======== */
.hidden {
  display: none !important;
}

.error-text {
  color: var(--app-danger);
  font-weight: 600;
}

.success-text {
  color: var(--app-success);
  font-weight: 600;
}

.muted {
  color: var(--app-muted);
  font-size: 13px;
}

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

  .results-summary {
    grid-template-columns: 1fr;
  }

  .scenario-actions {
    flex-direction: column;
  }

  .scenario-actions button {
    width: 100%;
  }

  .sensitivity-controls {
    grid-template-columns: 1fr;
  }
}
