/* Custom Select Component - BEM Methodology */

.custom-select {
  position: relative;
  display: inline-block;
  min-width: 215px;
  margin: 0 auto;
}

.custom-select__button {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 1rem;
  border: 1px solid #333;
  border-radius: 2rem;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  outline: none;
}

.custom-select__button:hover {
  border-color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.custom-select__button--active {
  border-color: var(--color-text);
  box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.1);
}

.custom-select__button-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select__arrow {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--color-text);
  transition: transform 0.2s ease;
  pointer-events: none;
}

.custom-select__button--active .custom-select__arrow {
  transform: translateY(-50%) rotate(180deg);
}

.custom-select__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg);
  border: 1px solid #e2e2e2;
  border-radius: 1rem;
  margin-top: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.custom-select__dropdown--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select__option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-align: center;
  border-bottom: 1px solid rgba(51, 51, 51, 0.1);
}

.custom-select__option:last-child {
  border-bottom: none;
}

.custom-select__option:hover {
  background: rgba(51, 51, 51, 0.05);
}

.custom-select__option--selected {
  background: rgba(51, 51, 51, 0.1);
  font-weight: 600;
}

.custom-select__input {
  display: none;
}

/* Icon styling */
.search__icon,
.basket-icon {
  fill: var(--color-text);
  stroke: var(--color-text);
}

/* Search input clear button (X) styling */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--color-text);
  cursor: pointer;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") center/contain no-repeat;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .custom-select__dropdown {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
  }
  
  .custom-select__option {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
  
  .custom-select__option:hover {
    background: rgba(255, 255, 255, 0.05);
  }
  
  .custom-select__option--selected {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .search__icon,
  .basket-icon {
    fill: var(--color-text);
    stroke: var(--color-text);
  }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .custom-select {
    width: 100% !important;
    max-width: 100%;
    margin-bottom: 1rem;
  }
  
  .custom-select__button {
    font-size: 1rem;
    padding: 0.85rem 1rem;
  }
  
  .custom-select__dropdown {
    max-height: 250px;
  }
  
  .custom-select__option {
    padding: 1rem;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .custom-select__button {
    font-size: 0.95rem;
    padding: 0.85rem 0.75rem;
  }
  
  .custom-select__option {
    padding: 0.85rem 0.75rem;
    font-size: 0.95rem;
  }
}
