/**
 * BrightLiz - IA Lab Styles
 * Version 2 - Résultats simplifiés avec scorecard
 */

.ialab-page {
  --lab-purple: #a855f7;
  --lab-green: #10b981;
  --lab-red: #ef4444;
  --lab-orange: #f59e0b;
  --baseline-color: #9ca3af;
  --challenger-color: var(--lab-purple);
}

/* Hero */
.ialab-hero {
  text-align: center;
  padding: 120px 0 60px;
  background: radial-gradient(circle at 30% 20%, rgba(168, 85, 247, 0.08), transparent 40%),
              linear-gradient(180deg, var(--bg-alt), var(--bg));
}

.ialab-hero .hero-badge {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--lab-purple);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 24px;
}

.ialab-hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; color: var(--text); margin-bottom: 16px; }
.ialab-hero .hero-subtitle { font-size: 1.1rem; color: var(--muted); max-width: 600px; margin: 0 auto; }
.ialab-hero .back-link { margin-top: 30px; }

.lab-zone { padding: 60px 0 80px; }

/* Lab Steps */
.lab-step { margin-bottom: 50px; padding-bottom: 50px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.lab-step:last-of-type { border-bottom: none; }

.step-header { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }

.ialab-page .step-number { 
  width: 36px; 
  height: 36px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  background: rgba(168, 85, 247, 0.2); 
  border-radius: 50%; 
  font-size: 16px; 
  font-weight: 700; 
  color: var(--lab-purple); 
}

.step-header h2 { font-size: 1.3rem; font-weight: 700; color: var(--text); margin: 0; }
.step-desc { color: var(--muted); margin-bottom: 24px; padding-left: 52px; }

/* Workflow Selector */
.workflow-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-left: 52px; }
.workflow-btn { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 16px; background: rgba(10, 26, 42, 0.6); border: 2px solid rgba(255, 255, 255, 0.08); border-radius: 12px; cursor: pointer; transition: all 0.25s ease; }
.workflow-btn:hover { background: rgba(10, 26, 42, 0.9); border-color: rgba(255, 255, 255, 0.15); }
.workflow-btn.active { border-color: var(--lab-purple); background: rgba(168, 85, 247, 0.1); }
.workflow-icon { width: 40px; height: 40px; color: var(--muted); transition: color 0.2s; }
.workflow-icon svg { width: 100%; height: 100%; }
.workflow-btn.active .workflow-icon { color: var(--lab-purple); }
.workflow-name { font-size: 14px; font-weight: 600; color: var(--text); }
.workflow-tasks { font-size: 12px; color: var(--muted); }

/* Workflow Diagram */
.workflow-diagram { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 30px 20px; background: rgba(10, 26, 42, 0.5); border-radius: 12px; margin-bottom: 24px; overflow-x: auto; }
.workflow-node { position: relative; padding: 12px 20px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; text-align: center; min-width: 100px; }
.workflow-node.selectable { cursor: pointer; transition: all 0.2s; }
.workflow-node.selectable:hover { border-color: rgba(168, 85, 247, 0.5); }
.workflow-node.active { border-color: var(--lab-purple); background: rgba(168, 85, 247, 0.15); }
.node-label { font-size: 13px; font-weight: 600; color: var(--text); }
.node-badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 4px 10px; background: var(--lab-purple); border-radius: 10px; font-size: 10px; font-weight: 700; color: white; white-space: nowrap; }
.workflow-arrow { width: 24px; height: 24px; color: var(--muted); flex-shrink: 0; }
.workflow-arrow svg { width: 100%; height: 100%; }

