/**
 * Course Results Page — Scaffold Education Canada (wcsb theme)
 * Matches the approved mockup (course-results.html).
 * Colors: #9F1D21 red | #202C47 navy | #F2682C orange | Poppins font
 * After any change: drush cr
 */

/* ============================================================
   PAGE RESET + HIDE DEFAULT LMS OUTPUT
   ============================================================ */
/* Let the results UI use the full 1400px container width */
body.lms-results-active main .container { max-width: 1400px !important; }

/* Hide the raw Drupal/Opigno results output + page title once our UI is in */
body.lms-results-active .region-content .block-system-main-block,
body.lms-results-active .region-header .block-page-title-block,
body.lms-results-active header.content-header .page-title,
body.lms-results-active .messages--status,
body.lms-results-active .messages--error {
  display: none !important;
}

/* ============================================================
   ROOT WRAPPER
   ============================================================ */
#lms-results-root {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 24px 64px;
  width: 100%;
  font-family: 'Poppins', 'Roboto', system-ui, sans-serif;
}

/* ============================================================
   HERO RESULT CARD
   ============================================================ */
.lms-res-hero {
  border-radius: 20px;
  padding: 48px 40px;
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
  transition: background 0.4s;
}
.lms-res-hero.pass-state {
  background: linear-gradient(135deg, #9F1D21 0%, #7a1619 60%, #202C47 100%);
  box-shadow: 0 20px 60px rgba(159, 29, 33, 0.35);
}
.lms-res-hero.fail-state {
  background: linear-gradient(135deg, #9F1D21 0%, #F2682C 100%);
  box-shadow: 0 20px 60px rgba(242, 104, 44, 0.35);
}
.lms-res-hero::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
  pointer-events: none;
}
.lms-res-hero::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  pointer-events: none;
}

