/* =====================================================
   WooSort Dropdown Widget — Frontend Styles
   Pixel-perfect match to the WooCommerce sort UI
   ===================================================== */

/* Wrapper ------------------------------------------------- */
.wsw-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    font-family: inherit;
    box-sizing: border-box;
}

/* Label --------------------------------------------------- */
.wsw-label {
    font-size: 14px;
    color: #444;
    white-space: nowrap;
    line-height: 1;
}

/* Select wrap --------------------------------------------- */
.wsw-select-wrap {
    position: relative;
    display: inline-block;
}

/* Trigger button ------------------------------------------ */
.wsw-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    outline: none;
    border: none;
    background-color: #5cb85c;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    font-weight: 400;
    line-height: 1.4;
    padding: 7px 12px;
    border-radius: 4px;
    white-space: nowrap;
    transition: background-color 0.18s ease, color 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
}

.wsw-trigger:hover,
.wsw-trigger.wsw-open {
    background-color: #4cae4c;
}

/* Caret arrow --------------------------------------------- */
.wsw-arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    pointer-events: none;
}

.wsw-trigger.wsw-open .wsw-arrow {
    transform: rotate(180deg);
}

/* Dropdown panel ------------------------------------------ */
.wsw-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 100%;
    width: max-content;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 9999;
    overflow: hidden;

    /* Slide-in animation */
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.wsw-dropdown.wsw-visible {
    display: block;
}

.wsw-dropdown.wsw-animated {
    opacity: 1;
    transform: translateY(0);
}

/* Option items -------------------------------------------- */
.wsw-option {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: #444444;
    background: #ffffff;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.12s ease, color 0.12s ease;
    line-height: 1.4;
}

.wsw-option + .wsw-option {
    border-top: 1px solid #eeeeee;
}

.wsw-option:hover {
    background-color: #f5f5f5;
    color: #444444;
}

/* Active / selected item — matches the green highlighted
   row shown in the screenshot */
.wsw-option.wsw-active {
    background-color: #5cb85c;
    color: #ffffff;
    font-weight: 500;
}

.wsw-option.wsw-active:hover {
    background-color: #4cae4c;
    color: #ffffff;
}

/* Loading spinner ----------------------------------------- */
.wsw-loading-overlay {
    background: rgba(255,255,255,0.4);
}

@keyframes wsw-spin {
    to { transform: rotate(360deg); }
}

.wsw-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(92, 184, 92, 0.25);
    border-top-color: #5cb85c;
    border-radius: 50%;
    animation: wsw-spin 0.7s linear infinite;
}

/* Elementor editor preview: keep dropdown visible --------- */
.elementor-editor-active .wsw-dropdown {
    display: block;
    opacity: 1;
    transform: none;
    position: static;
    box-shadow: none;
    border: 1px solid #ddd;
    margin-top: 4px;
}
