/* ============================================================
   Materials Plugin — Frontend Styles
   Pixel-perfect values captured via getComputedStyle() from
   the reference design at readdy.cc/preview/…/solutions
   Captured: 2026-03-04
   ============================================================ */

/* ── Material archive (CPT archive / single) ──────────────── */
.material-archive {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin: 24px 0;
}

.material-archive .material-item {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
  background: #fff;
}

.material-archive .material-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.material-archive .material-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.material-archive .material-item .material-content {
  padding: 20px;
}

.material-archive .material-item h2 {
  font-size: 1.25rem;
  margin: 0 0 8px;
}

.material-archive .material-item .material-meta {
  font-size: 0.875rem;
  color: #666;
}

.material-link {
  display: inline-block;
  padding: 10px 20px;
  background: rgb(234, 88, 12);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  margin-top: 12px;
  font-weight: 600;
  transition: background 0.2s ease;
}

.material-link:hover {
  background: rgb(194, 65, 12);
  color: #fff;
}

/* ── Curriculum list section wrapper ──────────────────────── */
/* Reference: section.py-20.bg-white → padding: 80px 0        */
.materials-curriculum-list {
  font-family: ui-sans-serif, system-ui, sans-serif;
  width: 100%;
  padding-top: 80px;
  padding-bottom: 80px;
  background-color: rgb(255, 255, 255);
}

/* ── Filter bar — pill buttons ────────────────────────────── */
/* Reference: .flex.flex-wrap.gap-2 → gap: 8px, mb: 24px      */
.curriculum-widget-filter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  padding: 16px 0;
}

.materials-widget-filter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 0;
}

/* Reference inactive button: transparent bg, gray-600 text, no border */
.curriculum-widget-filter-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 24px;
  border-radius: 9999px;
  background: transparent;
  color: rgb(75, 85, 99);
  font-size: 16px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition:
    background 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  line-height: 1.5;
}

/* Reference active: orange-600 bg, white text, shadow-lg */
.curriculum-widget-filter-btn.is-active {
  background-color: rgb(234, 88, 12);
  color: rgb(255, 255, 255);
  box-shadow:
    rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,
    rgba(0, 0, 0, 0.1) 0px 4px 6px -4px;
}

.curriculum-widget-filter-btn:hover:not(.is-active) {
  background-color: rgb(234, 88, 12);
  color: rgb(255, 255, 255);
}

/* ── Curriculum grid ──────────────────────────────────────── */
/* Reference: .grid.lg:grid-cols-3.gap-8 → 3 cols, gap 32px   */
.curriculum-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

