/**
 * Agend Courses (Learning Hub) widget styles.
 * Colour/layout tokens are set as CSS custom properties on the container by the
 * widget's render() output and the frontend script.
 */

.agend-courses-catalogue {
  --agend-lms-heading: #1e2a4a;
  --agend-lms-body: #26304d;
  --agend-lms-accent: #ff6b55;
  --agend-lms-button: #ff6b55;
  --agend-lms-button-text: #ffffff;
  --agend-lms-card-radius: 10px;
  --agend-lms-cols-desktop: 3;
  --agend-lms-cols-tablet: 2;
  --agend-lms-cols-mobile: 1;
  color: var(--agend-lms-body);
  font-family: var(--agend-lms-font-body, inherit);
}

.agend-courses-catalogue h2,
.agend-courses-catalogue h3 {
  font-family: var(--agend-lms-font-heading, inherit);
}

.agend-lms-heading {
  margin-bottom: 1.5rem;
}

.agend-lms-heading__title {
  color: var(--agend-lms-heading);
  margin: 0 0 0.25rem;
}

.agend-lms-heading__subtitle {
  margin: 0;
  opacity: 0.8;
}

.agend-lms-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.agend-lms-search,
.agend-lms-filter {
  padding: 0.6rem 0.85rem;
  border: 1px solid #d7dbe6;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--agend-lms-body);
}

.agend-lms-search {
  flex: 1 1 220px;
  min-width: 180px;
}

.agend-lms-search:focus,
.agend-lms-filter:focus {
  outline: 2px solid var(--agend-lms-accent);
  outline-offset: 1px;
}

.agend-lms-status {
  padding: 2rem 0;
  text-align: center;
  opacity: 0.7;
}

.agend-lms-grid {
  display: grid;
  grid-template-columns: repeat(var(--agend-lms-cols-desktop), minmax(0, 1fr));
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .agend-lms-grid {
    grid-template-columns: repeat(var(--agend-lms-cols-tablet), minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .agend-lms-grid {
    grid-template-columns: repeat(var(--agend-lms-cols-mobile), minmax(0, 1fr));
  }
}

.agend-lms-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #eceef4;
  border-radius: var(--agend-lms-card-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(30, 42, 74, 0.08);
  cursor: pointer;
}

.agend-lms-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #1e2a4a, #26304d);
}

.agend-lms-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.agend-lms-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: capitalize;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  color: #fff;
  background: var(--agend-lms-accent);
}

/* "All Levels" uses a distinct navy treatment vs the graded levels. */
.agend-lms-badge--all_levels {
  background: var(--agend-lms-heading);
}

.agend-lms-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  flex: 1;
}

.agend-lms-card__category {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--agend-lms-accent);
}

.agend-lms-card__title {
  color: var(--agend-lms-heading);
  font-size: 1.1rem;
  margin: 0;
}

.agend-lms-card__desc {
  font-size: 0.9rem;
  opacity: 0.9;
  margin: 0.15rem 0 0;
}

.agend-lms-card__footer {
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1px solid #eceef4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.agend-lms-card__meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.82rem;
  opacity: 0.75;
}

.agend-lms-card__price {
  font-weight: 700;
  color: var(--agend-lms-heading);
}

.agend-lms-card__price.is-free {
  color: var(--agend-lms-accent);
}

.agend-lms-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.agend-lms-page,
.agend-lms-loadmore {
  border: 1px solid #d7dbe6;
  background: #fff;
  color: var(--agend-lms-body);
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
}

.agend-lms-page.is-active {
  background: var(--agend-lms-accent);
  border-color: var(--agend-lms-accent);
  color: #fff;
}

.agend-lms-loadmore {
  background: var(--agend-lms-button);
  border-color: var(--agend-lms-button);
  color: var(--agend-lms-button-text);
  font-weight: 600;
}

/* -- Detail view --------------------------------------------------------- */

.agend-lms-detail__back {
  background: none;
  border: none;
  color: var(--agend-lms-accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 1rem;
  font-size: 0.95rem;
}

.agend-lms-detail__hero {
  position: relative;
  border-radius: var(--agend-lms-card-radius);
  overflow: hidden;
  background: linear-gradient(135deg, #1e2a4a, #26304d);
  background-size: cover;
  background-position: center;
  min-height: 240px;
  display: flex;
  align-items: flex-end;
}

.agend-lms-detail__hero-inner {
  padding: 1.5rem;
  color: #fff;
}

.agend-lms-card__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.agend-lms-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.agend-lms-pill--category {
  background: var(--agend-lms-accent);
  color: #fff;
}

.agend-lms-pill--difficulty {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  text-transform: capitalize;
}

.agend-lms-detail__title {
  color: #fff;
  margin: 0.5rem 0 0.35rem;
  font-size: 1.8rem;
}

.agend-lms-detail__meta {
  opacity: 0.9;
  font-size: 0.95rem;
}

.agend-lms-detail__layout {
  display: grid;
  /*
   * minmax(0, …) so oversized description content cannot expand the main
   * column past its 2fr share and squash the sidebar (see the events and
   * directory detail layouts for the same rule).
   */
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 768px) {
  .agend-lms-detail__layout {
    grid-template-columns: 1fr;
  }
}

.agend-lms-detail__section {
  margin-bottom: 1.5rem;
}

.agend-lms-detail__section-title {
  color: var(--agend-lms-heading);
  margin: 0 0 0.5rem;
}

.agend-lms-detail__body-text {
  line-height: 1.6;
}

.agend-lms-detail__body-text p {
  margin: 0 0 0.85rem;
}

.agend-lms-detail__body-text ul,
.agend-lms-detail__body-text ol {
  margin: 0 0 0.85rem;
  padding-left: 1.25rem;
}

.agend-lms-detail__body-text img {
  max-width: 100%;
  height: auto;
}

.agend-lms-detail__outcomes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .agend-lms-detail__outcomes {
    grid-template-columns: 1fr;
  }
}

.agend-lms-detail__outcome {
  position: relative;
  padding-left: 1.5rem;
}

.agend-lms-detail__outcome::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--agend-lms-accent);
  font-weight: 700;
}