/* Task Detail */
.task-detail { padding: 20px 24px; background: rgba(10, 26, 42, 0.6); border: 1px solid rgba(168, 85, 247, 0.2); border-radius: 12px; }
.task-detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.task-detail-header h4 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.task-type { padding: 4px 12px; background: rgba(168, 85, 247, 0.15); border-radius: 12px; font-size: 11px; font-weight: 600; color: var(--lab-purple); text-transform: uppercase; }
.task-detail p { color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.task-metrics { display: flex; gap: 24px; flex-wrap: wrap; }
.task-metric { font-size: 13px; color: var(--text); }
.task-metric strong { color: var(--muted); }

/* Dataset Preview */
.dataset-preview { background: rgba(10, 26, 42, 0.6); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 24px; }
.dataset-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.dataset-count { font-size: 14px; color: var(--text); }
.dataset-count strong { font-size: 20px; color: var(--lab-purple); }
.dataset-source { font-size: 12px; color: var(--muted); }

.sample-cases { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.sample-case { padding: 16px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(16, 185, 129, 0.2); border-radius: 8px; }
.sample-case.anomaly { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.05); }
.case-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.case-id { font-size: 13px; font-weight: 600; color: var(--text); font-family: monospace; }
.case-label { padding: 4px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.case-label.correct { background: rgba(16, 185, 129, 0.2); color: var(--lab-green); }
.case-label.anomaly { background: rgba(239, 68, 68, 0.2); color: var(--lab-red); }
.case-content { display: flex; flex-wrap: wrap; gap: 16px; }
.case-field { font-size: 13px; color: var(--text); }
.case-field strong { color: var(--muted); }
.case-field .warning { color: var(--lab-orange); font-style: normal; }
.case-reason { margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(239, 68, 68, 0.2); font-size: 12px; color: var(--lab-red); }
.dataset-stats { display: flex; gap: 30px; }
.stat-item { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--muted); }

/* Models Arena */
.models-arena { display: flex; align-items: center; justify-content: center; gap: 24px; padding-left: 52px; }
.model-card { flex: 1; max-width: 280px; padding: 24px; background: rgba(10, 26, 42, 0.7); border: 2px solid rgba(255, 255, 255, 0.08); border-radius: 12px; }
.model-card.baseline { border-color: rgba(156, 163, 175, 0.3); }
.model-card.challenger { border-color: rgba(168, 85, 247, 0.3); }
.model-header { margin-bottom: 16px; }
.model-badge { padding: 6px 12px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.model-badge.baseline { background: rgba(156, 163, 175, 0.2); color: var(--baseline-color); }
.model-badge.challenger { background: rgba(168, 85, 247, 0.2); color: var(--lab-purple); }
.model-select { width: 100%; padding: 12px 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; }
.model-select:focus { outline: none; border-color: var(--lab-purple); }
.model-info { margin-top: 12px; }
.model-spec { font-size: 12px; color: var(--muted); }
.vs-badge { font-size: 20px; font-weight: 900; color: var(--muted); background: linear-gradient(135deg, var(--baseline-color), var(--lab-purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Launch */
.launch-section { text-align: center; padding: 40px 0; }
.launch-btn { display: inline-flex; align-items: center; gap: 12px; padding: 18px 48px; background: linear-gradient(135deg, var(--lab-purple), #7c3aed); border: none; border-radius: 12px; color: white; font-size: 16px; font-weight: 700; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 8px 30px rgba(168, 85, 247, 0.3); }
.launch-btn:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(168, 85, 247, 0.4); }
.launch-btn.running { background: var(--lab-orange); pointer-events: none; }
.launch-btn svg { width: 20px; height: 20px; }

/* Progress */
.progress-section { display: none; padding: 30px; background: rgba(10, 26, 42, 0.8); border: 1px solid rgba(168, 85, 247, 0.3); border-radius: 16px; margin-bottom: 40px; }
.progress-section.active { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 16px; }
.progress-title { font-weight: 600; color: var(--text); }
.progress-percent { font-size: 18px; font-weight: 700; color: var(--lab-purple); }
.progress-bar { height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--lab-purple), #7c3aed); border-radius: 4px; transition: width 0.3s ease; }
.progress-case { font-size: 13px; color: var(--muted); }
.progress-case strong { color: var(--text); font-family: monospace; }

/* ================================ */
/* NEW SIMPLIFIED RESULTS          */
/* ================================ */

.results-section { display: none; }
.results-section.active { display: block; animation: fadeIn 0.5s ease; }

/* Scorecard Face-à-Face */
.results-scorecard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 40px;
}

.score-card {
  background: rgba(10, 26, 42, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  transition: all 0.3s ease;
}

.score-card.baseline { border-color: rgba(156, 163, 175, 0.3); }
.score-card.challenger { border-color: rgba(168, 85, 247, 0.3); }
.score-card.winner {
  border-color: var(--lab-green);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.score-card-header {
  margin-bottom: 24px;
}

.score-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.score-card.baseline .score-badge {
  background: rgba(156, 163, 175, 0.2);
  color: var(--baseline-color);
}

.score-card.challenger .score-badge {
  background: rgba(168, 85, 247, 0.2);
  color: var(--lab-purple);
}

.score-model-name {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.score-main {
  padding: 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.score-value {
  display: block;
  font-size: 3rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
}

.score-card.winner .score-value {
  color: var(--lab-green);
}

.score-label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.score-metric-label {
  font-size: 13px;
  color: var(--muted);
}

.score-metric-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* VS Central */
.score-vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 0;
}

.vs-circle {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--baseline-color), var(--lab-purple));
  border-radius: 50%;
  font-size: 16px;
  font-weight: 900;
  color: white;
}

.winner-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.4s ease;
}

.winner-indicator.show {
  opacity: 1;
  transform: scale(1);
}

.winner-indicator svg {
  width: 32px;
  height: 32px;
  color: var(--gold);
  animation: pulse-star 1.5s ease-in-out infinite;
}

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

.winner-indicator span {
  font-size: 11px;
  font-weight: 700;
  color: var(--lab-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

/* Accuracy Comparison Bar */
.accuracy-comparison {
  background: rgba(10, 26, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.accuracy-comparison h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.comparison-bar-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comparison-bar {
  position: relative;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.bar-baseline,
.bar-challenger {
  position: absolute;
  top: 0;
  left: 0;
  height: 50%;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  transition: width 0.8s ease-out;
}

.bar-baseline {
  top: 0;
  background: var(--baseline-color);
  width: 0%;
}

.bar-challenger {
  top: 50%;
  background: linear-gradient(90deg, var(--lab-purple), #7c3aed);
  border-radius: 0 0 4px 4px;
  width: 0%;
}

.bar-label {
  font-size: 12px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.comparison-legend {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-item.baseline .legend-dot { background: var(--baseline-color); }
.legend-item.challenger .legend-dot { background: var(--lab-purple); }

/* Result Example */
.result-example {
  margin-bottom: 32px;
}

.result-example h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.example-card {
  background: rgba(10, 26, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}

.example-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.example-case-id {
  font-family: monospace;
  font-weight: 600;
  color: var(--text);
}

.example-truth-label {
  font-size: 13px;
  color: var(--muted);
}

.truth-anomaly { color: var(--lab-red); }
.truth-valid { color: var(--lab-green); }

.example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.example-response {
  padding: 20px;
}

.example-response.baseline {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.response-model-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.response-verdict {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.response-verdict.correct {
  background: rgba(16, 185, 129, 0.2);
  color: var(--lab-green);
}

.response-verdict.incorrect {
  background: rgba(239, 68, 68, 0.2);
  color: var(--lab-red);
}

.response-explanation {
  font-size: 13px;
  color: var(--text);
  font-style: italic;
  margin: 0;
  line-height: 1.5;
}

/* Methodology */
.methodology-note {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 12px;
  margin-bottom: 32px;
}

.methodology-icon {
  width: 32px;
  height: 32px;
  color: var(--lab-purple);
  flex-shrink: 0;
}

.methodology-icon svg { width: 100%; height: 100%; }

.methodology-content h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--lab-purple);
  margin-bottom: 8px;
}

.methodology-content p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}

/* Actions */
.results-actions { text-align: center; }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }
.action-btn svg { width: 18px; height: 18px; }

/* CTA */
.ialab-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 60px 0;
  margin-top: 80px;
  background: transparent;
  border: none;
}
.ialab-cta h3 { font-size: 1.6rem; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.ialab-cta p { color: var(--muted); margin: 0; font-size: 15px; }

/* ================================ */
/* RESPONSIVE                       */
/* ================================ */

@media (max-width: 900px) {
  .results-scorecard {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .score-vs {
    flex-direction: row;
    justify-content: center;
    padding: 16px 0;
  }
  
  .score-card {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .ialab-hero { padding: 100px 0 40px; }
  .step-desc, .workflow-selector, .models-arena { padding-left: 0; }
  .workflow-selector { grid-template-columns: 1fr; }
  .models-arena { flex-direction: column; }
  .model-card { max-width: 100%; width: 100%; }
  .vs-badge { padding: 10px 0; }
  
  .score-value { font-size: 2.5rem; }
  
  .example-grid { grid-template-columns: 1fr; }
  .example-response.baseline { 
    border-right: none; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); 
  }
  
  .ialab-cta { flex-direction: column; text-align: center; gap: 24px; padding: 40px 0; }
}
