/* Latent Segmentation Tool - App-specific styles */
/* Professor Mode styles are centralized in shared/css/main.css */

:root {
  --template-placeholder-border: 1px dashed #cbd5e1;
  --latent-class-1: #1f77b4;
  --latent-class-2: #ff7f0e;
  --latent-class-3: #2ca02c;
  --latent-class-4: #d62728;
  --latent-class-5: #9467bd;
  --latent-class-6: #8c564b;
  --latent-class-7: #e377c2;
  --latent-class-8: #7f7f7f;
  --latent-class-9: #bcbd22;
  --latent-class-10: #17becf;
}

/* ===== Variable Assignment Grid ===== */
.variable-assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.variable-assignment-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.variable-assignment-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.variable-assignment-item .var-name {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1f2937;
  min-width: 100px;
  flex: 1;
}

.variable-assignment-item select {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  min-width: 120px;
}

.variable-assignment-item select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.variable-assignment-item.continuous select {
  border-color: #2563eb;
  background: #eff6ff;
}

.variable-assignment-item.categorical select {
  border-color: #16a34a;
  background: #f0fdf4;
}

/* ===== Model Type Indicator ===== */
.model-type-indicator {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 8px;
  border-left: 4px solid #0ea5e9;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.model-type-label {
  font-weight: 600;
  color: #0c4a6e;
}

.model-type-value {
  font-weight: 700;
  color: #0284c7;
}

.model-type-value.lpa {
  color: #2563eb;
}

.model-type-value.lca {
  color: #16a34a;
}

.model-type-value.hybrid {
  color: #9333ea;
}

/* ===== Model Settings Grid ===== */
.model-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 1rem;
}

.model-settings-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.model-settings-grid h4 {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}

.model-settings-grid label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

.model-settings-grid select,
.model-settings-grid input[type="number"] {
  margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
  .model-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Chart Placeholders ===== */
.chart-placeholder {
  min-height: 280px;
  border: var(--template-placeholder-border);
  border-radius: 12px;
  background: repeating-linear-gradient(
    45deg,
    rgba(226, 232, 240, 0.4),
    rgba(226, 232, 240, 0.4) 12px,
    rgba(203, 213, 225, 0.4) 12px,
    rgba(203, 213, 225, 0.4) 24px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

/* ===== Metrics Panel ===== */
.metrics-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.metric-output {
  flex: 1 1 auto;
  min-width: 150px;
  padding: 0.5rem 0.75rem;
  background: white;
  border-radius: 6px;
  font-size: 0.9rem;
  border: 1px solid #e2e8f0;
}

.metric-output span {
  font-weight: 700;
  color: #1d4ed8;
}

/* ===== Summary Table ===== */
.summary-table-card {
  margin-top: 1.5rem;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.summary-table th,
.summary-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.summary-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: #1e40af;
}

.summary-table tr:last-child td {
  border-bottom: none;
}

.summary-table .class-color-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* ===== Variable Profile Tags ===== */
.var-profile {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  margin: 0.15rem;
  font-size: 0.8rem;
  border-radius: 4px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.var-profile.continuous {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.var-profile.categorical {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.var-profile .var-name {
  font-weight: 600;
}

.var-profile .var-value {
  font-weight: 400;
}

/* ===== Template Buttons ===== */
.template-buttons {
  margin-top: 1rem;
}

/* ===== Export Controls ===== */
.export-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.export-controls button {
  flex: 1 1 auto;
  min-width: 200px;
}

.export-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Scenario Styling (from k-means) ===== */
.scenario-description {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
  border-left: 4px solid #1d4ed8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.scenario-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #dee2e6;
}

.scenario-icon {
  font-size: 1.5rem;
}

.scenario-header h4 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.1rem;
  flex-grow: 1;
}

.scenario-badge {
  background: #1d4ed8;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.scenario-intro {
  color: #495057;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.scenario-variables h5,
.scenario-context h5,
.scenario-insights h5,
.scenario-questions h5 {
  color: #2c3e50;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scenario-var-table {
  width: 100%;
  font-size: 0.9rem;
  border-collapse: collapse;
}

.scenario-var-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #e9ecef;
}

.scenario-var-table tr:last-child td {
  border-bottom: none;
}

.var-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.var-tag.continuous {
  background: #dbeafe;
  color: #1e40af;
}

.var-tag.categorical {
  background: #dcfce7;
  color: #166534;
}

.scenario-context .context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.context-item {
  background: white;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.context-item strong {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.context-item span {
  font-weight: 600;
  color: #1f2937;
}

.scenario-tip {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
}

.scenario-insights ul,
.scenario-questions ol {
  margin: 0;
  padding-left: 1.25rem;
}

.scenario-insights li,
.scenario-questions li {
  margin-bottom: 0.5rem;  line-height: 1.5;
}

.scenario-insights {
  margin-top: 1rem;
}

.scenario-questions {
  margin-top: 1rem;
  background: #f0f9ff;
  padding: 1rem;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;}

/* ===== Comparison Grid (k-means vs latent) ===== */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.comparison-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
}

.comparison-item strong {
  display: block;
  font-size: 0.95rem;
  color: #1e40af;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.comparison-item ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

.comparison-item li {
  margin-bottom: 0.35rem;
  color: #374151;
}

/* ===== Advanced Options ===== */
.advanced-options-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-top: 0.5rem;
}

.advanced-option {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #e2e8f0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.ksweep-controls {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.ksweep-inputs {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.ksweep-inputs > div {
  flex: 1;
}

.ksweep-inputs label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.ksweep-inputs input {
  width: 100%;
}

/* ===== Callout Boxes ===== */
.callout {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.callout--warning {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  color: #92400e;
}

.callout--info {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  color: #1e40af;
}

.callout--success {
  background: #dcfce7;
  border-left: 4px solid #22c55e;
  color: #166534;
}

.callout strong {
  font-weight: 600;
}

/* ===== Chart Controls ===== */
.chart-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
  gap: 0.5rem;
}

.chart-controls button.small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* ===== Heatmap specific ===== */
#latent-heatmap-chart {
  min-height: 200px;
}

/* ===== Projection chart ===== */
#latent-projection-chart {
  min-height: 320px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .variable-assignment-grid {
    grid-template-columns: 1fr;
  }
  
  .variable-assignment-item {
    flex-wrap: wrap;
  }
  
  .variable-assignment-item .var-name {
    min-width: auto;
    width: 100%;
  }
  
  .variable-assignment-item select {
    flex: 1;
  }
  
  .ksweep-inputs {
    flex-direction: column;
    gap: 1rem;
  }
  
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}
