/* Sermon Custom Post Type Styles */
.sermon-archive {
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue",
    sans-serif;
  position: relative; /* Add this to ensure proper positioning context */
}

/* Filters */
.sermon-filters {
  margin-bottom: 30px;
  position: relative;
  z-index: 100; /* Add z-index to ensure it's above other content */
}

.sermon-search-form {
  position: relative;
}

/* Update the search container to remove gap */
.sermon-search-container {
  display: flex;
  align-items: center;
  max-width: 100%;
  margin-bottom: 15px;
  gap: 10px;
}

.sermon-search-input-wrapper {
  flex-grow: 0;
  position: relative;
  width: 50%;
}

.sermon-search-input {
  width: 100%;
  padding: 12px 15px 12px 45px; /* Increased left padding */
  border: 1px solid #ddd;
  border-radius: 50px !important; /* 50px border radius */
  font-size: 16px;
  background-color: #f0f0f0;
  transition: all 0.3s ease;
}

.sermon-search-input:focus {
  outline: none;
  border-color: #0073aa;
  background-color: #fff;
}

/* Fix #1: Add more space to the left of the search icon */
.sermon-search-input-wrapper .dashicons {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
}

/* Ensure filter button has 50px border radius and is positioned directly next to search */
.sermon-filter-button {
  position: relative;
  padding: 12px 20px;
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 50px !important; /* 50px border radius */
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  margin-left: 10px; /* Add margin to separate from search */
  z-index: 100 !important;
}

.sermon-filter-button:hover {
  background-color: #e9e9e9;
}

.sermon-filter-button .dashicons {
  font-size: 16px;
}

/* Fix #2: Fix the positioning of the filter dropdown */
.sermon-filter-options {
  position: relative; /* Change from absolute to relative positioning */
  z-index: 1000; /* High z-index */
  width: 100%;
  padding: 20px;
  background-color: #fff;
  border-radius: 10px;
  /* box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); */
  border: 1px solid #eee;
  margin-top: 10px; /* Add margin to create space between button and dropdown */
  overflow-y: auto;
  max-height: 80vh;
  display: none; /* Hidden by default */
}

/* Ensure filter options stay within the window on smaller screens */
@media (max-width: 768px) {
  .sermon-filter-options {
    right: 0;
    left: 0;
    max-width: 100%;
  }

  #sermon-filter-dropdown-container {
    width: 90%;
    left: 5% !important;
    right: 5% !important;
  }
}

.sermon-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.sermon-filter-column {
  display: flex;
  flex-direction: column;
}

.sermon-filter-column label {
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
}

.sermon-preacher-filter,
.sermon-series-filter,
.sermon-topic-filter {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background-color: #f5f5f5;
  font-size: 14px;
  transition: all 0.3s ease;
}

/* Add styles for the date filter */
.sermon-date-filter {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background-color: #f5f5f5;
  font-size: 14px;
  transition: all 0.3s ease;
}

.sermon-date-filter:focus {
  outline: none;
  border-color: #0073aa;
  background-color: #fff;
}

.sermon-preacher-filter:focus,
.sermon-series-filter:focus,
.sermon-topic-filter:focus {
  outline: none;
  border-color: #0073aa;
  background-color: #fff;
}

.sermon-filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sermon-apply-filters {
  padding: 10px 20px;
  background-color: #0073aa;
  color: white;
  border: none;
  border-radius: 50px !important;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.sermon-apply-filters:hover {
  background-color: #005f8b;
}

.sermon-reset-filters {
  padding: 10px 20px;
  background-color: transparent;
  color: #666;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 500;
  transition: color 0.3s ease;
}

.sermon-reset-filters:hover {
  color: #0073aa;
  text-decoration: underline;
}

/* Remove or comment out the view toggle styles */
.sermon-view-toggle {
  display: none; /* Hide instead of removing to maintain compatibility */
}

.sermon-view-button {
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sermon-view-button:hover {
  background-color: #e9e9e9;
}

.sermon-view-button.active {
  background-color: #0073aa;
  border-color: #0073aa;
  color: white;
}

/* Grid Layout - Simplified to match screenshot */
.sermons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(25%, 1fr));
  grid-gap: 20px;
  margin: 20px 0;
}

.sermon-item {
  /* Removed card styling to match screenshot */
}

.sermon-thumbnail {
  position: relative;
  overflow: hidden;
}

.sermon-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px; /* Add this line to round the corners */
}

.sermon-duration {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: bold;
}

.sermon-title {
  margin: 10px 0 5px 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.sermon-title a {
  color: #333;
  text-decoration: none;
}

.sermon-title a:hover {
  color: #0073aa;
}

.sermon-preacher {
  font-size: 14px;
  color: #666;
  margin: 0;
  display: flex;
  align-items: center;
}

.sermon-preacher::after {
  content: "";
  display: none; /* Hide by default, will show when date exists */
  width: 4px;
  height: 4px;
  background-color: #666;
  border-radius: 50%;
  margin: 0 8px;
}

.sermon-date-display {
  font-size: 14px;
  color: #666;
}

/* Style for the dot between preacher name and date */
.sermon-dot {
  margin: 0 8px;
  color: #666;
}

/* Remove list view styles since we're not using it */
.sermons-list {
  display: none;
}

/* No Results */
.sermon-no-results {
  text-align: center;
  padding: 40px 20px;
  background-color: #f9f9f9;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.sermon-no-results .dashicons {
  font-size: 48px;
  width: 48px;
  height: 48px;
  color: #0073aa;
}

.sermon-no-results p {
  font-size: 18px;
  color: #666;
}

/* No Thumbnail Placeholder */
.sermon-no-thumbnail {
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  border-radius: 10px; /* Add this line to round the corners */
}

.sermon-no-thumbnail .dashicons {
  font-size: 48px;
  width: 48px;
  height: 48px;
  color: #999;
}

/* Pagination */
.sermon-pagination {
  text-align: center;
  margin: 30px 0;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.sermon-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 50%;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: all 0.3s ease;
}

.sermon-pagination .page-numbers:hover {
  background-color: #f5f5f5;
}

.sermon-pagination .current {
  background-color: #0073aa;
  color: white;
  border-color: #0073aa;
}

.sermon-pagination .prev,
.sermon-pagination .next {
  width: auto;
  padding: 0 15px;
  border-radius: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .sermon-filter-grid {
    grid-template-columns: 1fr;
  }

  .sermon-search-container {
    flex-direction: column;
  }

  .sermon-search-input-wrapper {
    width: 100%; /* Full width on mobile */
  }

  .sermon-filter-button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .sermons-grid {
    grid-template-columns: 1fr;
  }

  .sermon-filter-actions {
    flex-direction: column;
  }

  .sermon-apply-filters,
  .sermon-reset-filters {
    width: 100%;
    text-align: center;
  }
}

/* Remove date range specific styles */
.sermon-date-range {
  display: flex;
  align-items: center;
}

.sermon-date-separator {
  display: none; /* Hide the separator */
}
