/* ========= Course Detail Page ========= */
.detail-hero {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: var(--white);
  padding: 56px 0;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 40px;
  align-items: start;
}
.crumb { font-size: 13px; color: var(--gray-400); margin-bottom: 14px; }
.crumb a { color: var(--gray-300); }
.crumb i { margin: 0 8px; font-size: 10px; }
.detail-hero h1 { color: var(--white); font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: 14px; }
.detail-hero .lead { color: var(--gray-300); font-size: 16px; margin-bottom: 20px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 22px; font-size: 13.5px; color: var(--gray-300); margin-bottom: 18px; }
.detail-meta i { color: var(--accent); margin-right: 6px; }
.detail-author { display: flex; align-items: center; gap: 12px; }
.detail-author .avatar { background: linear-gradient(135deg, var(--accent), #fb923c); }
.detail-author .name { color: var(--white); font-weight: 600; }
.detail-author .role { color: var(--gray-400); font-size: 12.5px; }

.buy-card {
  background: var(--white);
  color: var(--gray-900);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  position: sticky;
  top: 90px;
}
.buy-card .preview {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.buy-card .preview .play {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.95);
  color: var(--primary);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px;
}
.buy-card .preview span {
  position: absolute; bottom: 14px; color: var(--white);
  font-size: 14px; font-weight: 600;
}
.buy-card-body { padding: 22px; }
.buy-price { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.buy-price .now { font-family: var(--font-display); font-size: 30px; font-weight: 800; }
.buy-price .was { color: var(--gray-400); text-decoration: line-through; }
.buy-price .off { background: var(--danger-light); color: var(--danger); padding: 3px 8px; border-radius: var(--radius-full); font-size: 12px; font-weight: 700; }
.buy-includes { list-style: none; margin: 18px 0; }
.buy-includes li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; color: var(--gray-700); }
.buy-includes i { color: var(--primary); width: 18px; }

/* Detail content tabs */
.detail-body { padding: 48px 0; }
.detail-body .grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 960px) {
  .detail-grid, .detail-body .grid { grid-template-columns: 1fr; }
  .buy-card { position: static; }
}

.outcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 22px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
}
.outcome-grid li { display: flex; gap: 10px; font-size: 14px; }
.outcome-grid i { color: var(--success); margin-top: 3px; }
@media (max-width: 700px) { .outcome-grid { grid-template-columns: 1fr; } }

/* Curriculum */
.curriculum { border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; }
.section-row { border-bottom: 1px solid var(--gray-200); }
.section-row:last-child { border-bottom: none; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  background: var(--gray-50);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
}
.section-header .chev { transition: transform 0.2s; }
.section-row.open .chev { transform: rotate(90deg); }
.section-row .lessons { display: none; }
.section-row.open .lessons { display: block; }
.lesson-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 22px;
  border-top: 1px solid var(--gray-100);
  font-size: 13.5px;
}
.lesson-row i { color: var(--gray-400); }
.lesson-row .l-name { flex: 1; }
.lesson-row .time { font-size: 12.5px; color: var(--gray-500); }
.lesson-row .free { font-size: 12px; color: var(--primary); font-weight: 700; }

/* Reviews */
.review-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 30px;
  padding: 24px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
.review-score { text-align: center; }
.review-score .big { font-family: var(--font-display); font-size: 48px; font-weight: 800; line-height: 1; }
.review-score .stars { color: var(--accent); margin: 6px 0; }
.review-score .total { font-size: 13px; color: var(--gray-500); }
.review-bars { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.review-bar { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.review-bar .star { width: 50px; }
.review-bar .bar { flex: 1; height: 8px; background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; }
.review-bar .bar div { height: 100%; background: var(--accent); }
.review-bar .pct { width: 36px; text-align: right; color: var(--gray-600); }

.review-item { padding: 20px 0; border-bottom: 1px solid var(--gray-100); }
.review-item:last-child { border-bottom: none; }
.review-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.review-head .name { font-weight: 700; }
.review-head .date { font-size: 12.5px; color: var(--gray-500); }
.review-item .stars { color: var(--accent); font-size: 13px; margin-bottom: 6px; }

/* ========= Course Player ========= */
/* Player layout — explicit min-width:0 on grid items so a long course title
   or wide watermark text can't push the row beyond viewport width and
   trigger horizontal scroll. */
.player-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100vh;
  background: #0b0d12;
  overflow-x: hidden;
  max-width: 100vw;
}
.player-main { display: flex; flex-direction: column; min-width: 0; }
.player-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: #111827;
  color: var(--white);
  border-bottom: 1px solid #1f2937;
  gap: 14px;
}
.player-topbar .back { color: var(--gray-400); flex-shrink: 0; }
.player-topbar h1 {
  color: var(--white); font-size: 16px;
  /* Long course titles get truncated rather than pushing the topbar wide. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1; text-align: center;
}
.player-video {
  aspect-ratio: 16/9;
  background: #000;
  position: relative;
  display: grid; place-items: center;
  user-select: none;
  -webkit-user-select: none;
  /* Clip the watermark so long monospace text inside spans can't bleed. */
  overflow: hidden;
  width: 100%;
}
.player-video img {
  width: 100%; height: 100%; object-fit: cover; opacity: 0.5;
  pointer-events: none; -webkit-user-drag: none;
}
.player-video video {
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
}
.player-video .watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, 1fr);
  z-index: 5;
  opacity: 0.22;
  overflow: hidden;
}
.player-video .watermark span {
  display: grid; place-items: center;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  transform: rotate(-22deg);
  font-family: monospace;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  /* Allow wrapping so long course slugs don't force horizontal overflow,
     but keep the diagonal rotation. */
  white-space: normal;
  overflow: hidden;
  text-align: center;
  word-break: break-word;
  padding: 4px;
}
.player-video .play-btn {
  position: absolute;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  color: var(--primary);
  display: grid; place-items: center;
  font-size: 28px;
}
.player-tabs {
  background: var(--white);
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}
.player-side {
  background: var(--white);
  border-left: 1px solid var(--gray-200);
  overflow-y: auto;
}
.player-side h4 {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 15px;
}
.player-progress { padding: 14px 20px; font-size: 13px; color: var(--gray-600); border-bottom: 1px solid var(--gray-100); }
@media (max-width: 1000px) {
  .player-wrap { grid-template-columns: 1fr; }
}

