/* ========================================================================== 
   SHARED WINE SELECT
   Progressive enhancement for native selects. The native control remains the
   source of truth while the visible menu mirrors the product-form design.
   ========================================================================== */

.wine-select {
  position: relative;
  width: 100%;
}

.wine-select.is-open {
  z-index: 100;
}

.wine-select__native {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.wine-select__button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px;
  border: 1px solid rgba(244, 194, 164, 0.25);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(39, 10, 27, 0.96), rgba(27, 8, 20, 0.94)),
    rgba(33, 9, 23, 0.94);
  color: rgba(255, 241, 226, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -18px 28px rgba(13, 3, 10, 0.13);
  font: inherit;
  font-size: 15px;
  line-height: 24px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.wine-select__button:hover,
.wine-select.is-open .wine-select__button {
  border-color: rgba(244, 194, 164, 0.38);
  background:
    linear-gradient(180deg, rgba(47, 13, 32, 0.98), rgba(34, 10, 24, 0.96)),
    rgba(41, 11, 28, 0.96);
}

.wine-select__button:focus-visible,
.wine-select__native:focus + .wine-select__button {
  outline: none;
  border-color: rgba(255, 214, 184, 0.58);
  box-shadow:
    0 0 0 3px rgba(221, 89, 132, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.wine-select.is-invalid .wine-select__button,
.wine-select__native.is-invalid + .wine-select__button {
  border-color: rgba(248, 113, 113, 0.72);
}

.wine-select.is-disabled .wine-select__button,
.wine-select__native:disabled + .wine-select__button {
  cursor: not-allowed;
  border-color: rgba(196, 190, 192, 0.18);
  background:
    linear-gradient(180deg, rgba(72, 66, 69, 0.30), rgba(41, 37, 39, 0.34)),
    rgba(44, 40, 42, 0.32);
  color: rgba(213, 207, 209, 0.46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  filter: saturate(0.18);
}

.wine-select.is-disabled .wine-select__button:hover,
.wine-select__native:disabled + .wine-select__button:hover {
  border-color: rgba(196, 190, 192, 0.18);
  background:
    linear-gradient(180deg, rgba(72, 66, 69, 0.30), rgba(41, 37, 39, 0.34)),
    rgba(44, 40, 42, 0.32);
}

.wine-select__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wine-select__button.is-placeholder .wine-select__label {
  color: rgba(248, 232, 215, 0.48);
}

.wine-select.is-disabled .wine-select__button.is-placeholder .wine-select__label {
  color: rgba(213, 207, 209, 0.46);
}

.wine-select__chevron {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(247, 202, 169, 0.18);
  border-radius: 999px;
  background: rgba(180, 58, 100, 0.16);
  color: #edc99a;
  transition: transform 0.18s ease, background 0.18s ease;
}

.wine-select__chevron svg {
  width: 14px;
  height: 14px;
}

.wine-select.is-open .wine-select__chevron {
  background: rgba(180, 58, 100, 0.24);
  transform: rotate(180deg);
}

.wine-select.is-disabled .wine-select__chevron {
  border-color: rgba(247, 202, 169, 0.10);
  background: rgba(92, 38, 59, 0.14);
  color: rgba(237, 201, 154, 0.42);
}

.wine-select__menu {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: var(--wine-select-menu-min-width, 100%);
  max-width: min(320px, calc(100vw - 32px));
  max-height: min(300px, 46vh);
  overflow-y: auto;
  padding: 7px;
  border: 1px solid rgba(247, 202, 169, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(52, 13, 32, 0.98), rgba(24, 7, 19, 0.98)),
    rgba(31, 8, 22, 0.98);
  box-shadow:
    0 22px 44px rgba(14, 3, 10, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
}

.wine-select__menu[hidden] {
  display: none;
}

.wine-select__search {
  position: sticky;
  z-index: 2;
  top: -7px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -1px -1px 4px;
  padding: 8px 10px 10px;
  border: 0;
  border-radius: 0;
  background: rgba(31, 8, 22, 0.98);
  color: rgba(237, 201, 154, 0.76);
  box-shadow: none;
}

.wine-select__search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.wine-select__search-input {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  appearance: none;
  color: #fff4e8;
  font: inherit;
  font-size: 0.9rem;
}

.wine-select__search-input::placeholder {
  color: rgba(248, 232, 215, 0.46);
}

.wine-select__search:focus-within {
  color: #f3d590;
  box-shadow: none;
}

.wine-select__empty {
  margin: 5px 3px 2px;
  padding: 10px;
  color: rgba(248, 232, 215, 0.54);
  font-size: 0.84rem;
  text-align: center;
}

.wine-select__empty[hidden] {
  display: none;
}

.wine-select__option {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 241, 226, 0.88);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.wine-select__option:hover,
.wine-select__option.is-active {
  border-color: rgba(247, 202, 169, 0.22);
  background:
    linear-gradient(135deg, rgba(180, 58, 100, 0.34), rgba(76, 22, 45, 0.64));
  color: #fff8ef;
  box-shadow: inset 3px 0 0 rgba(240, 190, 103, 0.58);
}

.wine-select__option[aria-selected="true"] {
  border-color: rgba(247, 202, 169, 0.36);
  background:
    linear-gradient(135deg, rgba(128, 43, 72, 0.82), rgba(69, 21, 44, 0.76));
  color: #fff2dc;
  box-shadow:
    inset 3px 0 0 rgba(240, 190, 103, 0.74),
    0 10px 20px rgba(16, 4, 11, 0.18);
}

.wine-select__option:disabled {
  cursor: default;
  opacity: 0.46;
}

.wine-select__action {
  display: flex;
  width: calc(100% - 4px);
  min-height: 38px;
  align-items: center;
  gap: 9px;
  margin: 6px 2px 1px;
  padding: 9px 10px 7px;
  border: 0;
  border-top: 1px solid rgba(225, 188, 106, 0.22);
  background: transparent;
  color: #e8c879;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.wine-select__action:hover,
.wine-select__action:focus-visible {
  outline: none;
  background: rgba(225, 188, 106, 0.08);
  color: #fff1c5;
}

.wine-select__action svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.wine-select--compact .wine-select__button {
  min-height: 38px;
  padding: 6px 8px 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 22px;
}

.wine-select--compact .wine-select__chevron {
  width: 22px;
  height: 22px;
}

.wine-select--compact .wine-select__menu {
  top: calc(100% + 6px);
  padding: 6px;
  border-radius: 12px;
}

.wine-select--compact .wine-select__option {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.8rem;
}

.app-select-field > .wine-select + .app-select-field__chevron {
  display: none;
}

.app-select-field > .wine-select {
  width: 100%;
}

@media (max-width: 640px) {
  .wine-select__menu {
    max-width: calc(100vw - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wine-select__button,
  .wine-select__chevron,
  .wine-select__option {
    transition: none;
  }
}
