/* ==========================================================================
   PUBLIC COURSES PAGE
   Extends the landing page design language into the courses library
   ========================================================================== */

body:has(.pc-layout) {
  background: var(--sl-cream);
}

.pc-layout {
  font-family: var(--font-sans);
}

/* --------------------------------------------------------------------------
   Hero / Header
   -------------------------------------------------------------------------- */
.pc-hero {
  padding: clamp(3rem, 5vw, 5rem) 0 clamp(2rem, 3vw, 3rem);
  position: relative;
  overflow: hidden;
}

.pc-hero::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -15%;
  width: 50%;
  height: 220%;
  background: var(--sl-teal-light);
  border-radius: 50%;
  opacity: 0.45;
  pointer-events: none;
}

.pc-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.pc-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sl-teal);
  font-weight: 500;
  margin-bottom: 1rem;
  opacity: 0;
  animation: pc-fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.05s forwards;
}

.pc-headline {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.15;
  color: var(--sl-charcoal);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  opacity: 0;
  animation: pc-fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.15s forwards;
}

.pc-headline em {
  font-style: italic;
  color: var(--sl-teal);
}

.pc-subhead {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--sl-gray);
  font-weight: 300;
  max-width: 42ch;
  margin-bottom: 0;
  opacity: 0;
  animation: pc-fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.25s forwards;
}

@keyframes pc-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Search Bar
   -------------------------------------------------------------------------- */
.pc-search {
  padding: 0 0 clamp(1.5rem, 3vw, 2.5rem);
  position: relative;
  z-index: 2;
}

.pc-search-bar {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-full);
  padding: 0.375rem 0.375rem 0.375rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
  gap: 0.5rem;
}

.pc-search-bar:focus-within {
  box-shadow: var(--shadow-md);
  border-color: rgba(1, 129, 141, 0.2);
}

.pc-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.9375rem;
  color: var(--sl-charcoal);
  font-family: var(--font-sans);
  outline: none;
  padding: 0.625rem 0;
  min-width: 0;
}

.pc-search-input::placeholder {
  color: var(--sl-gray);
  opacity: 0.6;
}

.pc-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--sl-teal) 0%, var(--sl-teal-dark) 100%);
  color: white;
  font-size: 0.9375rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 8px rgba(1, 129, 141, 0.25);
}

.pc-search-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(1, 129, 141, 0.35);
}

/* Pill Filters */
.pc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pc-filter-pill {
  position: relative;
}

.pc-filter-pill input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.pc-filter-pill label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  background: white;
  color: var(--sl-gray);
  user-select: none;
}

.pc-filter-pill label::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

/* Color-coded dots for each level */
.pc-filter-pill--intro label::before { background: var(--sl-teal); opacity: 0.3; }
.pc-filter-pill--middle label::before { background: var(--sl-coral); opacity: 0.3; }
.pc-filter-pill--advanced label::before { background: #7B1FA2; opacity: 0.3; }

.pc-filter-pill input:checked + label {
  background: var(--sl-charcoal);
  color: white;
  border-color: var(--sl-charcoal);
  box-shadow: 0 2px 8px rgba(26, 26, 26, 0.15);
}

.pc-filter-pill input:checked + label::before {
  opacity: 1;
  background: white;
}

.pc-filter-pill label:hover {
  border-color: rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.pc-filter-pill input:checked + label:hover {
  background: var(--sl-charcoal);
  border-color: var(--sl-charcoal);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Course Grid
   -------------------------------------------------------------------------- */
.pc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding-bottom: var(--space-lg);
}

.pc-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.pc-empty-icon {
  font-size: 3rem;
  color: var(--sl-teal-light);
  margin-bottom: 1rem;
}

.pc-empty-text {
  font-size: 1.125rem;
  color: var(--sl-gray);
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   Course Card
   -------------------------------------------------------------------------- */
.pc-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pc-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}

/* Thumbnail */
.pc-card-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--sl-gray-light);
}

.pc-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pc-card:hover .pc-card-thumb img {
  transform: scale(1.04);
}

.pc-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--sl-teal);
  opacity: 0.3;
}

/* Badge */
.pc-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.3125rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pc-badge--introductory {
  background: rgba(1, 129, 141, 0.12);
  color: var(--sl-teal-dark);
  border: 1px solid rgba(1, 129, 141, 0.15);
}

.pc-badge--middle {
  background: rgba(224, 122, 95, 0.12);
  color: var(--sl-coral-dark);
  border: 1px solid rgba(224, 122, 95, 0.15);
}

.pc-badge--advanced {
  background: rgba(123, 31, 162, 0.1);
  color: #6A1B9A;
  border: 1px solid rgba(123, 31, 162, 0.15);
}

/* Card Body */
.pc-card-body {
  padding: 1.25rem 1.25rem 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pc-card-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--sl-charcoal);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pc-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.pc-card-title a:hover {
  color: var(--sl-teal);
}

.pc-card-desc {
  font-size: 0.8125rem;
  color: var(--sl-gray);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0;
  flex: 1;
}

/* Card Footer */
.pc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  margin-top: auto;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.pc-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--sl-gray);
}

.pc-card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
}

.pc-card-meta-item i {
  font-size: 0.8125rem;
  opacity: 0.6;
}

.pc-card-admin {
  display: flex;
  align-items: center;
}

.pc-card-admin a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--sl-gray);
  transition: all var(--transition-fast);
}

.pc-card-admin a:hover {
  background: var(--sl-teal-light);
  color: var(--sl-teal);
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pc-pagination {
  display: flex;
  justify-content: center;
  padding: var(--space-lg) 0 var(--space-xl);
}

.pc-pagination .pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pc-pagination .page-item .page-link,
.pc-pagination .pagination a,
.pc-pagination .pagination span.page,
.pc-pagination .pagination span.current,
.pc-pagination .pagination em {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sl-gray);
  text-decoration: none;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  background: transparent;
}

.pc-pagination .pagination a:hover,
.pc-pagination .page-item:not(.active):not(.disabled) .page-link:hover {
  background: white;
  color: var(--sl-teal);
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-sm);
}

.pc-pagination .pagination span.current,
.pc-pagination .pagination em.current,
.pc-pagination .page-item.active .page-link {
  background: var(--sl-charcoal);
  color: white;
  border-color: var(--sl-charcoal);
  font-weight: 600;
}

.pc-pagination .pagination .first a,
.pc-pagination .pagination .prev a,
.pc-pagination .pagination .next a,
.pc-pagination .pagination .last a {
  font-size: 0.8125rem;
  color: var(--sl-gray);
}

.pc-pagination .pagination .disabled,
.pc-pagination .pagination .gap {
  opacity: 0.4;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .pc-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .pc-hero::before {
    width: 70%;
    top: -40%;
    right: -20%;
  }
}

@media (max-width: 575px) {
  .pc-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .pc-search-bar {
    padding-left: 1rem;
  }

  .pc-hero::before {
    display: none;
  }

  .pc-card-thumb {
    aspect-ratio: 16 / 9;
  }
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .pc-eyebrow,
  .pc-headline,
  .pc-subhead {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .pc-card,
  .pc-search-btn,
  .pc-filter-pill label {
    transition: none;
  }

  .pc-card:hover {
    transform: none;
  }

  .pc-card:hover .pc-card-thumb img {
    transform: none;
  }
}
