/* ==================================================
   INVENTORY SEARCH (GENERAL)
================================================== */

:root {
    --tot-filter-width: 174px;
    --tot-filter-gap: 6px;
}

.tot-inventory-search {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    box-sizing: border-box;
}

/* ==================================================
   INVENTORY SEARCH — HORIZONTAL
================================================== */

.tot-inventory-search.tot-horizontal {
    display: flex !important;
    flex-wrap: nowrap;
    gap: var(--tot-search-gap, 16px);
    align-items: center;
    width: 100%;
}

.tot-inventory-search.tot-horizontal .tot-field,
.tot-inventory-search.tot-horizontal select,
.tot-inventory-search.tot-horizontal input {
    min-width: var(--tot-field-min-width, 180px);
    flex: var(--tot-field-flex, 1 1 0);
    box-sizing: border-box;
    background: var(--tot-field-bg);
    color: var(--tot-field-color);
    border-radius: var(--tot-field-radius);
    padding: var(--tot-field-padding);
    border-color: var(--tot-field-border-color);
    height: auto;
    line-height: 1.2;
}

.tot-inventory-search.tot-horizontal select,
.tot-inventory-search.tot-horizontal input {
    padding-top: calc(var(--tot-field-padding-top, 0.65em));
    padding-bottom: calc(var(--tot-field-padding-bottom, 0.65em));
}

.tot-inventory-search.tot-horizontal select {
    appearance: none;
    -webkit-appearance: none;
}

.tot-inventory-search.tot-horizontal .tot-search-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tot-btn-bg);
    color: var(--tot-btn-color);
    border-radius: var(--tot-btn-radius);
    padding: var(--tot-btn-padding);
    line-height: 1.2;
}

/* ==================================================
   INVENTORY SEARCH — STACKED
================================================== */

.tot-inventory-search.tot-stacked {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.tot-inventory-search.tot-stacked .tot-field,
.tot-inventory-search.tot-stacked select,
.tot-inventory-search.tot-stacked input {
    width: 100%;
    box-sizing: border-box;
}

.tot-inventory-search.tot-stacked .tot-search-btn {
    width: 100%;
    min-height: 44px;
    cursor: pointer;
}

/* ==================================================
   FILTER BAR LAYOUT
================================================== */

.tot-inventory-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tot-filter-gap, 16px);
    align-items: flex-start;
}

.tot-filter-col {
    position: relative;
    display: flex;
    flex-direction: column;
    width: var(--tot-filter-width, 220px);
    flex: 0 0 var(--tot-filter-width, 220px);
}

.tot-filter-trigger {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid #dadada;
    border-radius: 8px;
    color: #000;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}

.tot-filter-label {
    flex: 1 1 auto;
    text-align: left !important;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
    max-width: calc(100% - 20px);
}

.tot-filter-arrow {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.tot-filter-col.is-open .tot-filter-arrow {
    transform: rotate(180deg);
}

.tot-filter-trigger:hover {
    background: #003178;
    color: #fff;
    border-color: #003178;
}

.tot-filter-trigger:hover .tot-filter-label,
.tot-filter-trigger:hover .tot-filter-arrow {
    color: #fff;
}

.tot-filter-col.is-active .tot-filter-trigger {
    background: #dc0000;
    border-color: #dc0000;
    color: #fff;
}

.tot-filter-col.is-active .tot-filter-label,
.tot-filter-col.is-active .tot-filter-arrow {
    color: #fff;
}

/* ==================================================
   DROPDOWN PANEL
================================================== */

.tot-filter-dropdown {
    display: none;
    position: absolute;
    top: calc(44px + 6px);
    left: 0;
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 8px 0;
    z-index: 999;
}

.tot-filter-col.is-open .tot-filter-dropdown {
    display: block;
}

.tot-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
}

.tot-filter-option span {
    text-align: left !important;
}

.tot-filter-option:hover {
    background: #003178;
    color: #fff;
}

/* ==================================================
   SELECTED PILLS
================================================== */

.tot-filter-pills-wrap {
    margin-top: 8px;
}

.tot-selected-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tot-selected-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
    background: #eef3ff;
    border: 1px solid #cdd8ff;
}

.tot-pill-remove {
    cursor: pointer;
    font-weight: 600;
}

/* ==================================================
   CLEAR ALL
================================================== */

.tot-clear-all-wrap {
    display: flex;
    align-items: center;
    height: 44px;
}

.tot-clear-all {
    font-size: 13px;
    color: #777;
    cursor: pointer;
    text-decoration: underline;
    user-select: none;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.tot-clear-all.is-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.tot-clear-all:hover {
    color: #000;
}

/* ==================================================
   SEARCH FILTER
================================================== */

.tot-filter-search-col {
    position: relative;
    width: 292px;
    flex: 0 0 292px;
}

.tot-filter-search-trigger,
.tot-filter-search-col .tot-filter-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px;
    padding: 0 14px;
    box-sizing: border-box;
    cursor: text;
}

.tot-filter-search-col .tot-filter-trigger:hover,
.tot-filter-search-col.is-active .tot-filter-trigger {
    background: #fff;
    color: inherit;
    border-color: inherit;
}

.tot-filter-search-col .tot-filter-arrow,
.tot-filter-search-trigger .tot-filter-arrow {
    display: none;
}

.tot-filter-search-col .tot-filter-dropdown {
    display: none !important;
}

