/*
 * "Yo'l xaritasi" (route map) layout for course_detail.html — modules stay
 * a vertical sequence (timeline + marker), but each module's lessons render
 * as a card grid with an SVG progress gauge instead of a plain list
 * (new_front_tz.md 2.5, retrofit 2026-09-25). Card/gauge *structure* is
 * adapted from an external reference the project owner pointed to; its
 * color palette is NOT used anywhere here -- all colors below come from
 * theme.css's existing tokens.
 */

.roadmap {
  position: relative;
  padding-left: 2.25rem;
}

.roadmap::before {
  content: '';
  position: absolute;
  left: 0.6rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--color-border);
  transform-origin: top;
  animation: roadmap-line-draw 0.8s ease-out;
}

@keyframes roadmap-line-draw {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.roadmap-module {
  position: relative;
  margin-bottom: 2rem;
}

.roadmap-module__marker {
  position: absolute;
  left: -2.25rem;
  top: 0.15rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #fff;
  background: var(--color-border-strong);
}

/* White marker text only has enough contrast on the neutral gray default
   and on the indigo accent (locked modules are an inactive UI component
   anyway, exempt from WCAG contrast). The mid-lightness teal success color
   needs near-black text instead -- white text on it, or --color-primary
   (also mid-lightness now that primary is indigo, not navy), both fail. */
.roadmap-module--completed .roadmap-module__marker { background: var(--color-success); color: var(--color-text); }
.roadmap-module--current .roadmap-module__marker { background: var(--color-accent); color: #fff; }
.roadmap-module--locked .roadmap-module__marker { background: var(--color-border-strong); }

.roadmap-module__title {
  font-family: var(--font-heading);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.roadmap-module--locked .roadmap-module__title {
  color: var(--color-muted);
}

/* Lesson card grid (new_front_tz.md 2.5): responsive, 4 columns on desktop
   down to 1-2 on mobile -- auto-fill handles this without breakpoints. */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}

.topic-card {
  position: relative;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.topic-card--locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.topic-card:not(.topic-card--locked):hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 14, 26, 0.08);
}

.topic-card:not(.topic-card--locked):active {
  transform: translateY(-1px) scale(0.98);
}

.topic-card__stepno {
  position: absolute;
  top: 0.6rem;
  left: 0.75rem;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.topic-card__gauge {
  position: relative;
  width: 96px;
  height: 60px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.topic-card__ring {
  width: 100%;
  height: 100%;
}

.topic-card__ring-track {
  stroke: var(--color-border);
}

/* Draws from 0 to its real value on page load (static/js/motion.js sets
   stroke-dasharray to "0 100" then back to the rendered value one frame
   later, letting this transition animate the change). */
.topic-card__ring-fill {
  transition: stroke-dasharray 0.8s ease-out;
}

.topic-card__ring-fill--completed { stroke: var(--color-success); }
.topic-card__ring-fill--current { stroke: var(--color-accent); }

.topic-card__pct {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.topic-card__lock {
  width: 28px;
  height: 28px;
  margin: 1rem 0;
  color: var(--color-muted);
}

/* "Test" card (2026-09-25) -- sits next to its lesson's card in the grid,
   sharing the exact same size/shape but with a checklist icon instead of
   the progress ring (a quiz step doesn't have a percentage of its own,
   just locked/current/completed). */
.topic-card__quiz-icon {
  width: 28px;
  height: 28px;
  margin: 1rem 0;
  color: var(--color-accent);
}

.topic-card--quiz.topic-card--completed .topic-card__quiz-icon { color: var(--color-success-text); }

.topic-card__title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

.topic-card__badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.topic-card__badge--completed {
  background: color-mix(in srgb, var(--color-success) 16%, transparent);
  color: var(--color-success-text);
}

.topic-card__badge--current {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-warning-text);
}

.topic-card__badge--locked {
  background: var(--color-border);
  color: var(--color-muted);
}

/* Course header + info sections (course_detail.html) */
.course-hero {
  overflow: hidden;
}

.course-hero__text {
  padding: 1.5rem;
}

/* Cover shown whole (never cropped -- covers are often square posters with
   text near the edges); a blurred, enlarged copy of the same image fills
   whatever the ratio leaves empty. */
.course-hero__media {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--color-border);
}

.course-hero__media::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: var(--thumb-url) center / cover no-repeat;
  filter: blur(18px);
}

.course-hero__img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Side-by-side layout (md+): the frame fills the text column's full height
   instead of forcing its own aspect ratio, so it always matches the card. */
@media (min-width: 768px) {
  .course-hero__media {
    height: 100%;
    aspect-ratio: auto;
    min-height: 240px;
  }
}

.course-hero__subject {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-warning-text);
  margin-bottom: 0.35rem;
}