.agend-lms-detail__panel {
  border: 1px solid #eceef4;
  border-radius: var(--agend-lms-card-radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
  background: #fff;
}

.agend-lms-detail__panel--pricing {
  background: var(--agend-lms-heading);
  color: #fff;
  border-color: var(--agend-lms-heading);
}

.agend-lms-detail__panel-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.agend-lms-detail__panel--pricing .agend-lms-detail__panel-title {
  color: #fff;
}

.agend-lms-detail__price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.agend-lms-detail__price-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.agend-lms-detail__cta {
  display: block;
  width: 100%;
  background: var(--agend-lms-button);
  color: var(--agend-lms-button-text);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.agend-lms-detail__note {
  font-size: 0.82rem;
  opacity: 0.85;
  margin: 0.6rem 0 0;
}

.agend-lms-detail__fact {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f0f2f7;
}

.agend-lms-detail__fact:last-child {
  border-bottom: none;
}

.agend-lms-detail__fact-label {
  font-size: 0.8rem;
  opacity: 0.6;
}

.agend-lms-detail__fact-value {
  color: var(--agend-lms-heading);
  font-weight: 600;
  text-align: right;
}

/* -- Enrolment gate ------------------------------------------------------ */

.agend-lms-gate {
  max-width: 480px;
  margin: 1.5rem auto;
  padding: 2rem;
  border: 1px solid #eceef4;
  border-radius: var(--agend-lms-card-radius);
  background: #fff;
  text-align: center;
  box-shadow: 0 1px 3px rgba(30, 42, 74, 0.08);
}

.agend-lms-gate__icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.agend-lms-gate__title {
  color: var(--agend-lms-heading);
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

.agend-lms-gate__price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #f8f9fc;
  margin-bottom: 1rem;
}

.agend-lms-gate__price-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--agend-lms-heading);
}

.agend-lms-gate__price-value.is-free {
  color: var(--agend-lms-accent);
}

.agend-lms-gate__text {
  opacity: 0.85;
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

.agend-lms-gate__cta {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

/* -- Enrolment state (US-LMS.5) ------------------------------------------ */

.agend-lms-detail__panel--enrollment {
  background: #fff;
}

.agend-lms-detail__panel--enrollment.is-completed {
  border-color: rgba(34, 139, 78, 0.35);
}

.agend-lms-enrol__bar {
  height: 0.6rem;
  border-radius: 999px;
  background: #eceef4;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

/* In-progress uses the account accent (Decision 2.13). */
.agend-lms-enrol__bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--agend-lms-accent);
  transition: width 0.4s ease;
}

.agend-lms-enrol__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.88rem;
}

.agend-lms-enrol__pct {
  font-weight: 700;
  color: var(--agend-lms-heading);
}

/* Completed uses the Agend semantic green, deliberately NOT accent-driven
   (Decision 2.13). */
.agend-lms-enrol__completed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agend-lms-enrol__tick {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: #228b4e;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.6rem;
  text-align: center;
  flex: none;
}

.agend-lms-enrol__completed-text {
  line-height: 1.45;
}

/* Delivery-mode pill: frosted translucent treatment (mockup inventory). */
.agend-lms-mode-pill {
  position: absolute;
  bottom: 0.6rem;
  left: 0.6rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.agend-lms-pill--mode {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* -- Loading skeletons ----------------------------------------------------- */

@keyframes agend-skel-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.agend-skel-line,
.agend-skel-block {
  background: #eceef4 linear-gradient(90deg, #eceef4 0px, #f7f8fb 60px, #eceef4 120px) no-repeat -200px 0 / 200px 100%;
  animation: agend-skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

.agend-skel-line {
  height: 0.85rem;
  margin: 0.45rem 0;
}

.agend-lms-skeleton {
  pointer-events: none;
}

.agend-lms-skeleton .agend-lms-card__media {
  background: #eceef4;
}

.agend-lms-detail-skeleton .agend-lms-detail__hero {
  min-height: 240px;
}

.agend-lms-detail-skeleton .agend-lms-detail__panel {
  min-height: 120px;
}

.agend-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -- Grid completed state (member) ---------------------------------------- */

.agend-lms-card__completed {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  background: #228b4e;
}

.agend-lms-card__completed--inline {
  position: static;
  align-self: flex-start;
  margin-bottom: 0.35rem;
}


/* Member enrol CTA error text (SPEC-CORE-20260722 US-2.4). */
.agend-lms-detail__note.is-error {
  color: #c02b2b;
}

/* Card template mode: each card is the template output inside one clickable
   shell; the shell must not restyle the template. */
.agend-lms-grid--templated > .agend-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  position: relative;
}

.agend-lms-filter-slot:empty {
  display: none;
}
