/* Conjoint Analysis Tool - Specific Styles */

/* Attribute Configuration */
.attribute-config-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.attribute-config-item {
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  padding: 1rem;
  background: var(--card-bg, #fff);
}

.attribute-config-header {
  margin-bottom: 0.5rem;
}

.attribute-config-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.attr-type-select {
  flex: 1;
  max-width: 300px;
}

/* Competitor checkboxes */
.competitor-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

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

.comp-checkbox {
  cursor: pointer;
}

/* Product simulation config */
.products-config-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.product-config-card {
  border: 2px solid var(--border-color, #ddd);
  border-radius: 8px;
  padding: 1.5rem;
  background: var(--card-bg, #f9f9f9);
}

.product-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color, #ddd);
}

.prod-name {
  font-size: 1.1rem;
  font-weight: 600;
  border: 1px solid var(--border-color, #ddd);
  padding: 0.5rem;
  border-radius: 4px;
  flex: 1;
  margin-right: 1rem;
}

.remove-prod {
  background: var(--error-color, #e74c3c);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.remove-prod:hover {
  background: var(--error-hover, #c0392b);
}

.product-config-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.product-config-body label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.prod-attr, .prod-price, .prod-cost {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
}

.simulation-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Optimization */
.optimize-attribute-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Chart grid for simulation */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-top: 1.5rem;
}

/* Residuals diagnostics grid for multiple charts */
.residuals-diagnostics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1rem;
}

@media (min-width: 900px) {
  .residuals-diagnostics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1400px) {
  .residuals-diagnostics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Diagnostic status indicators */
.diagnostic-section .success {
  color: var(--success-color, #27ae60);
}

.diagnostic-section .warning {
  color: var(--warning-color, #f39c12);
}

.diagnostic-section .info {
  color: var(--info-color, #3498db);
}

.diagnostic-section ul {
  list-style: none;
  padding-left: 0;
  margin-top: 0.5rem;
}

.diagnostic-section li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
}

.diagnostic-section li:last-child {
  border-bottom: none;
}

/* Enhanced Loading Modal */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay[aria-hidden="false"] {
  display: flex;
}

.loading-modal {
  background: white;
  border-radius: 12px;
  padding: 3rem;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid #f3f3f3;
  border-top: 6px solid #3498db;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-modal h3 {
  margin: 0 0 1rem;
  color: #2c3e50;
  font-size: 1.5rem;
}

.loading-modal p {
  margin: 0.5rem 0;
  color: #555;
}

.loading-detail {
  font-size: 0.9rem;
  color: #777;
  margin-top: 1rem !important;
}

.loading-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
  color: #666;
}

.loading-stats strong {
  color: #3498db;
  font-size: 1.1rem;
}

/* ========================================
   Conjoint Creator Specific Styles
   ======================================== */

/* Case Study Cards */
.case-study-card {
  padding: 1.5rem;
  border: 1px solid var(--app-border, #d6dfea);
  border-radius: 8px;
  background: var(--app-card-bg, #fff);
  transition: all 0.2s ease;
}

.case-study-card:hover {
  border-color: var(--app-accent, #0066cc);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.1);
  transform: translateY(-2px);
}

.case-study-card h3 {
  margin: 0 0 0.75rem 0;
  color: var(--app-accent, #0066cc);
  font-size: 1.15rem;
}

.case-study-card p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.case-study-card ul {
  line-height: 1.8;
  margin: 0.5rem 0 0 1.5rem;
  font-size: 0.9rem;
  color: var(--app-text, #1f2a37);
}

.case-study-card ul li {
  margin-bottom: 0.4rem;
}

.case-study-card button {
  margin-top: 1rem;
  width: 100%;
}

/* Attribute and Competitor Rows */
.attribute-row, .competitor-row {
  background: var(--app-card-bg, #fff);
  border: 1px solid var(--app-border, #d6dfea);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
}

.attribute-row .grid-3-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  align-items: start;
}

.attribute-row label,
.competitor-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--app-text, #1f2a37);
}

.attribute-row small {
  color: var(--app-muted, #5f6b7a);
  font-size: 0.85rem;
  display: block;
  margin-top: 0.25rem;
}

.attribute-row .remove-attr-btn,
.competitor-row .remove-comp-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--app-danger, #d64747);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.competitor-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.competitor-inputs label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--app-text, #1f2a37);
}

.task-preview {
  background: var(--app-card-bg, #fff);
  border: 2px solid var(--app-border, #d6dfea);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.task-preview h4 {
  margin: 0 0 0.5rem;
  color: var(--app-accent, #2a7de1);
}

.task-preview > p {
  font-style: italic;
  color: var(--app-muted, #5f6b7a);
  margin: 0.5rem 0 1rem;
}

.alternatives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.alternative-card {
  background: white;
  border: 1px solid var(--app-border, #d6dfea);
  border-radius: 6px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.alternative-card strong {
  display: block;
  font-size: 1.1rem;
  color: var(--app-accent, #2a7de1);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--app-border, #e4e9f0);
}

.alternative-card > div {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.alternative-card .attr-label {
  font-weight: 600;
  color: #666;
  margin-right: 0.25rem;
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--app-text, #1f2a37);
}

.input-group small {
  display: block;
  color: var(--app-muted, #5f6b7a);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #28a745;
}

.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #dc3545;
}

.info-message {
  background: #d1ecf1;
  color: #0c5460;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #17a2b8;
}

.diagnostic-metric {
  background: var(--app-card-bg, #fff);
  border: 1px solid var(--app-border, #d6dfea);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.diagnostic-metric h4 {
  margin: 0 0 0.75rem;
  color: var(--app-accent, #2a7de1);
}

.diagnostic-metric ul {
  margin: 0.5rem 0 0 1.5rem;
  line-height: 1.8;
}

.diagnostic-metric p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.metric-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--app-accent, #2a7de1);
  margin: 0.5rem 0;
}

.metric-rating {
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  display: inline-block;
  margin: 0.5rem 0;
}

.metric-rating.excellent {
  background: #d4edda;
  color: #155724;
}

.metric-rating.good {
  background: #d1ecf1;
  color: #0c5460;
}

.metric-rating.acceptable {
  background: #fff3cd;
  color: #856404;
}

.metric-rating.poor {
  background: #f8d7da;
  color: #721c24;
}

/* ========================================
   IMPROVEMENT 1: Progressive Workflow Stepper
   ======================================== */
.workflow-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2rem auto;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  max-width: 900px;
}

.workflow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.workflow-step__indicator {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #757575;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  position: relative;
}

.workflow-step.active .workflow-step__indicator {
  background: #2a7de1;
  color: white;
  box-shadow: 0 0 0 4px rgba(42, 125, 225, 0.2);
}

.workflow-step.completed .workflow-step__indicator {
  background: #28a745;
  color: white;
}

.workflow-step__checkmark {
  display: none;
}

.workflow-step.completed .workflow-step__checkmark {
  display: block;
}

.workflow-step.completed .workflow-step__number {
  display: none;
}

.workflow-step__label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #757575;
  text-align: center;
  max-width: 100px;
}

.workflow-step.active .workflow-step__label {
  color: #2a7de1;
  font-weight: 600;
}

.workflow-step.completed .workflow-step__label {
  color: #28a745;
}

.workflow-step__connector {
  width: 60px;
  height: 3px;
  background: #e0e0e0;
  margin: 0 0.5rem;
  margin-bottom: 2rem;
}

.workflow-step.completed + .workflow-step__connector {
  background: #28a745;
}

/* ========================================
   IMPROVEMENT 2: Marketing Insight Callouts
   ======================================== */
.insight-callout {
  padding: 1rem 1.25rem;
  border-radius: 6px;
  margin: 1.5rem 0;
  border-left: 4px solid;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  line-height: 1.6;
}

.insight-callout__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.insight-callout__content {
  flex: 1;
}

.insight-callout__title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.insight-callout__text {
  margin: 0;
  font-size: 0.9rem;
}

/* Tip style (blue) */
.insight-callout.tip {
  background: #e3f2fd;
  border-color: #2196f3;
  color: #0d47a1;
}

/* Interpretation style (green) */
.insight-callout.interpretation {
  background: #e8f5e9;
  border-color: #4caf50;
  color: #1b5e20;
}

/* Warning/Common mistake style (yellow/orange) */
.insight-callout.warning {
  background: #fff3e0;
  border-color: #ff9800;
  color: #e65100;
}

/* ========================================
   IMPROVEMENT 3: Example Data Library Tabs
   ======================================== */
.data-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 1.5rem;
}

.data-tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: #666;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.data-tab:hover {
  color: #2a7de1;
  background: #f5f8fb;
}

.data-tab.active {
  color: #2a7de1;
  border-bottom-color: #2a7de1;
  font-weight: 600;
}

.data-tab-content {
  display: none;
}

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

.example-datasets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.example-card {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5rem;
  background: white;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.example-card:hover {
  border-color: #2a7de1;
  box-shadow: 0 4px 12px rgba(42, 125, 225, 0.15);
  transform: translateY(-2px);
}

.example-card__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  text-align: center;
}

.example-card h4 {
  margin: 0 0 0.5rem;
  color: #2a7de1;
  font-size: 1.2rem;
}

.example-card__stats {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 1rem;
  font-weight: 500;
}

.example-card__description {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #333;
  margin-bottom: 1rem;
  flex: 1;
}

.example-card__learning {
  font-size: 0.85rem;
  padding: 0.75rem;
  background: #f0f7ff;
  border-radius: 4px;
  margin-bottom: 1rem;
  color: #0d47a1;
}

.example-card button {
  margin-top: auto;
}

/* ========================================
   IMPROVEMENT 4: Results Dashboard Cards
   ======================================== */
.result-card {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: box-shadow 0.3s ease;
}

.result-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.result-card__header {
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #2a7de1 0%, #1e5bb8 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.result-card__header-icon {
  font-size: 1.5rem;
}

.result-card__header-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.result-card__body {
  padding: 1.5rem;
}

.result-card__actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fa;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.result-card__actions button {
  flex: 0 0 auto;
}

/* ========================================
   IMPROVEMENT 5: Contextual Help Popovers
   ======================================== */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2a7de1;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: help;
  margin-left: 0.35rem;
  position: relative;
  vertical-align: middle;
}

.help-icon:hover {
  background: #1e5bb8;
}

.help-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
  width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.help-icon:hover .help-popover {
  opacity: 1;
  pointer-events: auto;
}

.help-popover::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #2c3e50;
}

.help-term {
  font-weight: 600;
  color: #5dade2;
  margin-bottom: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .workflow-stepper {
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .workflow-step__connector {
    display: none;
  }
  
  .example-datasets {
    grid-template-columns: 1fr;
  }
  
  .help-popover {
    width: 220px;
    font-size: 0.8rem;
  }
}

