/* Roomvo Product Search — popup styles. Mirrors the s3.png demo layout. */

.rps-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 4vh 16px;
    background: rgba(0, 0, 0, 0.5);
    -webkit-overflow-scrolling: touch;
}

.rps-overlay[hidden] {
    display: none;
}

/* The `hidden` HTML attribute must win over the display rules below
   (author display:flex/grid/block otherwise overrides the UA [hidden] rule,
   which kept the spinner and other toggled blocks permanently visible). */
.rps-overlay [hidden] {
    display: none !important;
}
.rps-overlay [hidden]+.rps-categories{
    margin-top: 0
}

body.rps-open {
    overflow: hidden;
}

.rps-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1120px;
    max-height: 92vh;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

/* ---------- Header / search bar ---------- */

.rps-modal__header {
    border-bottom: 1px solid #ececec;
    padding: 14px 18px;
}

.rps-searchbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rps-searchbar__icon {
    display: inline-flex;
    color: var(--global-palette1);
    flex: 0 0 auto;
}

.rps-input {
    flex: 1 1 auto;
    border: none;
    outline: none;
    font-size: 16px;
    line-height: 1.4;
    padding: 6px 0;
    background: transparent;
    color: #1a1a1a;
    box-shadow: none;
}

.rps-input::placeholder {
    color: #b0b0b0;
}

.rps-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #777;
    cursor: pointer;
    border-radius: 4px;
}

.rps-close:hover {
    background: #f2f2f2;
    color: #111;
}

/* ---------- Body layout ---------- */

.rps-modal__body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.rps-sidebar {
    flex: 0 0 280px;
    max-width: 280px;
    padding: 22px 20px;
    border-right: 1px solid #ececec;
    overflow-y: auto;
}

.rps-results {
    flex: 1 1 auto;
    min-width: 0;
    padding: 22px 24px;
    overflow-y: auto;
}

.rps-heading {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e6e6e6;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #8a8a8a;
}

.rps-categories {
    margin-top: 24px;
}

/* ---------- Sidebar: suggestions & categories ---------- */

.rps-suggestions__list,
.rps-categories__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rps-suggestions__list li,
.rps-categories__list li {
    margin: 0;
}

.rps-suggestion {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 0;
    border: none;
    background: transparent;
    font-size: 14px;
    color: #333;
    text-align: left;
    cursor: pointer;
}

.rps-suggestion__icon {
    color: var(--global-palette1);
    flex: 0 0 auto;
}

.rps-suggestion:hover {
    color: #000;
}

.rps-category {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 7px 0;
    font-size: 14px;
    color: #333;
    text-decoration: none;
}

.rps-category:hover {
    color: #000;
    text-decoration: underline;
}

.rps-category__count {
    font-size: 12px;
    color: #aaa;
}

.rps-view-all {
    display: block;
    margin-top: 24px;
    padding: 13px 16px;
    background: #1a1a1a;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 2px;
    transition: background 0.15s ease;
}

.rps-view-all:hover {
    background: #000;
    color: #fff;
}

/* ---------- Results: product grid ---------- */

/* The popup reuses the shop listing card (.plp-product-card, styled by the
   theme's plp-product-card.css). Here we only lay the <li> cards out in a grid;
   the card internals come from the listing stylesheet. */
.rps-products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ---------- States ---------- */

.rps-empty {
    padding: 30px 0;
    color: #888;
    font-size: 15px;
}

/* Loading spinner lives inside the search bar (right of the input), shown
   while a query is in flight — not as a block under the results. */
.rps-searchbar__spinner {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: rps-spin 0.8s linear infinite;
}

@keyframes rps-spin {
    to { transform: rotate(360deg); }
}

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

@media (max-width: 900px) {
    .rps-products {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .rps-overlay {
        padding: 0;
    }

    .rps-modal {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .rps-modal__body {
        flex-direction: column;
    }

    .rps-sidebar {
        flex: 0 0 auto;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid #ececec;
        display: none;
    }
}
