/* Mokhtareon Course Wizard — shared styles */

body.brand-guidelines.course-wizard-page {
  --cw-question-bg: rgba(19, 100, 162, 0.06);
  --cw-correct-bg: rgba(34, 197, 94, 0.12);
  --cw-wrong-bg: rgba(239, 68, 68, 0.1);
}

.course-wizard-hero {
  padding: 2.5rem 1.5rem 3.5rem;
}

.course-wizard-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

.cw-wrap {
  max-width: 820px;
  margin: -2rem auto 4rem;
  padding: 0 1.5rem;
  position: relative;
  z-index: 2;
}

.cw-wrap--landing {
  max-width: 960px;
}

.cw-card {
  padding: 2rem;
}

.cw-welcome-lesson {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.cw-progress {
  margin-bottom: 1.5rem;
}

.cw-progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.cw-progress__bar {
  height: 8px;
  background: rgba(19, 100, 162, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.cw-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.35s ease;
  width: 0%;
}

.cw-step-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.cw-title {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.cw-explain p {
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.7;
}

.cw-explain p:last-child {
  margin-bottom: 0;
}

.cw-explain ul {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
}

.cw-explain li {
  color: var(--text-muted);
  padding: 0.35rem 0;
  padding-inline-start: 1.25rem;
  position: relative;
  line-height: 1.6;
}

.cw-explain li::before {
  content: "•";
  position: absolute;
  inset-inline-start: 0;
  color: var(--accent);
  font-weight: bold;
}

.cw-explain a {
  color: var(--primary);
  word-break: break-all;
}

.cw-image-frame {
  margin: 1rem 0;
}

.cw-image-frame img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.cw-image-fallback {
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  background: rgba(19, 100, 162, 0.06);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.cw-image-fallback a {
  color: var(--primary);
  font-weight: 700;
}

.cw-code {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-x: auto;
  margin: 1rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.cw-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cw-field label {
  display: block;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.cw-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cw-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 100, 162, 0.15);
}

.cw-field input.is-invalid {
  border-color: #ef4444;
}

.cw-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  display: none;
}

.cw-error.is-visible {
  display: block;
}

.cw-question-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  padding: 1rem 1.25rem;
  background: var(--cw-question-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.cw-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cw-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cw-option:hover {
  border-color: var(--primary);
  background: rgba(19, 100, 162, 0.04);
}

.cw-option input {
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.cw-option span {
  color: var(--text);
  line-height: 1.5;
}

.cw-option.is-selected {
  border-color: var(--primary);
  background: rgba(19, 100, 162, 0.08);
}

.cw-option.is-correct {
  border-color: #16a34a;
  background: var(--cw-correct-bg);
}

.cw-option.is-wrong {
  border-color: #dc2626;
  background: var(--cw-wrong-bg);
}

.cw-feedback {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  line-height: 1.6;
  font-size: 0.95rem;
}

.cw-feedback--correct {
  background: var(--cw-correct-bg);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #166534;
}

.cw-feedback--wrong {
  background: var(--cw-wrong-bg);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #991b1b;
}

.cw-solution-label {
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.cw-code-workspace {
  margin-top: 0.5rem;
}

.cw-code-editor-label {
  display: block;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.cw-code-editor {
  width: 100%;
  min-height: 200px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #1e293b;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  tab-size: 2;
}

.cw-code-editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 100, 162, 0.15);
}

.cw-code-toolbar {
  display: flex;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  flex-wrap: wrap;
}

.cw-code-output-wrap {
  margin-bottom: 0.5rem;
}

.cw-code-output {
  background: #0f172a;
  color: #94a3b8;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  min-height: 3rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  border: 1px solid var(--border);
}

.cw-test-results {
  margin-top: 1rem;
  overflow-x: auto;
}

.cw-test-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.cw-test-results th,
.cw-test-results td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.cw-test-results th {
  background: rgba(19, 100, 162, 0.08);
  color: var(--primary);
  font-weight: 700;
}

.cw-test-pass {
  color: #16a34a;
  font-weight: 700;
}

.cw-test-fail {
  color: #dc2626;
  font-weight: 700;
}

.cw-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.cw-actions__right {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.cw-btn {
  font: inherit;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.cw-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cw-btn--primary {
  background: var(--accent);
  color: var(--white);
}

.cw-btn--primary:hover:not(:disabled) {
  background: #e56a00;
}

.cw-btn--secondary {
  background: var(--bg-card);
  color: var(--primary);
  border: 1px solid var(--border);
}

.cw-btn--secondary:hover:not(:disabled) {
  background: rgba(19, 100, 162, 0.06);
  border-color: var(--primary);
}

.cw-results {
  text-align: center;
}

.cw-score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: var(--shadow);
}

.cw-score-circle__value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.cw-score-circle__label {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.cw-grade {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.cw-student-info {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.cw-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  text-align: center;
}

.cw-summary-item {
  padding: 1rem;
  background: rgba(19, 100, 162, 0.06);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.cw-summary-item__value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.cw-summary-item__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.cw-results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.cw-hidden {
  display: none !important;
}

/* Landing page session cards */
.cw-session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.cw-session-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

a.cw-session-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(19, 100, 162, 0.12);
}

.cw-session-card--soon {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.cw-session-card__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.cw-session-card__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.cw-session-card__desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  flex: 1;
}

.cw-session-card__meta {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cw-session-card__meta li {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(19, 100, 162, 0.08);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.cw-session-card__cta {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .cw-card {
    padding: 1.25rem;
  }

  .cw-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cw-actions__right {
    margin-left: 0;
    flex-direction: column-reverse;
  }

  .cw-btn {
    width: 100%;
  }
}
