* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #fff;
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 0;
}

/* ==========================================
      RESPONSIVE FILTER PANEL LAYOUT
      ========================================== */
.filter-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  background: #f4f4f7;
  padding: 16px;
  border-radius: 12px;
}

.filter-panel h3 {
  font-size: 1rem;
  color: #333;
}

.filter-controls-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #555;
  letter-spacing: 0.05em;
}

.filter-group select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #fff;
  color: #222;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding-top: 4px;
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s ease;
  border-radius: 34px;
}

.slider::before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.2s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

input:checked + .slider {
  background-color: #d97706;
}

input:checked + .slider::before {
  transform: translateX(22px);
}

@media (min-width: 600px) {
  .filter-controls-wrap {
    flex-direction: row;
  }

  .filter-group {
    width: calc(50% - 8px);
  }
}

@media (min-width: 900px) {
  .filter-panel {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .filter-controls-wrap {
    width: auto;
    flex-grow: 1;
    max-width: 600px;
  }

  .toggle-group {
    width: auto;
    padding-top: 20px;
    margin-left: auto;
  }
}

/* ==========================================
      GRID AND METADATA CARD LAYOUTS
      ========================================== */
.video-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

@media (min-width: 600px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.video-grid a {
  text-decoration: none;
  color: inherit;
  display: block;
  width: 100%;
  height: 100%;
}

.video-card {
  background: #f4f4f7;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.video-grid a:hover .video-card {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.thumbnail-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background-color: #000;
  flex-shrink: 0;
  overflow: hidden;
}

.thumbnail-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  width: 100%;
  min-width: 0;
}

.video-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: #222;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

/* FIXED STABILIZATION: margin-top: auto cleanly forces this container to sit at the bottom */
.video-meta-details {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
  margin-top: auto;
  list-style: none;
  padding: 4px 0 0; /* Adding a subtle top padding here balances the title clearance perfectly on all card types */
  width: 100%;
}

.video-preacher {
  font-size: 0.85rem;
  font-weight: 500;
  color: #555;
  display: inline-flex;
  align-items: center;
  list-style-type: none;
}

.video-worship-type {
  font-size: 0.85rem;
  font-weight: 500;
  color: #555;
  display: inline-flex;
  align-items: center;
  list-style-type: none;
}

.video-preacher::before {
  content: '🎙️ ';
  margin-right: 4px;
  font-size: 0.9rem;
}

.video-preacher span {
  white-space: nowrap;
}

.video-preacher span:not(:last-child)::after {
  content: ', ';
  white-space: pre-wrap;
  padding-right: 0.25em;
}

.video-worship-type::before {
  content: '⛪ ';
  margin-right: 4px;
  font-size: 0.9rem;
}

.video-upcoming {
  font-size: 0.85rem;
  font-weight: 700;
  color: #d97706;
  display: inline-flex;
  align-items: center;
  list-style-type: none;
  width: 100%;
  margin-bottom: 4px;
}

.video-upcoming::before {
  content: '⏳ ';
  margin-right: 4px;
  font-size: 0.9rem;
}

#no-results-msg {
  text-align: center;
  grid-column: 1 / -1;
  color: #666;
  padding: 40px 20px;
  display: none;
}

#infinite-scroll-sentinel {
  width: 100%;
  height: 20px;
  margin-top: 20px;
}
