/**
 * Modern Category Dropdown Styles
 * Chocolat Central Theme
 * 
 * Modern, accessible dropdown styles
 * Replaces Pretty Dropdowns with custom implementation
 * 
 * @since 1.2.0
 */

/* Modern Dropdown Wrapper */
.modern-category-dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
  min-width: 200px;
  z-index: 1000;
}

/* Dropdown Button (Visible) */
.modern-dropdown-button {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-right: 2.5rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  color: #231F20;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px; /* Accessibility: minimum touch target */
}

.modern-dropdown-button:hover {
  border-color: #c8957c;
  background: #f9f9f9;
}

.modern-dropdown-button:focus {
  outline: 2px solid #c8957c;
  outline-offset: 2px;
  border-color: #c8957c;
}

.modern-dropdown-button[aria-expanded="true"] {
  border-color: #c8957c;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

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

/* Dropdown Icon (Arrow) */
.modern-dropdown-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.2s ease;
  color: #7e543b;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dropdown List (Hidden by default) */
.modern-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid #c8957c;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.modern-category-dropdown.open .modern-dropdown-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dropdown Options */
.modern-dropdown-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  border-bottom: 1px solid #f0f0f0;
  color: #231F20;
  display: block;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modern-dropdown-option:last-child {
  border-bottom: none;
}

.modern-dropdown-option:hover {
  background-color: #f9f9f9;
  color: #7e543b;
}

.modern-dropdown-option:focus {
  outline: 2px solid #c8957c;
  outline-offset: -2px;
  background-color: #f9f9f9;
}

.modern-dropdown-option.selected,
.modern-dropdown-option[aria-selected="true"] {
  background-color: #c8957c;
  color: #fff;
  font-weight: 600;
}

.modern-dropdown-option.selected:hover,
.modern-dropdown-option[aria-selected="true"]:hover {
  background-color: #b87d66;
  color: #fff;
}

/* Scrollbar Styling (Webkit browsers) */
.modern-dropdown-list::-webkit-scrollbar {
  width: 8px;
}

.modern-dropdown-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.modern-dropdown-list::-webkit-scrollbar-thumb {
  background: #c8957c;
  border-radius: 4px;
}

.modern-dropdown-list::-webkit-scrollbar-thumb:hover {
  background: #b87d66;
}

/* Mobile/Tablet Adjustments */
@media (max-width: 767px) {
  .modern-category-dropdown {
    min-width: 100%;
  }
  
  .modern-dropdown-button {
    font-size: 0.95rem;
    padding: 0.65rem 0.85rem;
    padding-right: 2.25rem;
    min-height: 44px;
  }
  
  .modern-dropdown-option {
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
  }
  
  .modern-dropdown-list {
    max-height: 250px;
  }
}

/* Ensure dropdown is above other elements */
#receiptSearchRow {
  position: relative;
  z-index: 100;
}

/* Integration with existing styles */
#receiptSearchRow .col-md-4 {
  position: relative;
}

/* Ensure proper spacing */
#receiptSearchRow .modern-category-dropdown {
  margin-top: 0;
}

