.product-color-picker {
    position: relative;
    width: min(100%, 300px);
    min-width: 250px;
    color: #242424;
}

.product-color-picker__input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.product-color-picker__trigger {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid rgba(148, 163, 184, .42);
    border-radius: 12px;
    background: hsl(var(--background));
    padding: 9px 12px;
    text-align: right;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.product-color-picker.is-open .product-color-picker__trigger,
.product-color-picker__trigger:focus-visible {
    border-color: var(--primary, #dc2626);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #dc2626) 12%, transparent);
    outline: none;
}

.product-color-picker__selected {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    font-size: .85rem;
    font-weight: 650;
    color: hsl(var(--text));
}

.product-color-picker__chevron {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: #64748b;
    transition: transform .2s ease;
}

.product-color-picker.is-open .product-color-picker__chevron { transform: rotate(180deg); }

.product-color-swatch {
    display: inline-block;
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    border: 1px solid rgba(100, 116, 139, .28);
    border-radius: 6px;
    background: var(--product-color, transparent);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.product-color-swatch.is-empty {
    background: transparent;
    border-color: rgba(148, 163, 184, .45);
}

.product-color-picker__menu {
    position: absolute;
    z-index: 99999 !important;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: 13px;
    background: hsl(var(--background));
    padding: 6px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .14);
}

.product-color-picker__option {
    display: grid;
    width: 100%;
    grid-template-columns: 24px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    padding: 9px 8px;
    text-align: right;
    font-size: .84rem;
    transition: background .15s ease, color .15s ease;
    color: hsl(var(--text));
}

.product-color-picker__option:hover,
.product-color-picker__option:focus-visible { background: rgba(148, 163, 184, .12); outline: none; }
.product-color-picker__option[aria-selected="true"] { color: var(--primary, #dc2626); background: color-mix(in srgb, var(--primary, #dc2626) 8%, transparent); font-weight: 750; }
.product-color-picker__check { width: 17px; height: 17px; opacity: 0; }
.product-color-picker__option[aria-selected="true"] .product-color-picker__check { opacity: 1; }

@media (max-width: 640px) {
    .product-color-picker { width: 100%; min-width: 210px; }
}

@media (prefers-reduced-motion: reduce) {
    .product-color-picker__trigger, .product-color-picker__chevron, .product-color-picker__option { transition: none; }
}
