/**
 * @file
 * A-Z Letter Filter + Employment Type + Department Checkboxes
 * for Directory View
 */

/* ==========================================================================
   Filter Container
   ========================================================================== */

.directory-custom-filters {
  margin-bottom: 0;
}

/* ==========================================================================
   Clear Button
   ========================================================================== */

.filter-controls {
  margin-bottom: 20px;
}

.clear-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background-color: #d32f2f;
  color: #ffffff;
  border: none;
  border-radius: 0;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clear-filters-btn:hover {
  background-color: #b71c1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(211, 47, 47, 0.3);
}

.clear-filters-btn:active {
  transform: translateY(0);
}

.clear-filters-btn .close-icon {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   A-Z Letter Filter
   ========================================================================== */

.letter-filter-section {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  padding: 20px;
  margin-bottom: 30px;
}

.letters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.letter-col {
  flex: 0 0 auto;
  padding: 0;
}

.letter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #ffffff;
  border: 2px solid #d0d0d0;
  border-radius: 0;
  color: #555;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.letter-btn:hover {
  background: #18453B;
  border-color: #18453B;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(24, 69, 59, 0.2);
}

.letter-btn.active,
.letter-btn[aria-selected="true"] {
  background: #18453B;
  border-color: #18453B;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(24, 69, 59, 0.3);
}

.letter-btn.letter-all {
  width: auto;
  padding: 0 16px;
  min-width: 60px;
}

/* Disabled letters (no items) */
.letter-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* Mobile letter filter */
@media (max-width: 768px) {
  .letter-filter-section {
    padding: 15px;
  }

  .letters-row {
    gap: 6px;
  }

  .letter-btn {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }
}

/* ==========================================================================
   Combined Filters Section (Employment Type & Departments)
   ========================================================================== */

.combined-filters-section {
  margin-bottom: 0;
  background: #ffffff;
  padding-top: 20px;
}

.combined-filters-section .row {
  gap: 20px 0;
}

.filter-group {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  padding: 20px;
}

.filter-title {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 15px;
}

/* Custom Dropdown Styling */
.custom-dropdown {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: #ffffff;
  border: 2px solid #d0d0d0;
  border-radius: 0;
  color: #555;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-trigger:hover {
  border-color: #18453B;
  background: #f8f9fa;
}

.dropdown-trigger[aria-expanded="true"] {
  border-color: #18453B;
  background: #f8f9fa;
}

.dropdown-trigger[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-text {
  flex: 1;
  text-align: left;
}

.dropdown-arrow {
  margin-left: 10px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}

.dropdown-option {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  color: #555;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdown-option:hover {
  background: #f8f9fa;
}

.dropdown-option.selected {
  background: #e8f5e9;
}

.dropdown-option:focus {
  outline: 2px solid #18453B;
  outline-offset: -2px;
  background: #f8f9fa;
}

/* Checkbox in dropdown */
.dropdown-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: #18453B;
  flex-shrink: 0;
}

.dropdown-option label {
  flex: 1;
  cursor: pointer;
  margin: 0;
  user-select: none;
  color: #555;
}

.dropdown-option.selected label {
  color: #18453B;
  font-weight: 600;
}

/* Mobile Dropdown Responsiveness */
@media (max-width: 768px) {
  .custom-dropdown {
    max-width: 100%;
  }

  .dropdown-trigger {
    font-size: 0.95rem;
    padding: 10px 14px;
  }

  .dropdown-option {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .combined-filters-section {
    padding-top: 15px;
  }

  .combined-filters-section .col-md-4 {
    margin-bottom: 15px;
  }

  .combined-filters-section .col-md-4:last-child {
    margin-bottom: 0;
  }
}

/* ==========================================================================
   Name Search Input
   ========================================================================== */

.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.name-search-input {
  width: 100%;
  padding: 12px 40px 12px 40px;
  background: #ffffff;
  border: 2px solid #d0d0d0;
  border-radius: 0;
  color: #555;
  font-size: 1rem;
  font-weight: 400;
  transition: all 0.2s ease;
  outline: none;
}

.name-search-input:hover {
  border-color: #18453B;
  background: #f8f9fa;
}

.name-search-input:focus {
  border-color: #18453B;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(24, 69, 59, 0.1);
}

.name-search-input::placeholder {
  color: #999;
  font-weight: 400;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #777;
  pointer-events: none;
}

.name-search-input:focus ~ .search-icon {
  color: #18453B;
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #777;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.clear-search-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.clear-search-btn:active {
  background: #e0e0e0;
}

/* Mobile name search */
@media (max-width: 768px) {
  .search-input-wrapper {
    max-width: 100%;
  }

  .name-search-input {
    font-size: 0.95rem;
    padding: 10px 36px 10px 36px;
  }

  .search-icon {
    left: 12px;
  }

  .clear-search-btn {
    right: 8px;
  }
}

/* ==========================================================================
   Filter States and Badges
   ========================================================================== */

/* Active filter count badge */
.filter-title .filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: #18453B;
  color: #ffffff;
  border-radius: 0;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 8px;
}

/* Mobile styles are now in the Dropdown Responsiveness section above */

/* ==========================================================================
   Loading and Transition States
   ========================================================================== */

.directory-custom-filters.filtering {
  opacity: 0.6;
  pointer-events: none;
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

/* Focus visible for keyboard navigation */
.letter-btn:focus-visible,
.checkbox-item input:focus-visible {
  outline: 3px solid #18453B;
  outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .letter-btn,
  .filter-group {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .letter-btn,
  .filter-group,
  .checkbox-item {
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .directory-custom-filters {
    display: none;
  }
}