.course-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.course-chip {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--color-border);
  color: var(--color-text);
}

.course-teacher {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.course-teacher__photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.course-teacher__photo--initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
}

.course-info-card {
  padding: 1.25rem 1.5rem;
}

.course-info-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.course-info-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}

.course-info-list li:last-child {
  margin-bottom: 0;
}

.course-info-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-success-text);
  font-weight: 700;
}

.course-syllabus {
  margin: 0;
  padding-left: 1.25rem;
}

.course-syllabus li {
  padding: 0.35rem 0;
  padding-left: 0.25rem;
}

.course-syllabus li span:first-child {
  margin-right: 0.5rem;
}

/* Course rating (12.eta) -- static average display + the interactive
   5-star widget, both on course_detail.html. */
.course-rating-display {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.course-rating-display__stars {
  color: var(--color-warning-text);
}

.star-rating {
  display: inline-flex;
  gap: 0.15rem;
}

.star-rating__star {
  background: none;
  border: none;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-border-strong);
  cursor: pointer;
}

.star-rating__star:hover {
  color: var(--color-warning-text);
}

.star-rating__star--filled {
  color: var(--color-warning-text);
}

/* Same reasoning as .quiz-result-icon--unanswered (static/css/quiz.css):
   --color-muted is a *text* color, too light for white-on-it in dark mode. */
.payment-pending-badge {
  display: inline-block;
  background: var(--color-border-strong);
  color: var(--color-text);
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: 0.375rem;
}

/* ---------------------------------------------------------------------
   Kurs progressi (new_tz1.md 16.4): tepada umumiy foiz + segmentlangan
   chiziq (har bir modul -- bitta segment), har bir modul sarlavhasi
   ostida esa o'z progress-bari.
   --------------------------------------------------------------------- */
.roadmap-overview {
  padding: 1.1rem 1.25rem;
}

.roadmap-overview__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.roadmap-overview__pct {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
}

.roadmap-segments {
  display: flex;
  gap: 0.25rem;
}

/* Har bir segment teng kenglikda (flex: 1 1 0) -- modullar soni qancha
   bo'lsa ham chiziq bir xil to'liq kenglikni egallaydi va 360px'da ham
   sig'adi, chunki segmentlarning minimal kengligi yo'q. */
.roadmap-segment {
  flex: 1 1 0;
  min-width: 0;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}

.roadmap-segment__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--color-primary);
}

.roadmap-overview__meta {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.roadmap-module__progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0 0.9rem;
  max-width: 28rem;
}

.roadmap-module__progress .progress {
  flex: 1 1 auto;
  height: 0.4rem;
  background-color: var(--color-border);
}

.roadmap-module__progress .progress-bar {
  background-color: var(--color-primary);
}

.roadmap-module__pct {
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted);
}

/* ---------------------------------------------------------------------
   O'qituvchi yopgan dars (LessonBlock, 2026-11 audit) -- oddiy
   "oldingi darsni tugating" qulfidan ajratiladi: bu yerda talaba
   o'zi hech narsa qilib ocholmaydi, shuning uchun rang ham neytral
   kulrang emas, ogohlantiruvchi.
   --------------------------------------------------------------------- */
.topic-card--blocked .topic-card__lock {
  color: var(--color-danger-text);
}

.topic-card--blocked {
  border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border));
}

.topic-card__badge--blocked {
  background: color-mix(in srgb, var(--color-danger) 12%, transparent);
  color: var(--color-danger-text);
}
