/**
 * 1r_FP_BASICA/1r_TRIMESTRE/17. LA CIENCIA DE L ELECTRICITAT I CIRCUITS/style.css
 * Estils per a la classe de Ciències Aplicades I: La ciència dels circuits i l'electricitat
 */
:root {
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --accent: #d97706;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

[data-theme="dark"] {
  --bg-main: #0b1320;
  --bg-surface: #111e33;
  --bg-card: rgba(17, 30, 51, 0.92);
  --border-color: #1e3352;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-light: rgba(56, 189, 248, 0.15);
  --accent: #fbbf24;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.5);
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

header.hero, main, footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Capçalera Hero */
header.hero {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.btn-return-course {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}
.btn-return-course:hover { text-decoration: underline; }

.theme-toggle-btn {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}

.eyebrow {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h1 span {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  max-width: 850px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chips span, .chip-action {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  text-decoration: none;
}

.chip-action {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.chip-action:hover {
  background: var(--primary);
  color: #ffffff;
}

/* Targetes globals */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

/* Marcador de laboratori */
.scoreboard {
  background: var(--bg-surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.score-title {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-main);
}

.score-badge {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
}

.score-track {
  width: 100%;
  height: 12px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.score-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7 0%, #16a34a 100%);
  transition: width 0.4s ease;
}

.score-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Secció del Simulador de Laboratori */
.lab-section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.mode-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mode-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.canvas-container {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

#circuit-canvas {
  width: 100%;
  height: 360px;
  display: block;
}

/* Panell de controls */
.controls-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--bg-main);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.btn-ctrl {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.2s;
}
.btn-ctrl:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-ctrl.active {
  background: var(--primary);
  color: #ffffff;
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.select-ctrl {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
}

.info-banner {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* Guia de Teoria Científica */
.theory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.theory-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.theory-card h3 {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theory-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Reptes de Laboratori */
.challenges-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.challenge-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border-left: 4px solid var(--primary);
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.challenge-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.challenge-pts {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.challenge-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-group select, .form-group input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
}

.btn-submit-ch {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-submit-ch:hover {
  background: var(--primary-hover);
}

.feedback {
  margin-top: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: none;
}
.feedback.error {
  display: block;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.feedback.success {
  display: block;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* Peu de pàgina */
footer {
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
