/**
 * WoodMart Search Type Switcher v2.6
 * Compact inline toggle inside search input
 */

/* Make searchform a positioning context */
.searchform {
    position: relative;
}

/* Toggle container - positioned inside search input */
/* For RTL sites (Hebrew), we position on the RIGHT in CSS which appears LEFT visually */
.wsts-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #f0f0f0;
    border-radius: 16px;
    padding: 3px;
    z-index: 100;
    height: 32px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

/* LTR override - for non-RTL sites */
html:not([dir="rtl"]) .wsts-toggle,
body:not(.rtl) .wsts-toggle {
    right: auto;
    left: 15px;
}

/* Toggle buttons */
.wsts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    height: 26px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    color: #666;
    border-radius: 13px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.wsts-btn:hover {
    color: #333;
}

.wsts-btn:focus {
    outline: none;
}

/* Active state - very specific selector with !important */
.wsts-toggle .wsts-btn.wsts-active,
.wsts-toggle .wsts-btn.wsts-active:hover,
.wsts-toggle .wsts-btn.wsts-active:focus,
.wsts-toggle .wsts-btn.wsts-active:active {
    background: var(--wd-primary-color, #83b735) !important;
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

/* Adjust search input padding to make room for toggle AND icon */
/* RTL: visual left is CSS right (where toggle is), visual right is CSS left (where icon is) */
.searchform .s,
.searchform input[name="s"],
.searchform input[type="text"] {
    padding-right: 210px !important;  /* Space for toggle on visual left */
    padding-left: 100px !important;   /* Space for icon on visual right */
}

/* LTR override */
html:not([dir="rtl"]) .searchform .s,
html:not([dir="rtl"]) .searchform input[name="s"],
html:not([dir="rtl"]) .searchform input[type="text"],
body:not(.rtl) .searchform .s,
body:not(.rtl) .searchform input[name="s"],
body:not(.rtl) .searchform input[type="text"] {
    padding-left: 210px !important;   /* Space for toggle */
    padding-right: 100px !important;  /* Space for icon */
}

/* Full-screen and dropdown search - slightly larger */
.wd-search-full-screen .wsts-toggle,
.wd-search-full-screen-2 .wsts-toggle,
.wd-search-dropdown .wsts-toggle {
    right: 20px;
    height: 36px;
    padding: 4px;
    border-radius: 18px;
}

html:not([dir="rtl"]) .wd-search-full-screen .wsts-toggle,
html:not([dir="rtl"]) .wd-search-full-screen-2 .wsts-toggle,
html:not([dir="rtl"]) .wd-search-dropdown .wsts-toggle,
body:not(.rtl) .wd-search-full-screen .wsts-toggle,
body:not(.rtl) .wd-search-full-screen-2 .wsts-toggle,
body:not(.rtl) .wd-search-dropdown .wsts-toggle {
    right: auto;
    left: 20px;
}

.wd-search-full-screen .wsts-btn,
.wd-search-full-screen-2 .wsts-btn,
.wd-search-dropdown .wsts-btn {
    padding: 0 16px;
    height: 28px;
    font-size: 13px;
    border-radius: 14px;
}

.wd-search-full-screen .searchform .s,
.wd-search-full-screen-2 .searchform .s,
.wd-search-dropdown .searchform .s {
    padding-right: 230px !important;
    padding-left: 100px !important;
}

html:not([dir="rtl"]) .wd-search-full-screen .searchform .s,
html:not([dir="rtl"]) .wd-search-full-screen-2 .searchform .s,
html:not([dir="rtl"]) .wd-search-dropdown .searchform .s,
body:not(.rtl) .wd-search-full-screen .searchform .s,
body:not(.rtl) .wd-search-full-screen-2 .searchform .s,
body:not(.rtl) .wd-search-dropdown .searchform .s {
    padding-left: 230px !important;
    padding-right: 100px !important;
}

/* ===== MOBILE: Toggle below search input ===== */
@media (max-width: 768px) {
    /* Mobile toggle - positioned inside the search area */
    .wsts-toggle {
        position: absolute !important;
        top: 100% !important;
        bottom: auto !important;
        left: 31% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        margin-top: -33px;
        height: 20px;
        padding: 2px;
        border-radius: 13px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
        background: #f5f5f5;
    }

    .wsts-btn {
        padding: 0 10px;
        height: 16px;
        font-size: 10px;
        border-radius: 11px;
        padding: 5px 15px 5px 15px !Important;
    }

    /* Active button on mobile - wider */
    .wsts-toggle .wsts-btn.wsts-active,
    .wsts-toggle .wsts-btn.wsts-active:hover,
    .wsts-toggle .wsts-btn.wsts-active:focus,
    .wsts-toggle .wsts-btn.wsts-active:active {
        font-size: 11px !important;
        padding: 2px 40px !important;
        padding: 3px 20px 3px 20px !Important;
    }

    /* Reset input padding on mobile - no toggle inside */
    .searchform .s,
    .searchform input[name="s"],
    .searchform input[type="text"],
    .wd-search-full-screen .searchform .s,
    .wd-search-full-screen-2 .searchform .s,
    .wd-search-dropdown .searchform .s {
        padding-right: 50px !important;
        padding-left: 15px !important;
    }

    html:not([dir="rtl"]) .searchform .s,
    html:not([dir="rtl"]) .searchform input[name="s"],
    html:not([dir="rtl"]) .searchform input[type="text"],
    body:not(.rtl) .searchform .s,
    body:not(.rtl) .searchform input[name="s"],
    body:not(.rtl) .searchform input[type="text"],
    html:not([dir="rtl"]) .wd-search-full-screen .searchform .s,
    html:not([dir="rtl"]) .wd-search-full-screen-2 .searchform .s,
    html:not([dir="rtl"]) .wd-search-dropdown .searchform .s,
    body:not(.rtl) .wd-search-full-screen .searchform .s,
    body:not(.rtl) .wd-search-full-screen-2 .searchform .s,
    body:not(.rtl) .wd-search-dropdown .searchform .s {
        padding-left: 50px !important;
        padding-right: 15px !important;
    }

    /* Make sure parent has overflow visible */
    .searchform,
    .wd-search-form {
        overflow: visible !important;
    }
}

/* Tablet adjustments - keep inline but smaller */
@media (min-width: 769px) and (max-width: 1024px) {
    .wsts-toggle {
        right: 12px;
        height: 30px;
        padding: 3px;
    }

    html:not([dir="rtl"]) .wsts-toggle,
    body:not(.rtl) .wsts-toggle {
        right: auto;
        left: 12px;
    }

    .wsts-btn {
        padding: 0 12px;
        height: 24px;
        font-size: 11px;
    }

    .searchform .s,
    .searchform input[name="s"],
    .searchform input[type="text"] {
        padding-right: 180px !important;
        padding-left: 80px !important;
    }

    html:not([dir="rtl"]) .searchform .s,
    html:not([dir="rtl"]) .searchform input[name="s"],
    html:not([dir="rtl"]) .searchform input[type="text"],
    body:not(.rtl) .searchform .s,
    body:not(.rtl) .searchform input[name="s"],
    body:not(.rtl) .searchform input[type="text"] {
        padding-left: 180px !important;
        padding-right: 80px !important;
    }

    .wd-search-full-screen .wsts-toggle,
    .wd-search-full-screen-2 .wsts-toggle,
    .wd-search-dropdown .wsts-toggle {
        right: 15px;
        height: 32px;
    }

    html:not([dir="rtl"]) .wd-search-full-screen .wsts-toggle,
    html:not([dir="rtl"]) .wd-search-full-screen-2 .wsts-toggle,
    html:not([dir="rtl"]) .wd-search-dropdown .wsts-toggle,
    body:not(.rtl) .wd-search-full-screen .wsts-toggle,
    body:not(.rtl) .wd-search-full-screen-2 .wsts-toggle,
    body:not(.rtl) .wd-search-dropdown .wsts-toggle {
        right: auto;
        left: 15px;
    }

    .wd-search-full-screen .wsts-btn,
    .wd-search-full-screen-2 .wsts-btn,
    .wd-search-dropdown .wsts-btn {
        padding: 0 14px;
        height: 26px;
        font-size: 12px;
    }

    .wd-search-full-screen .searchform .s,
    .wd-search-full-screen-2 .searchform .s,
    .wd-search-dropdown .searchform .s {
        padding-right: 200px !important;
        padding-left: 80px !important;
    }

    html:not([dir="rtl"]) .wd-search-full-screen .searchform .s,
    html:not([dir="rtl"]) .wd-search-full-screen-2 .searchform .s,
    html:not([dir="rtl"]) .wd-search-dropdown .searchform .s,
    body:not(.rtl) .wd-search-full-screen .searchform .s,
    body:not(.rtl) .wd-search-full-screen-2 .searchform .s,
    body:not(.rtl) .wd-search-dropdown .searchform .s {
        padding-left: 200px !important;
        padding-right: 80px !important;
    }
}