/* ========= Checkout ========= */
.checkout-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; }
@media (max-width: 900px) { .checkout-grid { grid-template-columns: 1fr; } }
.order-summary {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: sticky;
  top: 90px;
}
.order-item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--gray-200); }
.order-item:last-child { border-bottom: none; }
.order-item img { width: 80px; height: 56px; border-radius: 8px; object-fit: cover; }
.order-line { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.order-total { display: flex; justify-content: space-between; padding-top: 14px; margin-top: 12px; border-top: 1px solid var(--gray-300); font-weight: 700; font-size: 17px; }

.pay-method {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 10px;
  transition: var(--transition);
}
.pay-method:hover { border-color: var(--gray-400); }
.pay-method.active { border-color: var(--primary); background: var(--primary-50); }
.pay-method input { accent-color: var(--primary); }
.pay-method .name { font-weight: 600; }
.pay-method .desc { font-size: 12.5px; color: var(--gray-500); }
.pay-method img { height: 24px; margin-left: auto; }

/* ========= Certificate ========= */
.certificate {
  background: var(--white);
  border: 12px solid #f3e8d0;
  border-radius: 14px;
  padding: 56px;
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
  background-image:
    linear-gradient(135deg, rgba(79,70,229,0.04), rgba(245,158,11,0.04));
  box-shadow: var(--shadow-xl);
}
.cert-stamp {
  position: absolute;
  top: 24px; right: 30px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--gray-500);
}
.cert-eyebrow { font-size: 14px; color: var(--primary); letter-spacing: 0.2em; text-transform: uppercase; font-weight: 700; }
.certificate h1 { font-size: 48px; font-family: 'Plus Jakarta Sans', serif; margin: 12px 0 24px; }
.cert-recipient {
  font-family: 'Plus Jakarta Sans', serif;
  font-size: 38px;
  color: var(--primary);
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray-300);
  display: inline-block;
  margin: 16px 0 24px;
}
.cert-sigs { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 48px; }
.cert-sig { text-align: center; min-width: 200px; }
.cert-sig .signature { font-family: 'Brush Script MT', cursive; font-size: 26px; color: var(--gray-800); border-bottom: 1px solid var(--gray-400); padding-bottom: 6px; margin-bottom: 8px; }
.cert-sig .role { font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.08em; }
.cert-id { background: var(--gray-100); padding: 8px 14px; border-radius: var(--radius-full); display: inline-block; font-size: 12px; font-family: monospace; }

/* ========= Blog ========= */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}
.blog-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}
.blog-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.blog-thumb { aspect-ratio: 16/9; overflow: hidden; }
.blog-thumb img { width: 100%; height: 100%; object-fit: cover; }
.blog-body { padding: 22px; }
.blog-body .badge { margin-bottom: 10px; }
.blog-body h3 { font-size: 18px; margin-bottom: 10px; }
.blog-body p { font-size: 14px; color: var(--gray-600); margin-bottom: 14px; }
.blog-meta { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--gray-500); }

/* ========= Empty State ========= */
.empty {
  text-align: center;
  padding: 56px 24px;
}
.empty i { font-size: 48px; color: var(--gray-300); margin-bottom: 16px; }
.empty h3 { font-size: 18px; margin-bottom: 8px; }
.empty p { color: var(--gray-500); margin-bottom: 18px; }

/* ========= Modal ========= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17,24,39,0.6);
  display: none;
  align-items: center; justify-content: center;
  z-index: 300;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  /* Hard cap horizontal so a runaway grid child can't shove the modal
     past max-width and out of the viewport. */
  overflow-x: hidden;
}
/* On narrow screens, collapse two-column form rows so labels and inputs
   stay fully visible instead of getting clipped. */
@media (max-width: 640px) {
  .modal .form-row { grid-template-columns: 1fr; }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-100);
}
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--gray-100); }
