/* =====================================================================
   Ink & Toner Finder: Tom Select look
   Loaded only with assets/js/finder-ui.js. Matches the existing blue
   finder buttons; the next step is blue, finished steps turn white with
   a check, and steps not reached yet stay grey.
   ===================================================================== */

/* Tom Select hides the real <select>. The theme forces every finder select
   to 50px/100% with !important, so undo that for the hidden one. */
.swiftink-select-filter select.ts-hidden-accessible {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* The old caret icon is replaced by Tom Select's own arrow. */
.swiftink-select-filter.sf-enhanced .custom-select-field:after {
    display: none !important;
}
.swiftink-select-filter.sf-enhanced .custom-select-field {
    margin-bottom: 6px;
}
.swiftink-select-filter.sf-enhanced #cartridge_div {
    margin-bottom: 0;
}

/* Flatsome gives forms a 1.3em bottom margin; that pushed the link down. */
.swiftink-select-filter.sf-enhanced #select_filter {
    margin-bottom: 0;
}

/* "Search it instead" mode: one search box replaces the three steps. */
.swiftink-select-filter .sf-search-field {
    display: none;
    margin-bottom: 0;
}
.swiftink-select-filter.sf-mode-search #brand_div,
.swiftink-select-filter.sf-mode-search #series_div,
.swiftink-select-filter.sf-mode-search #cartridge_div {
    display: none;
}
.swiftink-select-filter.sf-mode-search .sf-search-field {
    display: block;
}

/* ---- the box ---- */
/* Tom Select copies the select's inline width (200px) onto its wrapper. */
.swiftink-select-filter .ts-wrapper {
    width: 100% !important;
    min-height: 44px;
}
.swiftink-select-filter .ts-wrapper.single .ts-control {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    min-height: 44px;
    padding: 9px 38px 9px 16px;
    overflow: hidden;
    border: 2px solid #007db8;
    border-radius: 11px;
    background: #007db8;
    color: #fff;
    font-size: 16px;
    line-height: 22px;
    box-shadow: 0 3px 10px -3px rgba(0, 0, 0, .22);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.swiftink-select-filter .ts-wrapper.single .ts-control:hover {
    background: #016aa0;
    border-color: #016aa0;
}
.swiftink-select-filter .ts-wrapper.single.input-active .ts-control {
    background: #007db8;
    cursor: text;
}
.swiftink-select-filter .ts-wrapper.focus .ts-control {
    box-shadow: 0 0 0 3px rgba(0, 125, 184, .30);
}

/* The theme styles every input in the finder as a blue 50px box; the typing
   field inside Tom Select must stay plain. 16px stops iPhones zooming in. */
.swiftink-select-filter .ts-control > input {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: 16px !important;
    line-height: 22px !important;
}
.swiftink-select-filter .ts-control > input::placeholder {
    color: #fff;
    opacity: .95;
}
.swiftink-select-filter .ts-control .item {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 700;
}

/* arrow */
.swiftink-select-filter .ts-wrapper.single .ts-control:after {
    content: "";
    position: absolute;
    top: 50%;
    right: 15px;
    margin-top: -3px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 0 6px;
    border-color: #fff transparent transparent transparent;
}
.swiftink-select-filter .ts-wrapper.single.dropdown-active .ts-control:after {
    margin-top: -4px;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent #fff transparent;
}

/* finished step: white, blue outline, check mark */
.swiftink-select-filter .ts-wrapper.single.has-items:not(.input-active) .ts-control {
    padding-left: 38px;
    background: #fff;
    color: #007db8;
    box-shadow: none;
}
.swiftink-select-filter .ts-wrapper.single.has-items:not(.input-active) .ts-control:hover {
    background: #e8f4fa;
}
.swiftink-select-filter .ts-wrapper.single.has-items:not(.input-active) .ts-control:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 14px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    background: no-repeat center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23007db8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M2.5 8.5l3.5 3.5 7.5-8'/%3E%3C/svg%3E");
}
.swiftink-select-filter .ts-wrapper.single.has-items:not(.input-active) .ts-control:after {
    border-color: #007db8 transparent transparent transparent;
}

/* step not reached yet */
.swiftink-select-filter .ts-wrapper.disabled .ts-control,
.swiftink-select-filter .ts-wrapper.disabled .ts-control:hover {
    opacity: 1;
    background: #eef2f6;
    border-color: #eef2f6;
    color: #9aa4b0;
    box-shadow: none;
    cursor: not-allowed;
}
.swiftink-select-filter .ts-wrapper.disabled .ts-control > input::placeholder {
    color: #9aa4b0;
}
.swiftink-select-filter .ts-wrapper.disabled .ts-control:after {
    border-color: #9aa4b0 transparent transparent transparent;
}

/* ---- the list (attached to <body> so the banner row can't clip it) ---- */
.sf-dropdown.ts-dropdown {
    z-index: 1000;
    margin-top: 6px;
    overflow: hidden;
    border: 1px solid #d5dde4;
    border-radius: 11px;
    background: #fff;
    color: #111;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .18);
    font-family: Lato, sans-serif;
    font-size: 15px;
}
.sf-dropdown .ts-dropdown-content {
    max-height: 300px;
    padding: 5px;
}
.sf-dropdown .option {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 12px;
    border-radius: 7px;
    line-height: 1.3;
}
.sf-dropdown .option.active {
    background: #e8f4fa;
    color: #111;
}
.sf-dropdown .option.selected {
    font-weight: 700;
    color: #007db8;
}
.sf-dropdown .highlight {
    background: rgba(255, 200, 0, .4);
    border-radius: 2px;
}
.sf-dropdown .no-results {
    padding: 12px;
    color: #6b6b6b;
}

/* ---- "Know your model?" link under the boxes ---- */
.swiftink-select-filter .sf-search-link {
    display: block;
    margin: 6px auto 0;
    min-height: 28px;
    padding: 4px 6px;
    border: 0;
    background: none;
    color: #007db8;
    font: 700 13px/1.4 Lato, sans-serif;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.swiftink-select-filter .sf-search-link:hover {
    color: #005f8c;
}

@media (max-width: 849px) {
    .swiftink-select-filter .ts-wrapper,
    .swiftink-select-filter .ts-wrapper.single .ts-control {
        min-height: 46px;
    }
}

/* search results: model name with brand and family underneath */
.sf-dropdown .sf-opt2 {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}
.sf-dropdown .sf-opt2 small {
    color: #6b6b6b;
    font-size: 12px;
}