.lms-res-course-tag {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 100px;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.lms-res-hero h2.lms-res-course-title {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 8px;
  position: relative;
  z-index: 1;
  color: #fff !important;
  font-family: 'Poppins', sans-serif !important;
  line-height: 1.3;
}
.lms-res-hero .lms-res-subtitle {
  font-size: 16px;
  color: #ffffff;
  opacity: 1;
  margin-bottom: 36px;
  position: relative;
  z-index: 1;
}

/* Score ring */
.lms-res-ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  z-index: 1;
}
.lms-res-ring-wrap svg { transform: rotate(-90deg); }
.lms-res-ring-track { fill: none; stroke: rgba(255,255,255,0.2); stroke-width: 8; }
.lms-res-ring-fill {
  fill: none;
  stroke: #fff;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 408.4;
  stroke-dashoffset: 408.4;
  transition: stroke-dashoffset 1.4s ease;
}
.lms-res-ring-center {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lms-res-ring-emoji { font-size: 32px; line-height: 1; margin-bottom: 4px; }
.lms-res-ring-pct   { font-size: 40px; font-weight: 800; line-height: 1; color: #fff; font-family: 'Poppins', sans-serif; }
.lms-res-ring-label { font-size: 11px; opacity: 0.75; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #fff; }

/* Score ring + result info side by side */
.lms-res-scoreblock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  position: relative;
  z-index: 1;
  margin-bottom: 6px;
}
.lms-res-scoreblock .lms-res-ring-wrap { margin-bottom: 0 !important; }
.lms-res-scoreinfo { text-align: left; }
.lms-res-username {
  font-size: 30px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
  font-family: 'Poppins', sans-serif;
  line-height: 1.2;
  word-break: break-word;
}

.lms-res-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 24px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

/* ============================================================
   CONFETTI (pass)
   ============================================================ */
.lms-confetti {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.lms-confetti-dot { position: absolute; top: -10px; animation: lms-fall linear forwards; }
@keyframes lms-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(340px) rotate(720deg); opacity: 0; }
}

/* ============================================================
   STATS GRID — 3 cards
   ============================================================ */
.lms-res-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.lms-res-stat {
  background: #fff;
  border-radius: 14px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform .2s, box-shadow .2s;
}
.lms-res-stat:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.lms-res-stat-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin: 0 auto 10px;
  background: #fde8e8;
}
.lms-res-stat-value { font-size: 30px; font-weight: 800; color: #1e293b; line-height: 1; font-family: 'Poppins', sans-serif; }
.lms-res-stat-name  { font-size: 14px; color: #94a3b8; margin-top: 5px; font-weight: 500; }

/* ============================================================
   ANSWER BREAKDOWN — full width, 2-col list
   ============================================================ */
.lms-res-answer-section { margin-bottom: 28px; }
.lms-res-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.lms-res-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
}
.lms-res-ans-list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 40px;
}
.lms-res-ans-list li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 15px;
  color: #475569;
  line-height: 1.5;
}
/* remove bottom border on the last item of each column */
.lms-res-ans-list li:last-child,
.lms-res-ans-list li:nth-last-child(2):nth-child(odd) { border-bottom: none; }
.lms-res-ans-badge {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.lms-res-ans-badge.c { background: #fde8e8; color: #9F1D21; }
.lms-res-ans-badge.w { background: #fee2e2; color: #dc2626; }
.lms-res-ans-badge.s { background: #f1f5f9; color: #94a3b8; }
.lms-res-ans-name { flex: 1; min-width: 0; }
.lms-res-ans-badge { margin-top: 1px; }
.lms-res-ans-pts { margin-left: auto; font-weight: 600; flex-shrink: 0; }
.lms-res-ans-pts.pos { color: #9F1D21; }
.lms-res-ans-pts.neg { color: #ef4444; }
.lms-res-ans-pts.neu { color: #94a3b8; }

/* ============================================================
   CERTIFICATE (pass)
   ============================================================ */
.lms-res-cert {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px dashed #F2682C;
  border-radius: 20px;
  padding: 36px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
}
.lms-res-cert::before { content: '🏅'; position: absolute; top: 16px; left: 24px; font-size: 28px; opacity: .5; }
.lms-res-cert::after  { content: '🏅'; position: absolute; top: 16px; right: 24px; font-size: 28px; opacity: .5; }

.lms-res-cert-badge {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #F2682C;
  margin-bottom: 6px;
  font-family: 'Poppins', sans-serif;
}
.lms-res-cert-sub { font-size: 14px; color: #92400e; margin-bottom: 16px; }
.lms-res-cert-heading {
  font-size: 28px;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 4px;
  font-family: 'Poppins', sans-serif;
}
.lms-res-cert-course { font-size: 16px; color: #64748b; margin-bottom: 24px; }
.lms-res-cert-meta {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.lms-res-cert-meta-item { text-align: center; }
.lms-res-cert-meta-item .lbl { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; }
.lms-res-cert-meta-item .val { font-size: 16px; font-weight: 700; color: #1e293b; font-family: 'Poppins', sans-serif; }

.lms-res-cert-btn {
  background: linear-gradient(135deg, #9F1D21, #7a1619) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 14px 32px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  font-family: 'Poppins', sans-serif !important;
  box-shadow: 0 4px 14px rgba(159,29,33,0.35) !important;
  transition: transform .15s, box-shadow .15s !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  text-decoration: none !important;
}
.lms-res-cert-btn:hover { transform: translateY(-2px) !important; box-shadow: 0 8px 20px rgba(159,29,33,0.4) !important; color: #fff !important; }

/* ============================================================
   FAIL (motivational)
   ============================================================ */
.lms-res-fail {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe4e6 100%);
  border: 2px solid #fecdd3;
  border-radius: 20px;
  padding: 40px 36px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
}
.lms-res-fail::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 180px; height: 180px;
  background: rgba(159,29,33,0.05);
  border-radius: 50%;
}
.lms-res-fail::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 140px; height: 140px;
  background: rgba(242,104,44,0.06);
  border-radius: 50%;
}
.lms-res-fail-emoji {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
  animation: lms-bounce .9s infinite alternate;
  position: relative; z-index: 1;
}
@keyframes lms-bounce { from { transform: translateY(0); } to { transform: translateY(-10px); } }
.lms-res-fail-title {
  font-size: 26px;
  font-weight: 800;
  color: #9F1D21;
  margin-bottom: 10px;
  font-family: 'Poppins', sans-serif;
  position: relative; z-index: 1;
}
.lms-res-fail-msg {
  font-size: 16px;
  color: #64748b;
  margin: 0 auto 28px;
  line-height: 1.8;
  max-width: 560px;
  position: relative; z-index: 1;
}
.lms-res-fail-tips {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  position: relative; z-index: 1;
}
.lms-res-fail-tip {
  background: #fff;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 13px;
  color: #475569;
  text-align: left;
  max-width: 180px;
}
.lms-res-fail-tip .tip-ic { font-size: 22px; display: block; margin-bottom: 6px; }
.lms-res-fail-tip strong { display: block; font-weight: 700; color: #1e293b; margin-bottom: 3px; font-size: 13px; }
.lms-res-fail-bar {
  background: #fecdd3;
  border-radius: 100px;
  height: 10px;
  max-width: 400px;
  margin: 0 auto 8px;
  position: relative; z-index: 1;
  overflow: hidden;
}
.lms-res-fail-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #9F1D21, #F2682C);
  border-radius: 100px;
  transition: width 1.2s ease;
}
.lms-res-fail-bar-labels {
  display: flex;
  justify-content: space-between;
  max-width: 400px;
  margin: 0 auto 28px;
  font-size: 11px;
  color: #94a3b8;
  position: relative; z-index: 1;
}
.lms-res-fail-bar-labels span { font-weight: 600; color: #9F1D21; }
.lms-res-retry-btn {
  background: linear-gradient(135deg, #9F1D21, #7a1619) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 14px 36px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  font-family: 'Poppins', sans-serif !important;
  box-shadow: 0 4px 14px rgba(159,29,33,0.35) !important;
  transition: transform .15s, box-shadow .15s !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  text-decoration: none !important;
  position: relative; z-index: 1;
}
.lms-res-retry-btn:hover { transform: translateY(-2px) !important; box-shadow: 0 8px 22px rgba(159,29,33,0.4) !important; color: #fff !important; }
.wc-certificate-wrapper a{
	color:#fff;
}
/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) and (min-width: 641px) {
  .lms-res-hero h2.lms-res-course-title { font-size: 24px; }
  .lms-res-ring-pct { font-size: 32px; }
  .lms-res-hero { padding: 40px 28px; }
}

@media (max-width: 640px) {
  #lms-results-root { margin: 22px auto; padding: 0 14px 40px; }
  .lms-res-hero { padding: 32px 20px; border-radius: 16px; }
  .lms-res-hero h2.lms-res-course-title { font-size: 20px; }
  .lms-res-subtitle { margin-bottom: 26px !important; }
  .lms-res-ring-wrap svg { width: 132px; height: 132px; }
  .lms-res-ring-pct { font-size: 28px; }
  .lms-res-ring-emoji { font-size: 26px; }
  .lms-res-status { font-size: 17px; }
  .lms-res-scoreblock { flex-direction: column; gap: 16px; }
  .lms-res-scoreinfo { text-align: center; }
  .lms-res-username { font-size: 22px; }

  .lms-res-stats { gap: 10px; }       /* keep 3 across on phones */
  .lms-res-stat { padding: 16px 8px; }
  .lms-res-stat-value { font-size: 22px; }
  .lms-res-stat-name { font-size: 11px; }
  .lms-res-stat-icon { width: 36px; height: 36px; font-size: 17px; }

  .lms-res-ans-list { grid-template-columns: 1fr; }
  .lms-res-ans-list li:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid #f1f5f9; }
  .lms-res-ans-name { white-space: normal; }

  .lms-res-cert, .lms-res-fail { padding: 28px 18px; border-radius: 16px; }
  .lms-res-cert-heading { font-size: 21px; }
  .lms-res-cert-meta { gap: 18px; }
  .lms-res-fail-emoji { font-size: 50px; }
  .lms-res-fail-title { font-size: 20px; }
  .lms-res-fail-tips { flex-direction: column; align-items: center; }
  .lms-res-fail-tip { max-width: 100%; width: 100%; }
  .lms-res-cert-btn, .lms-res-retry-btn { width: 100%; justify-content: center; }
}

@media (max-width: 380px) {
  .lms-res-hero h2.lms-res-course-title { font-size: 18px; }
  .lms-res-ring-wrap svg { width: 116px; height: 116px; }
  .lms-res-ring-pct { font-size: 24px; }
  .lms-res-stat-value { font-size: 19px; }
}
