/* =====================================================================
   Single course page – pricing sidebar + sticky mobile enrol bar
   Markup: includes/course-sidebar.php (rendered from templates/course/topc2.php)
   Loaded after css/singleCourse.css so it can override the old sidebar rules.
   ===================================================================== */

.single-course {
  --coa-blue: #0063be;
  --coa-blue-dark: #004f99;
  --coa-blue-soft: #e5f1fc;
  --coa-blue-line: #b8d5f0;
  --coa-navy: #263c55;
  --coa-ink: #1a1b30;
  --coa-muted: #64748b;
  --coa-yellow: #ffc107;
  --coa-line: #e2e8f0;
}

/* Sticky needs every ancestor to be overflow: visible (WPLMS wrappers clip). */
.single-course .global.open,
.single-course .pusher,
.single-course .mfp-iframe-scaler {
  overflow: visible !important;
}

/* ---------- Sidebar column: sticky beside the content ---------- */
@media (min-width: 901px) {
  .cambridge-course-details .side-bar-content {
    position: sticky;
    top: 100px;
    height: auto;
    max-height: none;
    width: 100%;
  }
}

.cambridge-course-details .side-content {
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--coa-line);
  background: #fff;
  box-shadow: 0 10px 30px -14px rgba(26, 27, 48, 0.28);
}

.cambridge-course-details .side-content #item-header-avatar {
  padding: 0;
  margin: 0;
}

.cambridge-course-details .side-content #item-header-avatar a,
.cambridge-course-details .side-content #item-header-avatar img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0;
}

/* ---------- Card body ---------- */
.coa-sb {
  padding: 20px;
  font-family: "Open Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--coa-ink);
}

.coa-sb *,
.coa-mbar * {
  box-sizing: border-box;
}

.coa-ico {
  flex: 0 0 auto;
  vertical-align: middle;
}

/* Price row: £29  £425/ex VAT  93% OFF */
.coa-price {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}

.coa-price__now,
.coa-price__now .woocommerce-Price-amount,
.coa-price__now bdi,
.coa-price__now .woocommerce-Price-currencySymbol {
  font-size: 44px !important;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--coa-ink) !important;
}

.coa-price__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coa-price__meta del,
.coa-price__meta del bdi {
  font-size: 15px;
  font-weight: 600;
  color: var(--coa-muted) !important;
  opacity: 1 !important;
  text-decoration: line-through;
}

.coa-price__meta small {
  font-size: 12px;
  color: var(--coa-muted);
}

.coa-price__off {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--coa-yellow);
  color: var(--coa-ink);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

/* Timer strip + button joined into one block */
.coa-sb__cta {
  margin-top: 18px;
  border-radius: 12px;
  border: 1.5px solid var(--coa-blue);
  overflow: hidden;
  box-shadow: 0 10px 20px -12px rgba(0, 99, 190, 0.6);
}

.coa-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--coa-blue-soft);
  color: var(--coa-blue);
  font-size: 13px;
  font-weight: 600;
}

.coa-cd,
.coa-cd span,
.coa-cd span::after {
  color: var(--coa-ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.coa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 20px;
  background: var(--coa-blue);
  color: #fff !important;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none !important;
  transition: background-color 0.2s ease;
}

.coa-btn:hover,
.coa-btn:focus-visible {
  background: var(--coa-blue-dark);
}

.coa-btn:focus-visible {
  outline: 3px solid var(--coa-yellow);
  outline-offset: 2px;
}

.coa-btn .coa-ico {
  width: 18px;
  height: 18px;
}

/* Logged-in members/enrolled learners: theme's own button, restyled to match. */
.coa-sb__native {
  display: grid;
  margin-top: 18px;
  text-align: center;
}

.coa-sb__native .course_button,
.coa-sb__native a.course_button.full.button,
.coa-sb__native button.course_button {
  width: 100%;
  padding: 14px 20px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: var(--coa-blue) !important;
  color: #fff !important;
  font-size: 17px !important;
  font-weight: 700;
}

.coa-sb__trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--coa-muted);
}

.coa-sb__trust li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
}

.coa-sb__trust .coa-ico {
  width: 14px;
  height: 14px;
  color: var(--coa-blue);
}

.coa-sb__prime {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--coa-line);
  color: var(--coa-navy) !important;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none !important;
}

.coa-sb__prime:hover {
  color: var(--coa-blue) !important;
}

.coa-sb__prime .coa-ico {
  width: 14px;
  height: 14px;
}

/* ---------- Countdown (pure CSS) ----------
   Each unit animates an integer custom property; the PHP-supplied negative
   delay (seconds already elapsed today) puts all three at the right value. */
@property --coa-h { syntax: "<integer>"; inherits: false; initial-value: 0; }
@property --coa-m { syntax: "<integer>"; inherits: false; initial-value: 0; }
@property --coa-s { syntax: "<integer>"; inherits: false; initial-value: 0; }

