/* ============================================================
   COMPONENTS — Shared UI elements across pages
   ============================================================ */

/* ---------- TOPBAR / NAV ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--ink) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
}

.topbar-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-size: .85rem;
  color: #fff;
  flex: none;
}

.brand span { color: var(--accent) }

.nav-links {
  display: flex;
  gap: 22px;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-2);
}
.nav-links a:hover { color: var(--accent-2) }
.nav-links a[aria-current="page"] { color: var(--accent-2) }

.topbar__spacer { flex: 1 }

/* ---------- BUTTONS ---------- */
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: var(--step--1);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn--primary { background: var(--accent); color: #fff }
.btn--primary:hover { background: var(--accent-2) }
.btn--ghost {
  border: 1px solid var(--line);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--text) }
.btn--soft {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text-2);
}
.btn--soft:hover {
  border-color: var(--text);
  color: var(--text);
}
.btn--lg {
  padding: 14px 26px;
  font-size: var(--step-0);
  border-radius: 10px;
}
.btn--sm { padding: 9px 14px; font-size: .78rem }
.btn--block { width: 100% }
.btn[disabled] { opacity: .5; cursor: not-allowed }

/* ---------- AVATAR ---------- */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 800;
  color: #fff;
  flex: none;
}
.avatar--lg { width: 44px; height: 44px; font-size: .85rem }

/* ---------- PROGRESS BAR ---------- */
.pbar {
  height: 8px;
  border-radius: 8px;
  background: var(--surface-3);
  overflow: hidden;
}
.pbar i {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width .6s ease;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--surface);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 300;
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.is-error { background: var(--danger) }

/* ---------- COURSE CARD ---------- */
.ccard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.ccard:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.ccard__thumb {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  position: relative;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -.02em;
}
.ccard__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.ccard__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.ccard__cat {
  font-size: .72rem;
  color: var(--accent-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ccard__title {
  font-weight: 700;
  font-size: var(--step-0);
  line-height: 1.4;
}
.ccard__meta {
  font-size: .78rem;
  color: var(--muted);
}
.ccard__rating {
  color: var(--star);
  font-weight: 700;
  font-size: .82rem;
}
.ccard__rating span {
  color: var(--muted);
  font-weight: 400;
}
.ccard__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.ccard__price {
  font-weight: 800;
  font-size: var(--step-0);
}
.ccard__price s {
  font-weight: 400;
  color: var(--muted);
  font-size: .8rem;
  margin-left: 6px;
}

/* ---------- AUTH NAV ---------- */
.auth-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: 12px;
}
.auth-nav__badge {
  display: none;
  align-items: center;
  gap: 8px;
}
.auth-nav__name {
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--text);
}
.auth-nav__logout {
  padding: 6px 10px;
  font-size: var(--step--1);
  height: auto;
}

/* ---------- FOOTER ---------- */
footer.foot {
  border-top: 1px solid var(--line-soft);
  padding: 40px 0 26px;
}
.foot-grid {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 24px;
}
.foot-grid h4 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 12px;
}
.foot-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.foot-grid a {
  font-size: var(--step--1);
  color: var(--text-2);
}
.foot-grid a:hover { color: var(--accent-2) }
.foot-bottom {
  max-width: 1180px;
  margin: 30px auto 0;
  padding: 20px 24px 0;
  box-sizing: border-box;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .78rem;
  color: var(--muted);
}

/* ---------- SECTION HEADER ---------- */
.section { padding: 56px 0 }
.section__head {
  max-width: 1180px;
  margin: 0 auto 28px;
  padding: 0 24px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.section__head h2 {
  font-size: var(--step-3);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
}
.section__head p {
  color: var(--text-2);
  margin: 6px 0 0;
  max-width: 60ch;
}
.section__link {
  font-weight: 700;
  font-size: var(--step--1);
  color: var(--accent-2);
}
.section__link:hover { text-decoration: underline }

/* ---------- PILL ---------- */
.pill {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-2);
}
.pill:hover { border-color: var(--accent) }
.pill[aria-pressed="true"] {
  background: var(--text);
  color: var(--ink);
  border-color: var(--text);
}

/* ---------- HOT LESSON TAG ---------- */
.hot-tag {
  font-size: .78rem;
  margin-left: 4px;
  flex: none;
  display: inline-block;
  animation: hotPulse 1.6s ease-in-out infinite;
}
@keyframes hotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .7; transform: scale(1.15); }
}

/* ---------- RESPONSIVE (shared) ---------- */
@media (max-width: 920px) {
  .nav-links { display: none }
  .foot-grid { grid-template-columns: 1fr 1fr }
}
@media (max-width: 768px) {
  .foot-grid { grid-template-columns: 1fr }
  input, textarea, select { font-size: 16px !important }
}
