/* ==================================================
   PECB Course Profile: one training course in full (markup: includes/widgets/courses/class-course-profile.php).
   Main column: back link, field + level, name, description / intro, languages, the text sections.
   Sidebar (sticky): course facts, upcoming training sessions (enrol buttons), call-to-action box.
   Below: related course cards (course-card.css).

   Settings (the widget's Style controls set these on the widget):
     --pecb-cp-sidebar, --pecb-cp-gap, --pecb-cp-panel-bg, --pecb-cp-border, --pecb-cp-radius, --pecb-cp-accent,
     --pecb-cp-level-bg / -color, --pecb-cp-cta-bg / -color
================================================== */
.pecb-course-profile {
  --pecb-cp-sidebar: 360px;
  --pecb-cp-gap: 48px;
  --pecb-cp-sticky-top: 100px;
  --pecb-cp-ease: cubic-bezier(.2, .8, .2, 1);
  color: #334155;
}
/* The two columns are a grid of their own: a sticky item is constrained by its grid container, so the
   related section must sit outside it (otherwise the sidebar slides down over the related cards) */
.pecb-course-profile__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--pecb-cp-sidebar);
  gap: var(--pecb-cp-gap);
  align-items: start;
}
.pecb-course-profile--no-side .pecb-course-profile__layout {
  grid-template-columns: minmax(0, 1fr);
}
.pecb-course-profile__main {
  min-width: 0;
}
.pecb-course-profile__side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.pecb-sticky-side-yes .pecb-course-profile__side {
  position: sticky;
  top: var(--pecb-cp-sticky-top);
}

