/**
 * MobiDaS Tutorial - Step-Based Learning Components
 * Fast, interactive, guided discovery approach
 */

/* ========================================
   LEVEL STRUCTURE
   ======================================== */
.level-container {
  margin: 0;
  padding: 0;
}

.level {
  display: none;
  animation: fadeIn 0.3s ease;
}

.level.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.level-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--color-border, #e2e8f0);
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary, #2563eb);
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
}

.level-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text, #1e293b);
  margin: 0;
}

.level-time {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-text-muted, #64748b);
  background: var(--color-bg-alt, #f8fafc);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

/* Level Progress Indicator */
.level-progress {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--color-bg-alt, #f8fafc);
  border-radius: 0.5rem;
}

.level-progress-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.level-progress-item:hover {
  background: white;
}

.level-progress-item.active {
  background: white;
  border-color: var(--color-primary, #2563eb);
}

.level-progress-item.completed {
  background: #f0fdf4;
  border-color: #16a34a;
}

.level-progress-item .level-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-border, #e2e8f0);
  color: var(--color-text-muted, #64748b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all 0.2s;
}

.level-progress-item.active .level-num {
  background: var(--color-primary, #2563eb);
  color: white;
}

.level-progress-item.completed .level-num {
  background: #16a34a;
  color: white;
}

.level-progress-item .level-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted, #64748b);
  text-align: center;
}

.level-progress-item.active .level-name,
.level-progress-item.completed .level-name {
  color: var(--color-text, #1e293b);
}


/* ========================================
   STEP CARDS
   ======================================== */
.step-card {
  background: white;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.2s;
}

.step-card:hover {
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.step-card.completed {
  border-color: #16a34a;
  background: #fafffe;
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary-light, #dbeafe);
  color: var(--color-primary, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-card.completed .step-number {
  background: #dcfce7;
  color: #16a34a;
}

.step-goal {
  flex: 1;
}

.step-goal h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text, #1e293b);
}

.step-time {
  font-size: 0.7rem;
  color: var(--color-text-muted, #64748b);
}

/* Step Sections */
.step-learn {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0 0.375rem 0.375rem 0;
  font-size: 0.875rem;
  color: #1e40af;
}

.step-learn strong {
  color: #1d4ed8;
}

.step-example {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.step-example-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7c3aed;
  margin-bottom: 0.5rem;
}

.step-example-content {
  font-size: 0.9rem;
  color: #1e293b;
  font-style: italic;
}

.step-apply {
  margin-bottom: 1rem;
}

.step-apply-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-apply-label::before {
  content: "▶";
  font-size: 0.6rem;
  color: var(--color-primary, #2563eb);
}

.step-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  color: #15803d;
}

.step-check::before {
  content: "✓";
  font-weight: 700;
  color: #16a34a;
}


/* ========================================
   INTERACTIVE INPUTS
   ======================================== */
.quick-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-border, #e2e8f0);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  transition: all 0.2s;
  resize: vertical;
}

.quick-input:focus {
  outline: none;
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.quick-input.has-content {
  border-color: #16a34a;
  background: #fafffe;
}

.quick-input::placeholder {
  color: #94a3b8;
}

/* Fill-in-the-blank */
.fill-blank {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.fill-blank input {
  width: 150px;
  padding: 0.35rem 0.5rem;
  border: none;
  border-bottom: 2px dashed var(--color-primary, #2563eb);
  background: transparent;
  font-size: inherit;
  color: var(--color-primary, #2563eb);
  font-weight: 500;
}

.fill-blank input:focus {
  outline: none;
  border-bottom-style: solid;
}

.fill-blank input.correct {
  border-color: #16a34a;
  color: #16a34a;
}

/* Choice Cards */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.choice-card {
  padding: 1rem;
  border: 2px solid var(--color-border, #e2e8f0);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.choice-card:hover {
  border-color: var(--color-primary, #2563eb);
  background: #f8fafc;
}

.choice-card.selected {
  border-color: var(--color-primary, #2563eb);
  background: #eff6ff;
}

.choice-card.correct {
  border-color: #16a34a;
  background: #f0fdf4;
}

.choice-card.incorrect {
  border-color: #dc2626;
  background: #fef2f2;
}

.choice-card-label {
  font-weight: 600;
  color: var(--color-text, #1e293b);
  margin-bottom: 0.25rem;
}

.choice-card-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted, #64748b);
}

/* Template Box */
.template-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.template-box-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b45309;
  margin-bottom: 0.5rem;
}

.template-text {
  font-family: Georgia, serif;
  font-style: italic;
  color: #1e293b;
  line-height: 1.6;
}

.template-text .blank {
  display: inline-block;
  min-width: 100px;
  border-bottom: 2px dashed #f59e0b;
  color: #b45309;
  font-style: normal;
  font-weight: 500;
}


/* ========================================
   COMPARISON BOXES
   ======================================== */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

.compare-box {
  padding: 1rem;
  border-radius: 0.5rem;
}

.compare-box.weak {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.compare-box.strong {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.compare-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.compare-box.weak .compare-label {
  color: #dc2626;
}

.compare-box.strong .compare-label {
  color: #16a34a;
}

.compare-text {
  font-size: 0.9rem;
  color: #1e293b;
  font-style: italic;
}

/* Improve This Exercise */
.improve-box {
  background: #fef2f2;
  border: 2px solid #fecaca;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.improve-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #dc2626;
  margin-bottom: 0.5rem;
}

.improve-text {
  font-size: 0.95rem;
  color: #991b1b;
  font-style: italic;
}

.improve-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: var(--color-text-muted, #64748b);
  font-size: 1.25rem;
}


/* ========================================
   FEEDBACK & HINTS
   ======================================== */
.hint-box {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  border-radius: 0 0.375rem 0.375rem 0;
  font-size: 0.85rem;
  color: #1e40af;
}

.hint-box strong {
  color: #1d4ed8;
}

.feedback-inline {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  display: none;
}

.feedback-inline.show {
  display: block;
}

.feedback-inline.success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.feedback-inline.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.feedback-inline.guide {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Use Example Button */
.btn-use-example {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #faf5ff;
  color: #7c3aed;
  border: 1px solid #e9d5ff;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-use-example:hover {
  background: #f3e8ff;
  border-color: #c4b5fd;
}


/* ========================================
   NAVIGATION
   ======================================== */
.level-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border, #e2e8f0);
}

.btn-level {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.btn-level-back {
  background: var(--color-bg-alt, #f8fafc);
  color: var(--color-text-muted, #64748b);
  border-color: var(--color-border, #e2e8f0);
}

.btn-level-back:hover {
  background: var(--color-border, #e2e8f0);
  color: var(--color-text, #1e293b);
}

.btn-level-next {
  background: var(--color-primary, #2563eb);
  color: white;
}

.btn-level-next:hover {
  background: #1d4ed8;
}

.btn-level-next:disabled {
  background: var(--color-border, #e2e8f0);
  color: var(--color-text-muted, #64748b);
  cursor: not-allowed;
}

.btn-level-complete {
  background: #16a34a;
  color: white;
}

.btn-level-complete:hover {
  background: #15803d;
}


/* ========================================
   QUICK CHECKLIST
   ======================================== */
.quick-checklist {
  background: var(--color-bg-alt, #f8fafc);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.quick-checklist-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #64748b);
  margin-bottom: 0.75rem;
}

.quick-checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--color-text, #1e293b);
}

.quick-checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #16a34a;
}

.quick-checklist-item.checked {
  color: #16a34a;
  text-decoration: line-through;
  opacity: 0.7;
}


/* ========================================
   MOBILITY-SPECIFIC COMPONENTS
   ======================================== */
.mobility-scenario {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #bfdbfe;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin: 1rem 0;
}

.mobility-scenario-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.mobility-scenario-title {
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.5rem;
}

.mobility-scenario-text {
  font-size: 0.9rem;
  color: #1e293b;
  line-height: 1.5;
}

.data-signal {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fef3c7;
  color: #92400e;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.insight-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
}

.insight-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #16a34a;
  margin-bottom: 0.5rem;
}

.insight-text {
  font-size: 0.95rem;
  color: #14532d;
  font-weight: 500;
}


/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .level-progress {
    flex-direction: column;
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .level-nav {
    flex-direction: column;
    gap: 1rem;
  }

  .btn-level {
    width: 100%;
    justify-content: center;
  }
}


/* ========================================
   DARK MODE OVERRIDES
   ======================================== */
[data-theme="dark"] .step-card {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .step-learn {
  background: rgba(37, 99, 235, 0.1);
  color: #93c5fd;
}

[data-theme="dark"] .step-example {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .quick-input {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme="dark"] .choice-card {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .template-box {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(253, 230, 138, 0.3);
}

[data-theme="dark"] .mobility-scenario {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}
