/*
 * Product pictures in the POS search suggestions.
 *
 * At a counter you are matching what is in your hand against a list, and three
 * products called "PlayStation 4 Slim", "PlayStation 4 Pro" and "PlayStation 4
 * Standard" are near-impossible to tell apart by name at speed. A thumbnail
 * makes the row identifiable at a glance.
 *
 * Scoped to the autocomplete menu so nothing else on the till is affected.
 */

.ui-autocomplete {
    max-height: 62vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px !important;
    border-radius: 12px;
    border: 1px solid #e6e9ef;
    box-shadow: 0 14px 36px rgba(16, 24, 40, .16);
    z-index: 2200 !important;
}

.ui-autocomplete > li {
    border-radius: 9px;
    margin-bottom: 2px;
    padding: 0 !important;
}

.ui-autocomplete > li:last-child {
    margin-bottom: 0;
}

/* ---- the row ---- */

.pos-sug {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 9px;
    min-height: 56px;
}

.pos-sug-img {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 9px;
    border: 1px solid #eceff3;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-sug-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* No picture: a neutral tile keeps every row the same height, so the list
   does not jump around as you type. */
.pos-sug-img-empty {
    background: #f1f3f6 url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aeb4bd' stroke-width='1.6'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M3 15l4-4 4 4 3-3 4 4'/%3E%3Ccircle cx='9' cy='9' r='1.4'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
}

.pos-sug-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.pos-sug-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    color: #16181d;
    /* Two lines maximum, so one long name cannot push the rest off screen. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pos-sug-meta {
    font-size: 12px;
    color: #8a8f98;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-sug-stock {
    color: #12704a;
    font-weight: 600;
}

.pos-sug-out {
    color: #ad3125;
    font-weight: 600;
}

/* jQuery UI marks unavailable rows disabled; keep them readable but clearly
   not selectable rather than washing the text out to near-invisible. */
.ui-autocomplete > li.ui-state-disabled {
    opacity: 1;
    background: #fcfcfd;
}

.ui-autocomplete > li.ui-state-disabled .pos-sug-name,
.ui-autocomplete > li.ui-state-disabled .pos-sug-meta {
    color: #9aa0a8;
}

.ui-autocomplete > li.ui-state-disabled .pos-sug-img {
    filter: grayscale(1);
    opacity: .7;
}

/* Hover / keyboard highlight */
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-autocomplete > li:hover:not(.ui-state-disabled) {
    background: #eef2ff !important;
    border: 0 !important;
    margin: 0 !important;
    border-radius: 9px;
}

.ui-autocomplete .ui-menu-item-wrapper.ui-state-active .pos-sug-name {
    color: #1f2b64;
}

/* ---- phones ---- */

@media (max-width: 767px) {
    .ui-autocomplete {
        max-height: 54vh;
    }

    .pos-sug {
        min-height: 62px;
        padding: 9px;
    }

    .pos-sug-img {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
    }

    .pos-sug-name {
        font-size: 15px;
    }

    .pos-sug-meta {
        font-size: 12.5px;
    }
}