.tot-filter-search-col .tot-filter-search-input {
    width: 100%;
    height: 44px;
    box-sizing: border-box;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none;
    padding: 0;
    margin: 0;
    font: inherit;
}

/* ==================================================
   CATEGORY MANUFACTURERS
================================================== */

.category-manufacturers {
    margin: 30px 0;
}

.manufacturer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
}

.manufacturer-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    flex: 0 0 calc(100% / var(--tot-logos-per-row));
    max-width: calc(100% / var(--tot-logos-per-row));
    box-sizing: border-box;
    background: #fff;
    border-radius: 10px;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    will-change: transform;
}

.manufacturer-card img,
.manufacturer-logo {
    width: auto;
    display: block;
    opacity: 0.85;
    transition: filter 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.manufacturer-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

.manufacturer-card:hover img,
.manufacturer-card:hover .manufacturer-logo {
    filter: grayscale(0%);
    opacity: 1;
}

.manufacturer-name {
    font-weight: 600;
    color: #111;
}

/* ==================================================
   EMPTY STATES
================================================== */

.tot-empty-results {
    display: none;
    width: 100%;
    max-width: 80%;
    margin: 40px auto;
    padding: 40px 20px;
    text-align: center;
    color: #444;
}

.tot-empty-results h3 {
    margin-bottom: 12px;
    font-weight: 600;
}

.tot-empty-results ul {
    list-style-position: inside;
    padding-left: 0;
    margin-top: 10px;
}

.tot-empty-results li {
    margin: 6px 0;
}

.tot-empty-results button.tot-empty-clear-btn,
.tot-empty-results .tot-empty-clear-btn,
.tot-empty-results .tot-empty-clear-btn[type="button"],
.tot-empty-results .tot-empty-clear-btn[type="submit"] {
    width: 100%;
    max-width: max-content;
    margin-top: 20px;
    padding: 12px 22px;
    background: #003178;
    color: #fff;
    border: none !important;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.tot-empty-results .tot-empty-clear-btn:hover {
    opacity: 0.85;
}

.tot-search-empty-results {
    max-width: 720px;
    margin: 60px auto;
}

.tot-search-empty-results ul {
    margin-top: 10px;
    padding-left: 18px;
}

.tot-context-empty-notice {
    display: none;
    width: 100%;
    margin: 24px 0 8px;
    padding: 28px 32px;
    text-align: center;
    background: linear-gradient(180deg, #f7faff 0%, #edf4ff 100%);
    border: 1px solid rgba(0, 49, 120, 0.14);
    border-left: 5px solid rgb(0, 49, 120);
    border-radius: 18px;
    box-shadow:
        0 10px 30px rgba(0, 49, 120, 0.10),
        0 2px 8px rgba(0, 49, 120, 0.05);
    box-sizing: border-box;
}

.tot-context-empty-title {
    margin: 0 0 10px;
    color: rgb(0, 49, 120);
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    font-weight: 700;
    line-height: 1.2;
}

.tot-context-empty-subtitle {
    margin: 0;
    color: rgba(0, 49, 120, 0.74);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.tot-similar-results {
    margin-top: 32px;
    text-align: left;
}

.tot-similar-results-title {
    margin: 0 0 16px;
    text-align: center;
}

.tot-similar-results-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.tot-similar-item {
    width: 100%;
}

.no-stock {
    display: none;
}

/* ==================================================
   INVENTORY SORT
================================================== */

.tot-filter-sort {
    flex: 0 0 auto;
    width: auto;
}

.tot-sort-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: unset;
    padding: 10px 12px;
}

.tot-sort-icon {
    font-size: 16px;
    opacity: 0.8;
}

.tot-sort-trigger::after {
    content: '';
}

.tot-filter-sort .tot-filter-dropdown {
    width: auto !important;
    min-width: max-content;
    white-space: nowrap;
    left: auto;
    right: 0;
}

.tot-filter-sort .tot-filter-option {
    white-space: nowrap;
}

.tot-filter-sort .tot-filter-dropdown label {
    padding: 6px 10px;
}

/* ==================================================
   RESPONSIVE
================================================== */

@media (max-width: 1024px) {
    .tot-similar-results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .tot-inventory-search.tot-horizontal {
        flex-direction: column;
        align-items: stretch;
    }

    .tot-inventory-search.tot-horizontal .tot-field,
    .tot-inventory-search.tot-horizontal select,
    .tot-inventory-search.tot-horizontal input,
    .tot-inventory-search.tot-horizontal .tot-search-btn {
        width: 100%;
    }

    .tot-context-empty-notice {
        padding: 22px 18px;
        border-radius: 14px;
    }

    .tot-similar-results-grid {
        grid-template-columns: 1fr;
    }

    .tot-sort-trigger {
        justify-content: flex-start;
        margin-bottom: 10px;
    }

    .tot-sort-trigger::after {
        content: 'Sort by';
        font-size: 13px;
        opacity: 0.8;
    }

    .tot-inventory-filters {
        gap: 10px;
    }

    .tot-filter-search-col {
        width: 100%;
        flex: 0 0 100%;
    }

    .tot-filter-col:not(.tot-filter-search-col) {
        width: calc(50% - 5px);
        flex: 0 0 calc(50% - 5px);
    }

    .tot-filter-dropdown {
        max-height: 240px;
    }

    .tot-filter-label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: left;
    }
}
