/* Fardeteen custom sort dropdown — shop + collections (replaces native <select> UI) */

.fardeteen-sort-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.toolbar-sorter {
    position: relative;
    align-items: center;
}

.fardeteen-sort {
    position: relative;
    min-width: min(220px, 72vw);
}

.fardeteen-sort-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0.55rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(11, 110, 79, 0.22);
    background: linear-gradient(145deg, #ffffff 0%, #f4fbf7 100%);
    box-shadow:
        0 4px 14px rgba(80, 199, 135, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--dark-green, #031c12);
    cursor: pointer;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.2s ease;
}

.fardeteen-sort-trigger:hover {
    border-color: rgba(80, 199, 135, 0.55);
    box-shadow:
        0 6px 22px rgba(80, 199, 135, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.fardeteen-sort-trigger:focus-visible {
    outline: none;
    border-color: var(--light-green, #50c787);
    box-shadow:
        0 0 0 3px rgba(80, 199, 135, 0.35),
        0 8px 26px rgba(80, 199, 135, 0.22);
}

.fardeteen-sort.is-open .fardeteen-sort-trigger {
    border-color: rgba(80, 199, 135, 0.65);
    box-shadow:
        0 0 0 2px rgba(80, 199, 135, 0.25),
        0 10px 32px rgba(11, 110, 79, 0.18);
    transform: translateY(-1px);
}

.fardeteen-sort-value {
    text-align: start;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fardeteen-sort-chevron {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: rgba(80, 199, 135, 0.15);
    color: var(--mid-green, #0b6e4f);
    transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), background 0.25s;
}

.fardeteen-sort-chevron svg {
    width: 14px;
    height: 14px;
    display: block;
}

.fardeteen-sort.is-open .fardeteen-sort-chevron {
    transform: rotate(180deg);
    background: rgba(80, 199, 135, 0.28);
}

.fardeteen-sort-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 80;
    padding: 6px;
    border-radius: 16px;
    border: 1px solid rgba(11, 110, 79, 0.15);
    background: linear-gradient(180deg, #ffffff 0%, #f8fdf9 100%);
    box-shadow:
        0 16px 40px rgba(11, 110, 79, 0.14),
        0 0 0 1px rgba(80, 199, 135, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.97);
    transform-origin: top center;
    transition:
        opacity 0.32s cubic-bezier(0.33, 1, 0.48, 1),
        transform 0.32s cubic-bezier(0.33, 1, 0.48, 1),
        visibility 0.32s;
    pointer-events: none;
}

[dir='rtl'] .fardeteen-sort-panel {
    left: 0;
    right: 0;
}

.fardeteen-sort.is-open .fardeteen-sort-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fardeteen-sort-options {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: min(320px, 52vh);
    overflow-y: auto;
}

.fardeteen-sort-option {
    margin: 0;
    padding: 0.62rem 0.85rem;
    border-radius: 11px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dark-green, #031c12);
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
    opacity: 0;
    transform: translateY(-6px);
}

.fardeteen-sort.is-open .fardeteen-sort-option {
    animation: fardeteen-sort-option-in 0.4s cubic-bezier(0.33, 1, 0.48, 1) forwards;
}

.fardeteen-sort.is-open .fardeteen-sort-option:nth-child(1) {
    animation-delay: 0.03s;
}
.fardeteen-sort.is-open .fardeteen-sort-option:nth-child(2) {
    animation-delay: 0.06s;
}
.fardeteen-sort.is-open .fardeteen-sort-option:nth-child(3) {
    animation-delay: 0.09s;
}
.fardeteen-sort.is-open .fardeteen-sort-option:nth-child(4) {
    animation-delay: 0.12s;
}
.fardeteen-sort.is-open .fardeteen-sort-option:nth-child(5) {
    animation-delay: 0.15s;
}
.fardeteen-sort.is-open .fardeteen-sort-option:nth-child(6) {
    animation-delay: 0.18s;
}
.fardeteen-sort.is-open .fardeteen-sort-option:nth-child(7) {
    animation-delay: 0.21s;
}
.fardeteen-sort.is-open .fardeteen-sort-option:nth-child(8) {
    animation-delay: 0.24s;
}

@keyframes fardeteen-sort-option-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fardeteen-sort-option:hover,
.fardeteen-sort-option:focus-visible {
    background: rgba(80, 199, 135, 0.14);
    color: var(--mid-green, #0b6e4f);
    outline: none;
}

.fardeteen-sort-option.is-selected {
    background: linear-gradient(135deg, rgba(80, 199, 135, 0.22), rgba(11, 110, 79, 0.1));
    color: var(--mid-green, #0b6e4f);
    box-shadow: inset 0 0 0 1px rgba(80, 199, 135, 0.35);
}

html[data-theme='dark'] .fardeteen-sort-trigger {
    border-color: rgba(110, 231, 180, 0.2);
    background: linear-gradient(145deg, #1a2420 0%, #121a16 100%);
    color: var(--text-dark, #e8ecea);
    box-shadow:
        0 6px 22px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme='dark'] .fardeteen-sort-trigger:hover {
    border-color: rgba(110, 231, 180, 0.35);
    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(110, 231, 180, 0.08);
}

html[data-theme='dark'] .fardeteen-sort.is-open .fardeteen-sort-trigger {
    border-color: rgba(110, 231, 180, 0.45);
    box-shadow:
        0 0 0 2px rgba(110, 231, 180, 0.2),
        0 12px 36px rgba(0, 0, 0, 0.55);
}

html[data-theme='dark'] .fardeteen-sort-chevron {
    background: rgba(110, 231, 180, 0.15);
    color: var(--light-green, #6ee7b4);
}

html[data-theme='dark'] .fardeteen-sort.is-open .fardeteen-sort-chevron {
    background: rgba(110, 231, 180, 0.25);
}

html[data-theme='dark'] .fardeteen-sort-panel {
    border-color: rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, #1a2220 0%, #141c18 100%);
    box-shadow:
        0 20px 48px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(110, 231, 180, 0.1);
}

html[data-theme='dark'] .fardeteen-sort-option {
    color: var(--text-dark, #e8ecea);
}

html[data-theme='dark'] .fardeteen-sort-option:hover,
html[data-theme='dark'] .fardeteen-sort-option:focus-visible {
    background: rgba(110, 231, 180, 0.12);
    color: var(--light-green, #6ee7b4);
}

html[data-theme='dark'] .fardeteen-sort-option.is-selected {
    background: linear-gradient(135deg, rgba(110, 231, 180, 0.18), rgba(35, 152, 112, 0.12));
    color: var(--light-green, #6ee7b4);
    box-shadow: inset 0 0 0 1px rgba(110, 231, 180, 0.3);
}

@media (prefers-reduced-motion: reduce) {
    .fardeteen-sort-panel,
    .fardeteen-sort-chevron,
    .fardeteen-sort-trigger {
        transition-duration: 0.01ms !important;
    }

    .fardeteen-sort.is-open .fardeteen-sort-option {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .fardeteen-sort-panel {
        transform: none !important;
    }
}
