* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f8;
  color: #2c3e50;
  line-height: 1.5;
}

header {
  background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
header h1 { margin: 0; font-size: 1.5em; display: flex; align-items: center; gap: 10px; }
.header-logo { height: 36px; width: 36px; display: block; border-radius: 6px; }
header nav a {
  color: white;
  text-decoration: none;
  margin-left: 16px;
  font-size: 0.95em;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background 0.2s;
}
header nav a:hover { background: rgba(255,255,255,0.15); }

main {
  max-width: 800px;
  margin: 24px auto;
  padding: 0 16px;
}

footer {
  text-align: center;
  padding: 24px;
  color: #95a5a6;
}

a {
  color: #2980b9;
  text-decoration: underline;
}
a:hover { color: #1f6391; }

/* =========================================
   KID MODE — Big, encouraging, visual
   ========================================= */
.kid-mode h2 {
  font-size: 1.8em;
  color: #2c3e50;
  margin-top: 0;
}

.kid-mode .badge-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0 24px 0;
}

.streak-card, .points-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  flex: 1;
  min-width: 160px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.points-card {
  background: linear-gradient(135deg, #6a82fb 0%, #fc5c7d 100%);
}
.streak-icon, .points-icon {
  font-size: 2em;
}
.streak-num, .points-num {
  font-size: 1.7em;
  font-weight: 700;
  line-height: 1;
}
.streak-label, .points-label {
  font-size: 0.85em;
  opacity: 0.9;
}
.streak-best {
  font-size: 0.75em;
  opacity: 0.75;
  margin-top: 2px;
}

.task-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  border-left: 4px solid #3498db;
}
.task-card.completed {
  border-left-color: #27ae60;
  background: #f4faf6;
}
.task-card h3 { margin: 8px 0; font-size: 1.3em; }
.task-card .task-desc { color: #555; }
.task-card .task-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0;
  font-size: 0.9em;
  color: #7f8c8d;
}
.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.track-tag {
  display: inline-block;
  background: #ecf0f1;
  color: #2c3e50;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
}

.score-display {
  text-align: center;
  padding: 24px;
  border-radius: 12px;
  margin: 16px 0;
}
.score-display.score-pass {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
  color: white;
}
.score-display.score-fail {
  background: linear-gradient(135deg, #f7b733 0%, #fc4a1a 100%);
  color: white;
}
.score-num {
  font-size: 3em;
  font-weight: 700;
}

/* Difficulty rating buttons — kid-friendly */
.difficulty-rating {
  background: #ecf6fc;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
}
.difficulty-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.btn-diff {
  flex: 1;
  min-width: 110px;
  background: white;
  border: 2px solid #3498db;
  color: #2c3e50;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-diff:hover {
  background: #3498db;
  color: white;
}

/* =========================================
   PARENT MODE — Professional, data-dense
   ========================================= */
.parent-mode h2 {
  font-size: 1.5em;
  color: #2c3e50;
  margin-top: 0;
}

.parent-card {
  background: white;
  padding: 24px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #e0e0e0;
}
.parent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}
.parent-card-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.4em;
}
.parent-card-header small {
  color: #7f8c8d;
}
.kid-stats {
  display: flex;
  gap: 20px;
  text-align: center;
}
.kid-stats > div {
  background: #f8f9fa;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #ecf0f1;
}
.kid-stats strong {
  font-size: 1.3em;
  color: #2980b9;
}
.kid-stats small {
  color: #7f8c8d;
  font-size: 0.75em;
}

.parent-detail {
  margin: 16px 0;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}
.parent-detail h4 {
  margin: 0 0 8px 0;
  color: #34495e;
  font-size: 1em;
}
.parent-detail ul {
  margin: 4px 0;
  padding-left: 20px;
}
.parent-detail li {
  margin: 4px 0;
}

.today-row {
  padding: 6px 0;
  border-bottom: 1px solid #f5f5f5;
}
.today-row:last-child {
  border-bottom: none;
}

.parent-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* =========================================
   SHARED COMPONENTS
   ========================================= */
.card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

.card h2 { margin-top: 0; }
.card h3 { margin-top: 0; }

.btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.btn:hover { background: #2980b9; }
.btn.secondary { background: #95a5a6; }
.btn.secondary:hover { background: #7f8c8d; }
.btn.success { background: #27ae60; }
.btn.success:hover { background: #1e8449; }
.btn.warn { background: #e67e22; }
.btn.warn:hover { background: #b9651b; }
.btn:disabled { background: #bdc3c7; cursor: not-allowed; }

/* Status pills */
.status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.82em;
  font-weight: 600;
  display: inline-block;
}
.status.pending { background: #ecf0f1; color: #7f8c8d; }
.status.in_progress { background: #fff3cd; color: #856404; }
.status.complete { background: #d4edda; color: #155724; }
.status.quiz_failed { background: #f8d7da; color: #721c24; }
.status.no_task { background: #e3e8ed; color: #34495e; }

/* Quiz questions */
.question {
  margin-bottom: 16px;
  padding: 14px;
  border-left: 3px solid #3498db;
  background: #f8f9fa;
  border-radius: 4px;
}
.question.correct { border-left-color: #27ae60; }
.question.incorrect { border-left-color: #e74c3c; }
.question p { margin: 0 0 8px 0; }
.question label {
  display: block;
  margin: 6px 0;
  cursor: pointer;
}
.question input[type="text"], .question textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1em;
}

/* Progress bars */
.progress-bar {
  background: #ecf0f1;
  border-radius: 8px;
  height: 28px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar.small {
  height: 16px;
}
.progress-fill {
  background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 10px;
  color: white;
  font-size: 0.85em;
  font-weight: 600;
  transition: width 0.5s;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.92em;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #ecf0f1;
}
th {
  background: #f8f9fa;
  font-weight: 600;
}
tr.clickable {
  cursor: pointer;
}
tr.clickable:hover {
  background: #ecf6fc;
}
tr.clickable td:nth-child(3) {
  color: #2980b9;
  text-decoration: underline;
}

/* Details/summary expandable sections */
details {
  background: #f8f9fa;
  border-radius: 4px;
  padding: 8px 12px;
  margin: 8px 0;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  color: #2c3e50;
  padding: 4px 0;
}
details[open] {
  background: white;
  border: 1px solid #e0e0e0;
}

/* Form rows */
.form-row {
  margin: 12px 0;
}
.form-row label {
  font-weight: 500;
  color: #2c3e50;
}
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="number"],
.form-row select {
  width: 100%;
  padding: 10px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-top: 4px;
}
.form-row input[type="checkbox"] {
  margin-right: 6px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 12px 0;
}
.alert.success { background: #d4edda; color: #155724; }
.alert.error { background: #f8d7da; color: #721c24; }
.alert.info { background: #d1ecf1; color: #0c5460; }

.loading {
  text-align: center;
  color: #95a5a6;
  padding: 40px;
}

/* Mobile */
@media (max-width: 600px) {
  header { flex-direction: column; align-items: flex-start; gap: 8px; }
  header nav a { margin-left: 0; margin-right: 12px; padding: 4px 8px; }
  .btn { width: 100%; margin-bottom: 8px; }
  .parent-card-header { flex-direction: column; }
  .kid-stats { width: 100%; }
  .difficulty-buttons { flex-direction: column; }
  .btn-diff { width: 100%; }
  table { font-size: 0.82em; }
  th, td { padding: 6px 8px; }
}

/* Module step-by-step instructions */
.module-steps p { margin: 4px 0; line-height: 1.5; color: #34495e; }
.module-steps p:first-child { margin-top: 8px; }
.resource-preview img { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