/* ---- Header ---- */
.elementor-widget .pecb-course-profile__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #475569;
  text-decoration: none;
  transition: color 200ms var(--pecb-cp-ease);
}
.elementor-widget .pecb-course-profile__back:hover,
.elementor-widget .pecb-course-profile__back:focus-visible {
  color: #0f172a;
}
.pecb-course-profile__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 16px;
}
.elementor-widget .pecb-course-profile__field {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--pecb-cp-accent, #a11e29);
}
.pecb-course-profile__level {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--pecb-cp-level-bg, #f1f5f9);
  color: var(--pecb-cp-level-color, #334155);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}
.elementor-widget .pecb-course-profile__title {
  margin: 0;
  font-size: clamp(32px, 3.4vw, 44px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: #0f172a;
}
.elementor-widget .pecb-course-profile__intro {
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.65;
  color: #475569;
}
.pecb-course-profile__intro p {
  margin: 0 0 1em;
}
.pecb-course-profile__intro p:last-child {
  margin-bottom: 0;
}
.elementor-widget .pecb-course-profile__languages {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: #64748b;
}
.pecb-course-profile__languages svg {
  flex: 0 0 auto;
}

/* ---- Sections ---- */
.pecb-course-profile__section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--pecb-cp-border, #e2e8f0);
}
.elementor-widget .pecb-course-profile__section-heading {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: #0f172a;
}
.elementor-widget .pecb-course-profile__section-text {
  font-size: 17px;
  line-height: 1.75;
  color: #475569;
}
.pecb-course-profile__section-text > :first-child {
  margin-top: 0;
}
.pecb-course-profile__section-text > :last-child {
  margin-bottom: 0;
}
.pecb-course-profile__section-text ul,
.pecb-course-profile__section-text ol {
  padding-left: 1.25em;
}
.pecb-course-profile__section-text li {
  margin-bottom: .4em;
}

/* ---- Sidebar panels ---- */
.pecb-course-profile__panel {
  box-sizing: border-box;
  padding: 24px 26px;
  border: 1px solid var(--pecb-cp-border, #e2e8f0);
  border-radius: var(--pecb-cp-radius, 14px);
  background: var(--pecb-cp-panel-bg, #fff);
}
.elementor-widget .pecb-course-profile__panel-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: #0f172a;
}
.pecb-course-profile .pecb-course-profile__facts {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
.pecb-course-profile .pecb-course-profile__fact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--pecb-cp-border, #e2e8f0);
  font-size: 14.5px;
  line-height: 1.45;
}
.pecb-course-profile .pecb-course-profile__fact:first-child {
  border-top: 0;
  padding-top: 0;
}
.pecb-course-profile .pecb-course-profile__fact:last-child {
  padding-bottom: 0;
}
.pecb-course-profile .pecb-course-profile__fact dt {
  margin: 0;
  font-weight: 600;
  color: #64748b;
}
.pecb-course-profile .pecb-course-profile__fact dd {
  margin: 0;
  color: #0f172a;
}
.pecb-course-profile .pecb-course-profile__fact dd:only-child {
  grid-column: 1 / -1;
}

/* Upcoming training sessions (events from the API), each with an enrol button */
.pecb-course-profile .pecb-course-profile__sessions {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* One session is a small two-column grid:
     date ................ format pill
     place · language · partner ..... Enroll (small button) */
.pecb-course-profile .pecb-course-profile__session {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 6px;
  align-items: center;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--pecb-cp-border, #e2e8f0);
}
.pecb-course-profile .pecb-course-profile__session:first-child {
  padding-top: 0;
  border-top: 0;
}
.pecb-course-profile .pecb-course-profile__session:last-child {
  padding-bottom: 0;
}
/* The head wrapper does not take part in the layout; the date and the pill are placed on the grid */
.pecb-course-profile__session-head {
  display: contents;
}
.elementor-widget .pecb-course-profile__session-date {
  grid-column: 1;
  grid-row: 1;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
}
.pecb-course-profile__session-format {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pecb-cp-level-bg, #f1f5f9);
  color: var(--pecb-cp-level-color, #334155);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.elementor-widget .pecb-course-profile__session-meta {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 13.5px;
  line-height: 1.5;
  color: #64748b;
}
/* A small secondary (outlined) PECB button, on its own row under the details */
.elementor-widget .pecb-course-profile__session .pecb-button {
  grid-column: 1 / -1;
  grid-row: 3;
  justify-self: start;
  height: 32px;
  margin: 4px 0 0;
  padding: 0 12px 0 36px;
  font-size: 13px;
  font-weight: 500;
  --pecb-button-icon-color: var(--pecb-cp-accent, #a11e29);
}
.elementor-widget .pecb-course-profile__session .pecb-button:is(:hover, :focus-visible) {
  --pecb-button-border: #0f172a;
  --pecb-button-icon-bg: var(--pecb-cp-accent, #a11e29);
  --pecb-button-icon-color: #fff;
}
.elementor-widget .pecb-course-profile__session .pecb-button:hover,
.elementor-widget .pecb-course-profile__session .pecb-button:focus-visible {
  padding: 0 36px 0 12px;
}
.pecb-course-profile__session .pecb-button__icon {
  left: 5px;
  width: 22px;
  height: 22px;
}
.pecb-course-profile__session .pecb-button__icon svg {
  width: 12px;
  height: 12px;
}
.pecb-course-profile__session .pecb-button:hover .pecb-button__icon,
.pecb-course-profile__session .pecb-button:focus-visible .pecb-button__icon {
  left: calc(100% - 27px);
}
/* No button: the details may use the whole width */
.pecb-course-profile .pecb-course-profile__session:not(:has(.pecb-button)) .pecb-course-profile__session-meta {
  grid-column: 1 / -1;
}
.elementor-widget .pecb-course-profile__sessions-empty {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: #64748b;
}
.elementor-widget .pecb-course-profile__sessions-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
  transition: color 200ms var(--pecb-cp-ease);
}
.elementor-widget .pecb-course-profile__sessions-more:hover,
.elementor-widget .pecb-course-profile__sessions-more:focus-visible {
  color: var(--pecb-cp-accent, #a11e29);
}

/* Call to action */
.pecb-course-profile__cta {
  background: var(--pecb-cp-cta-bg, #0f172a);
  border-color: var(--pecb-cp-cta-bg, #0f172a);
  color: var(--pecb-cp-cta-color, #fff);
}
.elementor-widget .pecb-course-profile__cta-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: inherit;
}
.elementor-widget .pecb-course-profile__cta-text {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: inherit;
  opacity: .8;
}
.pecb-course-profile__cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.pecb-course-profile__cta-buttons .pecb-button {
  justify-content: center;
}
.pecb-course-profile__cta .pecb-button--outline {
  border-color: rgba(255, 255, 255, .35);
  color: inherit;
}
.pecb-course-profile__cta .pecb-button--outline:hover,
.pecb-course-profile__cta .pecb-button--outline:focus-visible {
  border-color: currentColor;
}

/* ---- Related ---- */
.pecb-course-profile__related {
  margin-top: 56px;
}
.pecb-course-profile__related-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 18px;
}
.elementor-widget .pecb-course-profile__related-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: #0f172a;
}
.elementor-widget .pecb-course-profile__explore {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
  transition: color 200ms var(--pecb-cp-ease);
}
.elementor-widget .pecb-course-profile__explore:hover {
  color: var(--pecb-cp-accent, #a11e29);
}
.pecb-course-profile .pecb-course-profile__related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---- Not found + editor notice ---- */
.pecb-course-profile--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 64px 24px;
  border: 1px dashed #e2e8f0;
  border-radius: 14px;
  text-align: center;
}
.elementor-widget .pecb-course-profile__empty-text {
  margin: 0;
  font-size: 17px;
  color: #475569;
}
.pecb-course-profile--empty .pecb-course-profile__back {
  margin-bottom: 0;
}
.pecb-course-profile__notice {
  margin-bottom: 16px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  font-size: 14px;
  text-align: center;
  color: #475569;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .pecb-course-profile {
    --pecb-cp-gap: 32px;
  }
  .pecb-course-profile__layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .pecb-sticky-side-yes .pecb-course-profile__side {
    position: static;
  }
  .pecb-course-profile .pecb-course-profile__related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 767px) {
  .pecb-course-profile__panel {
    padding: 20px 18px;
  }
  .elementor-widget .pecb-course-profile__intro {
    font-size: 16.5px;
  }
  .elementor-widget .pecb-course-profile__section-heading {
    font-size: 22px;
  }
  .elementor-widget .pecb-course-profile__section-text {
    font-size: 16px;
  }
  .pecb-course-profile .pecb-course-profile__related-grid {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .elementor-widget .pecb-course-profile__back,
  .elementor-widget .pecb-course-profile__sessions-more,
  .elementor-widget .pecb-course-profile__explore { transition: none; }
}
