/* ============================================================
   PS Live Search — MD3 styled dropdown
   ============================================================ */

.ps-live-search-container {
    position: relative;
}

/* ── Dropdown list ── */
.ps-live-search-list {
    display: none;
    list-style: none;
    margin: 6px 0 0;
    padding: 6px;
    width: 100%;
    background: #ffffff;
    border: 1px solid #C4C6CF;
    border-radius: 16px;
    box-shadow: 0 6px 10px 4px rgba(0,0,0,.12), 0 2px 3px rgba(0,0,0,.25);
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 1050;
    overflow: hidden;
}
.ps-live-search-list.show {
    display: block;
}

/* ── Subheader (result count) ── */
.ps-live-search-list .ps-live-search-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #74777F;
    background: #F5F7FF;
    border-radius: 10px;
    margin-bottom: 4px;
    border: none;
}
.ps-live-search-list .ps-live-search-subheader > output {
    font-weight: 700;
    color: #1565C0;
}

/* ── Section header (category label) ── */
.ps-live-search-list .ps-live-search-header {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #74777F;
    padding: 10px 12px 4px;
    margin: 0;
    border: none;
    border-top: none;
}
.ps-live-search-list li:nth-of-type(2) .ps-live-search-header {
    margin-block-start: 0;
    border-top: none;
    padding-top: 6px;
}

/* ── Product item wrapper ── */
.ps-live-search-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px;
    transition: background-color 150ms cubic-bezier(0.2,0,0,1);
    margin-bottom: 2px;
}
.ps-live-search-item-wrapper:is(:hover, :focus-within) {
    background-color: #E3EEF9;
}
.ps-live-search-item-wrapper .ps-live-search-item {
    flex-grow: 1;
    min-width: 0;
}
.ps-live-search-item-wrapper .ps-live-search-item:is(:hover, :focus) {
    background-color: transparent;
}

/* ── Product item ── */
.ps-live-search-list .ps-live-search-item {
    display: flex;
    align-items: center;
    column-gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #1A1C20;
    transition: background-color 150ms cubic-bezier(0.2,0,0,1);
}
.ps-live-search-list .ps-live-search-item:is(:hover, :focus) {
    background-color: #E3EEF9;
}

/* Thumbnail */
.ps-live-search-list .ps-live-search-item .thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: #F5F7FF;
    border: 1px solid #C4C6CF;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ps-live-search-list .ps-live-search-item .thumb img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    padding: 2px;
}

/* Info block */
.ps-live-search-list .ps-live-search-item .info {
    flex: 1;
    display: flex;
    flex-direction: column;
    row-gap: 2px;
    min-width: 0;
}
.ps-live-search-list .ps-live-search-item strong.name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1A1C20;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.ps-live-search-list .ps-live-search-item .description {
    font-size: 0.78rem;
    color: #74777F;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Attributes */
.ps-live-search-list .ps-live-search-item .attributes {
    display: flex;
    flex-direction: column;
    row-gap: 1px;
    font-size: 0.75rem;
    color: #74777F;
}
.ps-live-search-list .ps-live-search-item .attribute strong {
    color: #43474E;
    font-weight: 600;
}

/* Prices block */
.ps-live-search-list .ps-live-search-item .prices {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    row-gap: 2px;
    padding-left: 8px;
}
.ps-live-search-list .ps-live-search-item .price-new {
    font-size: 1rem;
    font-weight: 700;
    color: #1A1C20;
    white-space: nowrap;
}
.ps-live-search-list .ps-live-search-item .price-old {
    font-size: 0.78rem;
    color: #74777F;
    text-decoration: line-through;
    white-space: nowrap;
}

/* ── Cart button ── */
.ps-live-search-cart {
    padding: 0 8px 0 4px;
    flex-shrink: 0;
}
.ps-live-search-cart button {
    border: none;
    background: #E65100;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 150ms cubic-bezier(0.2,0,0,1);
    flex-shrink: 0;
}
.ps-live-search-cart button:hover {
    background: #BF360C;
}

/* ── Loading indicator ── */
.ps-live-search-item-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 16px;
    font-size: 0.875rem;
    color: #74777F;
}
.ps-live-search-item-loading::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #C4C6CF;
    border-top-color: #1565C0;
    border-radius: 50%;
    animation: ps-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }

/* ── "Show all results" link ── */
.ps-live-search-list .ps-live-search-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    margin-top: 4px;
    border-top: 1px solid #C4C6CF;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1565C0;
    text-decoration: none;
    border-radius: 0 0 10px 10px;
    transition: background-color 150ms;
}
.ps-live-search-list .ps-live-search-more:hover {
    background: #E3EEF9;
}
.ps-live-search-list .ps-live-search-item-text {
    padding: 8px 12px;
    color: #74777F;
    font-size: 0.875rem;
}

/* ── Overlay (mobile) ── */
/* z-index must be BELOW header stacking context (1030) so search results are visible */
.ps-live-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1020;
}
body.ps-live-search-open { overflow: hidden; }

/* ── Mobile header (close button) ── */
.ps-live-search-mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #C4C6CF;
}
.ps-live-search-mobile-header span {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1A1C20;
}
.ps-live-search-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #74777F;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 50%;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 150ms;
}
.ps-live-search-close:hover { background: #E3EEF9; color: #1565C0; }

/* ── Toast notifications ── */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
}
.toast {
    border-radius: 12px;
    box-shadow: 0 4px 8px 3px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.25);
    border: none;
}
.toast-body a { color: #fff; text-decoration: underline; }

/* ── Mobile: full-screen panel ── */
@media (max-width: 768px) {
    .ps-live-search-list {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        border-radius: 0;
        margin-top: 0;
        z-index: 1050;
        border: none;
        box-shadow: none;
        padding: 0 0 80px;
    }
    .ps-live-search-container {
        position: static;
    }
    .ps-live-search-mobile-header {
        display: flex;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 1;
    }
    .ps-live-search-list .ps-live-search-subheader {
        border-radius: 0;
        margin-bottom: 0;
    }
}