/* ── Curriculum card ──────────────────────────────────────── */
/* Reference: .bg-white.rounded-2xl.overflow-hidden.shadow-lg  */
/*            .border-t-4.border-orange-600                     */
.curriculum-card {
  background-color: rgb(255, 255, 255);
  border-radius: 16px;
  box-shadow:
    rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,
    rgba(0, 0, 0, 0.1) 0px 4px 6px -4px;
  overflow: hidden;
  border-top: 4px solid rgb(234, 88, 12);
  display: flex;
  flex-direction: column;
  transition:
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

/* Reference hover: shadow-2xl + -translate-y-2 */
.curriculum-card:hover {
  box-shadow: rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;
  transform: translateY(-8px);
}

/* ── Card show / hide animation ──────────────────────────── */
/* Visible default: fully opaque, normal scale                */
.curriculum-card {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

/* Step 1: fading out (JS adds this first) */
.curriculum-card.is-hiding {
  opacity: 0;
  transform: translateY(8px) scale(0.95);
  pointer-events: none;
}

/* Step 2: fully hidden (JS adds after transition ends) */
.curriculum-card.is-hidden {
  display: none;
}

/* ── Card image wrap ──────────────────────────────────────── */
/* Reference: .relative.h-48.w-full.overflow-hidden → 192px   */
.curriculum-card__image-wrap {
  display: block;
  height: 192px;
  width: 100%;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

/* Reference: .w-full.h-full.object-cover */
.curriculum-card__image {
  width: 100%;
  height: 192px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.curriculum-card:hover .curriculum-card__image {
  transform: scale(1.05);
}

.curriculum-card__image--placeholder {
  width: 100%;
  height: 192px;
  background: linear-gradient(135deg, #e8eaf0 0%, #d1d5db 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.curriculum-card__image--placeholder::after {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3E%3Cpath fill='%239ca3af' d='M4 5a2 2 0 0 1 2-2h8l4 4v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5z'/%3E%3C/svg%3E")
    center/contain no-repeat;
  opacity: 0.5;
}

/* ── Card body ────────────────────────────────────────────── */
/* Reference: .p-8 → padding: 32px all sides                  */
.curriculum-card__body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ── Card title ───────────────────────────────────────────── */
/* Reference: .text-xl.font-bold.text-blue-950.mb-3           */
/*            font-size:20px, weight:700, color:rgb(23,37,84)  */
.curriculum-card__title {
  font-size: 20px;
  font-weight: 700;
  color: rgb(23, 37, 84);
  line-height: 28px;
  margin: 0 0 12px;
}

.curriculum-card__title a {
  color: inherit;
  text-decoration: none;
}

.curriculum-card__title a:hover {
  color: rgb(234, 88, 12);
}

/* ── Card description ─────────────────────────────────────── */
/* Reference: .text-gray-600.text-sm.mb-4.leading-relaxed      */
/*            font-size:14px, color:rgb(75,85,99), lh:22.75px  */
.curriculum-card__description {
  font-size: 14px;
  color: rgb(75, 85, 99);
  line-height: 22.75px;
  margin: 0 0 16px;
}

/* ── Publishers ───────────────────────────────────────────── */
/* Reference: wrapper .mb-4, label .text-xs.text-gray-500.mb-2 */
/*            value .text-sm.text-gray-700.font-medium          */
.curriculum-card__publishers {
  margin-bottom: 8px;
}

.curriculum-card__publishers-label {
  display: block;
  font-size: 12px;
  color: rgb(107, 114, 128);
  font-weight: 400;
  margin: 0 0 4px;
}

.curriculum-card__publishers-value {
  display: block;
  font-size: 14px;
  color: rgb(55, 65, 81);
  font-weight: 500;
  margin: 0 0 16px;
}

/* ── Level badge pills ────────────────────────────────────── */
/* Reference: .flex.flex-wrap.gap-2.mb-6 → gap:8px, mb:24px   */
/* Badge: .px-3.py-1.bg-orange-50.text-orange-600.text-xs.font-medium.rounded-full */
.curriculum-card__levels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.curriculum-card__level-badge {
  display: inline-block;
  padding: 4px 12px;
  background-color: rgb(255, 247, 237);
  color: rgb(234, 88, 12);
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
  line-height: 16px;
  border: none;
}

/* ── Action buttons ───────────────────────────────────────── */
/* Reference: .flex.flex-col.gap-3 → column, gap:12px          */
/* Primary:   .bg-orange-600.text-white.rounded-xl.px-6.py-3   */
/* Outline:   .bg-white.text-orange-600.border-2.border-orange-600.rounded-xl */
.curriculum-card__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

.curriculum-card__btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1.5;
}

/* Reference: background-color:rgb(234,88,12); color:rgb(255,255,255); border:none */
.curriculum-card__btn--primary {
  background-color: rgb(234, 88, 12);
  color: rgb(255, 255, 255);
  border: 2px solid rgb(234, 88, 12);
}

.curriculum-card__btn--primary:hover {
  background-color: rgb(194, 65, 12);
  border-color: rgb(194, 65, 12);
  color: rgb(255, 255, 255);
}

/* Reference: bg:rgb(255,255,255); color:rgb(234,88,12); border:2px solid rgb(234,88,12) */
.curriculum-card__btn--outline {
  background-color: rgb(255, 255, 255);
  color: rgb(234, 88, 12);
  border: 2px solid rgb(234, 88, 12);
}

.curriculum-card__btn--outline:hover {
  background-color: rgb(234, 88, 12);
  color: rgb(255, 255, 255);
  border-color: rgb(234, 88, 12);
}

.curriculum-card__btn--outline-blue {
  background-color: #fff;
  color: #172554;
  border: 2px solid #172554;
}
.curriculum-card__btn--outline-blue:hover {
  background-color: #172554;
  color: #fff;
  border: 2px solid #172554;
}


/* ── Empty / loading states ───────────────────────────────── */
.no-curricula {
  grid-column: 1 / -1;
  text-align: center;
  color: #9ca3af;
  padding: 48px 32px;
  font-size: 1rem;
}

/* ── Responsive ───────────────────────────────────────────── */

/* md: 2 columns */
@media (max-width: 1024px) {
  .curriculum-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* sm: 2 columns on mobile (override inline styles) */
@media (max-width: 640px) {
  .curriculum-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  .materials-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  .curriculum-grid,
  .materials-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .curriculum-card__image-wrap,
  .curriculum-card__image,
  .curriculum-card__image--placeholder {
    height: 150px;
  }

  .curriculum-card__body {
    padding: 16px;
  }

  .curriculum-card__actions {
    flex-direction: column;
    gap: 8px;
  }

  .curriculum-card__btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* ── Materials List Widget ─────────────────────────────────────── */

.materials-list-widget {
  font-family: ui-sans-serif, system-ui, sans-serif;
  width: 100%;
  padding-top: 40px;
  padding-bottom: 40px;
  background-color: rgb(255, 255, 255);
}

.materials-filters {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  /* NEW: Sticky behavior */
  /* position: sticky; */
  top: 0;
  z-index: 100;
  background-color: rgb(255, 255, 255);
  padding: 16px 0;
}

.materials-filter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Materials widget inner filter bar (used for subject and level filter rows) */
.materials-widget-filter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Filter button icon and text */
.materials-widget-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 24px;
  border-radius: 9999px;
  background: transparent;
  color: rgb(75, 85, 99);
  font-size: 16px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition:
    background 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  line-height: 1.5;
}

.materials-widget-filter-btn.is-active {
  background-color: rgb(234, 88, 12);
  color: rgb(255, 255, 255);
  box-shadow:
    rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,
    rgba(0, 0, 0, 0.1) 0px 4px 6px -4px;
}

.materials-widget-filter-btn:hover:not(.is-active) {
  background-color: rgb(234, 88, 12);
  color: rgb(255, 255, 255);
}

.filter-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.filter-btn-icon.dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.filter-btn-text {
  white-space: nowrap;
}

.level-filter-bar .filter-label {
  font-size: 14px;
  font-weight: 500;
  color: rgb(75, 85, 99);
  margin-right: 8px;
}

/* Subject badge (dark blue background) */
.material-card__subject-badge {
  display: inline-block;
  padding: 4px 12px;
  background-color: rgb(23, 37, 84);
  color: rgb(255, 255, 255);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Series text (uppercase, small) */
.material-card__series {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: rgb(107, 114, 128);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

/* Feature badges (green with checkmark) */
.material-card__features {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.material-card__feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.material-card__feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: rgb(220, 252, 231);
  flex-shrink: 0;
}

.material-card__feature-icon svg {
  color: rgb(22, 163, 74);
}

.material-card__feature-text {
  font-size: 14px;
  font-weight: 500;
  color: rgb(55, 65, 81);
}

/* Materials grid (same as curriculum-grid) */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

/* Responsive grid */
@media (max-width: 1024px) {
  .materials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .materials-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Mobile card adjustments */
  .material-card,
  .curriculum-card {
    max-width: 100%;
  }

  .curriculum-card__image-wrap,
  .curriculum-card__image,
  .curriculum-card__image--placeholder {
    height: 150px;
  }

  .curriculum-card__body,
  .material-card .curriculum-card__body {
    padding: 16px;
  }

  /* Stack buttons on mobile */
  .curriculum-card__actions {
    flex-direction: column;
    gap: 8px;
  }

  .curriculum-card__btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Filter bar mobile */
  .materials-filters {
    gap: 12px;
  }

  .materials-filter-bar {
    gap: 6px;
  }

  .curriculum-filter-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .level-filter-bar .filter-label {
    width: 100%;
    text-align: center;
    margin-right: 0;
    margin-bottom: 4px;
  }

  /* Feature text on mobile */
  .material-card__feature-text {
    font-size: 13px;
  }

  /* Series text on mobile */
  .material-card__series {
    font-size: 10px;
  }

  /* Title on mobile */
  .curriculum-card__title {
    font-size: 18px;
    line-height: 1.3;
  }

  /* Description on mobile */
  .curriculum-card__description {
    font-size: 13px;
    line-height: 1.5;
  }

  /* Level badges on mobile */
  .curriculum-card__levels {
    gap: 6px;
  }

  .curriculum-card__level-badge {
    padding: 3px 8px;
    font-size: 11px;
  }
}

/* ── Load More ───────────────────────────────────────────────────────────── */

.materials-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 32px 0 0;
}

.materials-load-more-btn {
    background-color: rgb(234, 88, 12);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 32px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s;
}

.materials-load-more-btn:hover {
    background-color: rgb(205, 77, 10);
    transform: translateY(-2px);
}

.materials-load-more-btn:active {
    transform: translateY(0);
}

.materials-load-more-btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ── Materials Widget: Truncated Description ─────────────────────── */

.material-card__description {
  font-size: 14px;
  color: rgb(75, 85, 99);
  line-height: 22.75px;
  margin: 0 0 16px;
  overflow: visible;
}

.material-card__description-text{
  /* white-space-collapse: preserve; */
  white-space: pre-line;
}

/* Truncated state — clamp to ~3 lines visually (uses data-truncated="true" attribute) */
/* NOTE: does NOT apply to .is-expanded cards — expanded state uses .description-full with no clamping */
.material-card:not(.is-expanded) .material-card__description[data-truncated="true"] .material-card__description-text {
  overflow: hidden;
  display: -webkit-box;
  line-height: 1.6;
  /* -webkit-line-clamp: 3; */
  /* -webkit-box-orient: vertical; */
  /* max-height: 5.0em; ~3 lines */
}
.material-card:not(.is-expanded) .material-card__description[data-truncated="true"] .material-card__description-text.material-card__description-full {
height:1px;
}

/* Read More / Show Less toggle links */
.material-card__read-more,
.material-card__read-less {
  display: inline;
  color: rgb(234, 88, 12);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  margin-left: 4px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  transition: color 0.15s ease;
}

.material-card__read-more:hover,
.material-card__read-less:hover {
  color: rgb(194, 65, 12);
  text-decoration: underline;
}

/* Hidden by default — shown via .is-expanded rule below */
.material-card__read-less {
  display: none;
}

/* Hidden by default — shown via .is-expanded */
.material-card__description[data-truncated="true"] .material-card__description-full {
  visibility: hidden;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: none;
}

/* Expanded state — show full text + Show Less, hide Read More + short text */
.material-card.is-expanded > .curriculum-card__body > .material-card__description[data-truncated="true"] .material-card__description-short {
  display: none;
}

.material-card.is-expanded > .curriculum-card__body > .material-card__description[data-truncated="true"] .material-card__description-full {
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: vertical;
  overflow: visible;
  max-height: none;
}

.material-card.is-expanded > .curriculum-card__body > .material-card__description[data-truncated="true"] .material-card__description-full {
  visibility: visible;
  opacity: 1;
  max-height: none;
  overflow: visible;
}

.material-card.is-expanded .material-card__read-more {
  display: none;
}

.material-card.is-expanded .material-card__read-less {
  display: inline;
}

/* Normal (non-truncated) description — no clamping */
.material-card__description[data-truncated="false"] .material-card__description-text {
  display: block;
  -webkit-line-clamp: unset;
  max-height: none;
  overflow: visible;
}

/* ── Sticky scroll indicator shadow ─────────────────────── */
.curriculum-widget-filter-bar.is-sticky,
.materials-widget-filter-bar.is-sticky,
.materials-filters.is-sticky {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
