/* ============================================================================
   Practice Causality Page Styles
   ============================================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

.navbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.nav-button {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 500;
  transition: all 0.3s;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateX(-2px);
}

.nav-title {
  flex: 1;
  text-align: center;
  font-size: 1.5rem;
  margin: 0;
}

.scenario-counter {
  font-size: 0.9rem;
  opacity: 0.9;
  white-space: nowrap;
}

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

#scenario-container {
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.scenario-header {
  margin-bottom: 40px;
  border-bottom: 3px solid #667eea;
  padding-bottom: 20px;
}

.scenario-header h1 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 10px;
}

.scenario-header .subtitle {
  font-size: 1.1rem;
  color: #666;
  font-style: italic;
}

/* Story Section */
.story-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  padding: 30px;
  border-left: 4px solid #667eea;
  margin-bottom: 40px;
  border-radius: 8px;
}

.story-section h2 {
  font-size: 1.4rem;
  color: #667eea;
  margin-bottom: 20px;
}

.story-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #555;
}

/* Questions Section */
.questions-section {
  margin-bottom: 40px;
}

.question-card {
  background: #f8f9fa;
  padding: 25px;
  margin-bottom: 25px;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  transition: all 0.3s;
}

.question-card:hover {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.question-number {
  display: inline-block;
  background: #667eea;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  text-align: center;
  line-height: 30px;
  margin-bottom: 15px;
  font-weight: bold;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
}

.question-content {
  margin-bottom: 15px;
}

/* Multiple Choice Options */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option {
  padding: 0;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
}

.option:hover {
  border-color: #667eea;
  background: #f8f9ff;
}

.option input[type="radio"] {
  display: none;
}

.option label {
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 15px;
  margin: 0;
  width: 100%;
  gap: 10px;
}

.option input[type="radio"]:checked + label {
  font-weight: 600;
}

.option label::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid #667eea;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option input[type="radio"]:checked + label::before {
  background: #667eea;
  content: '✓';
  color: white;
  font-weight: bold;
  font-size: 12px;
}

/* Answer Box */
.answer-box {
  display: none;
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
  padding: 20px;
  margin-top: 15px;
  border-radius: 5px;
}

.answer-box.show {
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.answer-box h4 {
  color: #2e7d32;
  margin-bottom: 10px;
  font-size: 1rem;
}

.answer-box p {
  color: #1b5e20;
  line-height: 1.6;
}

.answer-box.answer-correct {
  background: #e8f5e9;
  border-left-color: #4caf50;
}

.answer-box.answer-incorrect {
  background: #ffebee;
  border-left-color: #f44336;
}

.answer-box.answer-incorrect h4 {
  color: #c62828;
}

.answer-box.answer-incorrect h4::before {
  content: "✗ ";
  color: #f44336;
}

.answer-box.answer-correct h4::before {
  content: "✓ ";
  color: #4caf50;
}

.answer-box .hint {
  background: rgba(76, 175, 80, 0.1);
  padding: 10px 15px;
  border-radius: 5px;
  margin-top: 10px;
  font-size: 0.95rem;
  font-style: italic;
}

/* Show Answer Button */
.show-answer-btn {
  background: #667eea;
  color: white;
  padding: 12px 25px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.show-answer-btn:hover {
  background: #764ba2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.show-answer-btn.answered {
  background: #4caf50;
}

/* Navigation Buttons */
.navigation {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #e0e0e0;
}

.nav-scenario-btn {
  flex: 1;
  padding: 15px 30px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 5px;
  background: #667eea;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
}

.nav-scenario-btn:hover:not(:disabled) {
  background: #764ba2;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.nav-scenario-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Footer */
footer {
  background: #333;
  color: white;
  text-align: center;
  padding: 30px 20px;
  margin-top: 60px;
}

footer p {
  margin: 0;
  font-size: 0.9rem;
}

/* Causal Graph Visualization */
.causal-graph-section {
  background: #f0f4ff;
  padding: 20px;
  border-radius: 8px;
  margin: 15px 0;
}

.causal-graph-section h5 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 1rem;
}

.dag-description {
  font-family: 'Courier New', monospace;
  background: white;
  padding: 15px;
  border-radius: 5px;
  border-left: 3px solid #667eea;
  margin-bottom: 10px;
  color: #333;
}

/* Regression Info */
.regression-info {
  background: #fff3e0;
  padding: 20px;
  border-radius: 8px;
  margin: 15px 0;
  border-left: 4px solid #ff9800;
}

.regression-info h5 {
  color: #e65100;
  margin-bottom: 10px;
}

.regression-info code {
  display: block;
  background: white;
  padding: 10px;
  border-radius: 4px;
  margin: 10px 0;
  font-family: 'Courier New', monospace;
  overflow-x: auto;
}

/* Answers Section */
.answers-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 3px solid #667eea;
}

.answers-section h2 {
  font-size: 1.5rem;
  color: #667eea;
  margin-bottom: 25px;
}

.answer-card {
  background: white;
  padding: 25px;
  margin-bottom: 20px;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.answer-card h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.answer-card ul {
  margin-left: 20px;
  line-height: 1.8;
  color: #555;
}

.answer-card li {
  margin-bottom: 10px;
}

.dag-image {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f9fa;
  padding: 10px;
}

.regression-result {
  background: #f5f5f5;
  padding: 15px;
  margin: 15px 0;
  border-radius: 5px;
  border-left: 4px solid #667eea;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-x: auto;
}

.regression-correct {
  border-left-color: #4caf50;
}

.regression-incorrect {
  border-left-color: #ff9800;
}

.key-takeaway {
  background: linear-gradient(135deg, #fff8e1 0%, #fffde7 100%);
  border-left-color: #fbc02d;
}

.key-takeaway h3 {
  color: #f57f17;
}

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

.element-box {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 5px;
  border: 2px solid #e0e0e0;
}

.element-box h4 {
  color: #667eea;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.element-box p {
  color: #555;
  margin: 0;
  font-size: 0.9rem;
}

.show-all-btn {
  background: #4caf50;
}

.show-all-btn:hover {
  background: #45a049;
}

.show-all-btn.answered {
  background: #ff9800;
}

/* Construction Warning */
.construction-warning {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border-left: 4px solid #ff9800;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.15);
}

.construction-warning strong {
  color: #e65100;
  display: block;
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.construction-warning p {
  color: #bf360c;
  line-height: 1.7;
  margin: 0;
  font-size: 0.95rem;
}

.construction-warning strong:first-child {
  display: block;
}

/* CSV Download Button */
.download-btn-small {
  display: inline-block;
  background: #4caf50;
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  margin: 10px 0;
  font-weight: 600;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}

.download-btn-small:hover {
  background: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.download-btn-small:active {
  transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
  #scenario-container {
    padding: 20px;
  }

  .scenario-header h1 {
    font-size: 1.5rem;
  }

  .story-section {
    padding: 20px;
  }

  .story-text {
    font-size: 1rem;
  }

  .question-card {
    padding: 15px;
  }

  .navigation {
    flex-direction: column;
  }

  .nav-scenario-btn {
    width: 100%;
  }

  .nav-container {
    flex-direction: column;
    text-align: center;
  }

  .nav-title {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 15px 0;
  }

  .nav-container {
    gap: 10px;
  }

  .nav-button {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  #scenario-container {
    padding: 15px;
  }

  .scenario-header h1 {
    font-size: 1.3rem;
  }

  .story-section {
    padding: 15px;
  }

  .question-card {
    padding: 12px;
  }
}
