/* =============================================================
 *  B2B Live Search — Modal & Results
 * ============================================================= */

/* ---------------------------------------------------------------
 *  Trigger Button (header icon)
 * ------------------------------------------------------------- */

.b2b-search-trigger {
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: #F8F9FA !important;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s;
}

.b2b-search-trigger:hover,
.b2b-search-trigger:focus,
.b2b-search-trigger:active {
    opacity: 0.7;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ---------------------------------------------------------------
 *  Modal Wrapper & Backdrop
 * ------------------------------------------------------------- */

.b2b-search-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.b2b-search-modal-wrapper.is-open {
    opacity: 1;
    visibility: visible;
}

.b2b-search-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
}

body.b2b-search-open {
    overflow: hidden;
}

/* ---------------------------------------------------------------
 *  Modal Container
 * ------------------------------------------------------------- */

.b2b-search-modal {
    position: relative;
    background: var(--b2b-white, #fff);
    width: 100%;
    max-width: 640px;
    margin-top: 50px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
    transform: translateY(-16px) scale(0.97);
    transition: transform 0.25s ease;
    overflow: hidden;
}

.b2b-search-modal-wrapper.is-open .b2b-search-modal {
    transform: translateY(0) scale(1);
}

/* ---------------------------------------------------------------
 *  Close Button
 * ------------------------------------------------------------- */

.b2b-search-close {
    position: absolute;
    top: 4px;
    right: 16px;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 1.75rem !important;
    line-height: 1;
    cursor: pointer;
    color: var(--b2b-gray-600, #757575) !important;
    padding: 0;
    z-index: 1;
    transition: color 0.15s;
}

.b2b-search-close:hover,
.b2b-search-close:focus,
.b2b-search-close:active {
    color: var(--b2b-danger, #DC3545) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ---------------------------------------------------------------
 *  Search Header (hint + input + button)
 * ------------------------------------------------------------- */

.b2b-search-header {
    padding: 24px 24px 16px;
}

.b2b-search-hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--b2b-gray-600, #757575);
    margin-bottom: 8px;
    font-family: 'DM Sans', sans-serif;
}

.b2b-search-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.b2b-search-input {
    flex: 1;
    border: 1px solid #dadbdd !important;
    border-radius: 10px !important;
    background: #F8F9FA !important;
    font-size: 1.2rem;
    color: var(--b2b-text, #333) !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 10px 14px !important;
    font-family: 'DM Sans', sans-serif;
}

.b2b-search-input::placeholder {
    color: var(--b2b-gray-600, #757575);
    font-weight: 400;
}

.b2b-search-submit {
    background: var(--b2b-gold, #C5A059) !important;
    color: var(--b2b-white, #fff) !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 10px !important;
    font-size: 0.9375rem;
    font-weight: 700 !important;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: background 0.15s !important;
}

.b2b-search-submit:hover {
    background: var(--b2b-gold-light, #B08D4B) !important;
}

/* ---------------------------------------------------------------
 *  Search Body (status + results list)
 * ------------------------------------------------------------- */

.b2b-search-body {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--b2b-gray-100, #E0E0E0);
}

.b2b-search-status {
    padding: 16px 24px;
    font-size: 0.875rem;
    color: var(--b2b-gray-600, #757575);
    font-family: 'DM Sans', sans-serif;
    text-align: center;
}

.b2b-search-status:empty {
    display: none;
}

.b2b-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 480px;
    overflow-y: auto;
}

/* ---------------------------------------------------------------
 *  Result Item
 * ------------------------------------------------------------- */

.b2b-search-result-item {
    border-bottom: 1px solid var(--b2b-gray-100, #E0E0E0);
}

.b2b-search-result-item:last-child {
    border-bottom: none;
}

.b2b-search-result-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.b2b-search-result-link:hover {
    background: var(--b2b-gray-50, #F8F9FA);
}

.b2b-search-result-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--b2b-gray-50, #F8F9FA);
}

.b2b-search-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.b2b-search-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--b2b-navy, #1C1C1C);
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.b2b-search-result-meta {
    font-size: 0.8rem;
    color: var(--b2b-gray-600, #757575);
    font-family: 'DM Sans', sans-serif;
}

.b2b-search-result-price {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--b2b-navy, #1C1C1C);
    font-family: 'DM Sans', sans-serif;
    text-align: right;
    white-space: nowrap;
}

.b2b-search-result-price del {
    color: var(--b2b-gray-600, #757575);
    font-weight: 400;
    font-size: 0.8rem;
}

.b2b-search-no-price {
    color: var(--b2b-gray-600, #757575);
}

/* Out of stock items */
.b2b-search-result-item.is-out-of-stock .b2b-search-result-img {
    opacity: 0.5;
}

.b2b-search-result-item.is-out-of-stock .b2b-search-result-name {
    color: var(--b2b-gray-600, #757575);
}

/* ---------------------------------------------------------------
 *  Footer (count + show all)
 * ------------------------------------------------------------- */

.b2b-search-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid var(--b2b-gray-100, #E0E0E0);
    font-family: 'DM Sans', sans-serif;
}

.b2b-search-count {
    font-size: 0.8125rem;
    color: var(--b2b-gray-600, #757575);
}

.b2b-search-show-all {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--b2b-gold, #C5A059);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid var(--b2b-gold, #C5A059);
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.b2b-search-show-all:hover {
    background: var(--b2b-gold, #C5A059);
    color: var(--b2b-white, #fff);
}

/* ---------------------------------------------------------------
 *  Responsive
 * ------------------------------------------------------------- */

@media (max-width: 768px) {
    .b2b-search-modal-wrapper {
        padding: 12px;
    }

    .b2b-search-modal {
        margin-top: 16px;
        max-height: calc(100vh - 40px);
        border-radius: 12px;
    }

    .b2b-search-header {
        padding: 20px 16px 12px;
    }

    .b2b-search-form {
        flex-direction: column;
        gap: 10px;
    }

    .b2b-search-input {
        font-size: 1rem;
        text-align: center;
    }

    .b2b-search-submit {
        width: 100%;
        text-align: center;
    }

    .b2b-search-result-link {
        padding: 10px 16px;
        gap: 10px;
    }

    .b2b-search-result-img {
        width: 40px;
        height: 40px;
    }

    .b2b-search-result-name {
        font-size: 0.85rem;
    }

    .b2b-search-footer {
        padding: 10px 16px;
    }

    .b2b-search-results-list {
        max-height: 50vh;
    }
}