@keyframes coa-cd-h { from { --coa-h: 23; } to { --coa-h: -1; } }
@keyframes coa-cd-m { from { --coa-m: 59; } to { --coa-m: -1; } }
@keyframes coa-cd-s { from { --coa-s: 59; } to { --coa-s: -1; } }

.coa-cd__h { animation: coa-cd-h 86400s steps(24) infinite; counter-reset: coa-h var(--coa-h); }
.coa-cd__m { animation: coa-cd-m 3600s steps(60) infinite; counter-reset: coa-m var(--coa-m); }
.coa-cd__s { animation: coa-cd-s 60s steps(60) infinite; counter-reset: coa-s var(--coa-s); }

.coa-cd__h,
.coa-cd__m,
.coa-cd__s {
  animation-delay: var(--coa-cd-delay, 0s);
}

.coa-cd__h::after { content: counter(coa-h, decimal-leading-zero); }
.coa-cd__m::after { content: counter(coa-m, decimal-leading-zero); }
.coa-cd__s::after { content: counter(coa-s, decimal-leading-zero); }

/* ---------- Tablet: card goes horizontal (image left, offer right) ---------- */
@media (min-width: 601px) and (max-width: 900px) {
  .cambridge-course-details .side-bar-content {
    max-width: none;
    height: auto;
    max-height: none;
  }

  .cambridge-course-details .side-content {
    display: grid;
    grid-template-columns: 42% 1fr;
    padding: 0;
  }

  .cambridge-course-details .side-content #item-header-avatar,
  .cambridge-course-details .side-content #item-header-avatar a,
  .cambridge-course-details .side-content #item-header-avatar img {
    height: 100%;
    aspect-ratio: auto;
  }
}

@media (max-width: 900px) {
  /* Stacked layout: offer card first (under the title), course content after. */
  .cambridge-course-details .side-bar-content {
    order: 1;
    margin-bottom: 100px;
  }

  .cambridge-course-details .main-content {
    order: 2;
  }

  .cambridge-course-details .side-content {
    padding: 0;
  }
}

/* ---------- Mobile bottom bar ---------- */
.coa-mbar {
  display: none;
}

@media (max-width: 900px) {
  .coa-mbar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* Above the stacked sidebar (z-index 1000 in singleCourse.css); doesn't overlap the nav. */
    z-index: 1001;
    background: #fff;
    border-top: 2px solid var(--coa-blue);
    box-shadow: 0 -8px 24px -12px rgba(26, 27, 48, 0.35);
    font-family: "Open Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--coa-ink);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .coa-mbar .coa-timer {
    padding: 6px 10px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--coa-line);
  }

  .coa-mbar__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
  }

  .coa-mbar .coa-price {
    gap: 8px;
    min-width: 0;
  }

  .coa-mbar .coa-price__now,
  .coa-mbar .coa-price__now .woocommerce-Price-amount,
  .coa-mbar .coa-price__now bdi,
  .coa-mbar .coa-price__now .woocommerce-Price-currencySymbol {
    font-size: 30px !important;
  }

  .coa-mbar .coa-price__meta del,
  .coa-mbar .coa-price__meta del bdi {
    font-size: 13px;
  }

  .coa-mbar .coa-price__meta small {
    font-size: 11px;
  }

  .coa-mbar .coa-price__off {
    margin-left: 0;
    padding: 4px 7px;
    font-size: 11.5px;
  }

  .coa-mbar .coa-btn {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 10px 22px;
    border-radius: 12px;
    font-size: 17px;
    box-shadow: 0 8px 16px -8px rgba(0, 99, 190, 0.6);
  }

  /* The bar replaces the old fixed "Take this course" button from footer-single.php. */
  body:has(.coa-mbar) .s-to-hide-on-large-device-S .addToCart {
    display: none !important;
  }

  /* Keep page end, chat and mini-cart clear of the bar. */
  body:has(.coa-mbar) {
    padding-bottom: 110px;
  }

  body:has(.coa-mbar) div#hubspot-messages-iframe-container {
    margin-bottom: 120px !important;
  }

  body:has(.coa-mbar) .xoo-wsc-basket {
    bottom: 120px !important;
  }
}

/* ---------- No theme mobile nav (Home / Search / Cart / Offers) on course pages ---------- */
/* This file only loads on single course pages (functions.php). */
.single-course #S-Bottom-Navbar-id {
  display: none !important;
}

@media (max-width: 1023px) {
  /* Nothing sits under these any more, so drop the offsets common.css reserved for the nav. */
  .single-course div#hubspot-messages-iframe-container {
    margin-bottom: 0;
  }

  .single-course .xoo-wsc-basket {
    bottom: 20px;
  }
}

@media (max-width: 767px) {
  /* Enrolled learners / members (no enrol bar): their fixed course button sat 51px up for the nav. */
  .single-course .single-course-add-to-cart.addToCart {
    bottom: 0 !important;
  }
}

@media (max-width: 360px) {
  .coa-mbar .coa-price__meta {
    display: none;
  }

  .coa-mbar .coa-btn {
    padding: 10px 16px;
  }
}
