/**
 * Roket Ajax Search – Styles
 * Overlay, dropdown, results UI matching Dehome header design
 */

/* ==============================
   OVERLAY
   ============================== */
.ras-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

.ras-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Keep header above overlay + allow dropdown overflow */
body.ras-search-active .main-header {
    z-index: 10001;
    overflow: visible !important;
}
body.ras-search-active #masthead {
    overflow: visible !important;
}

/* ==============================
   DROPDOWN CONTAINER – absolute inside header
   ============================== */
.ras-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10002;
    background: #fff;
    border-top: none;
    max-height: 60vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    scrollbar-width: thin;
}

.ras-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* When search is active, keep the search input above overlay */
body.ras-search-active .header-search-right,
body.ras-search-active .header-search-mobile {
    z-index: 10002;
}

/* Keep search form border style normal during search */
body.ras-search-active .search-form {
    border-color: #949494;
    position: relative;
    z-index: 10002;
}

/* ==============================
   SECTIONS
   ============================== */
.ras-section {
    padding: 8px 0;
}

/* .ras-section + .ras-section {
    border-top: 1px solid #f0f0f0;
} */

.ras-section-title {
    padding: 8px 20px 4px;
    font-size: 14px;
    line-height: 150%;
    color: #000;
    text-transform: none;
    font-family: 'Inter', sans-serif;
}

/* ==============================
   RESULT ITEMS – COMMON
   ============================== */
.ras-item {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    text-decoration: none;
    color: #000;
    font-size: 14px;
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
    transition: background 0.15s ease;
    cursor: pointer;
}

.ras-item:hover,
.ras-item:focus {
    background: #f8f8f8;
    text-decoration: none;
    color: #000;
}

.ras-item strong {
    font-weight: 700;
}

/* ==============================
   CATEGORY ITEMS
   ============================== */
.ras-category-item {
    font-size: 14px;
    font-weight: 400;
}

/* ==============================
   PRODUCT ITEMS
   ============================== */
.ras-product-item {
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
}

.ras-product-thumb {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f8f8;
}

.ras-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ras-product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ras-product-name {
    font-size: 14px;
    font-weight: 400;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ras-product-price {
    font-size: 13px;
    font-weight: 500;
    color: #000;
}

.ras-product-price del {
    color: #999;
    font-weight: 400;
}

.ras-product-price ins {
    text-decoration: none;
    font-weight: 600;
}

/* ==============================
   VIEW ALL LINK
   ============================== */
.ras-view-all {
    border-top: 1px solid #e0e0e0;
    padding: 12px 20px;
    text-align: center;
}

.ras-view-all a {
    color: #000;
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    font-family: 'Inter', sans-serif;
    transition: color 0.15s ease;
}

.ras-view-all a:hover {
    color: #555;
}

/* ==============================
   NO RESULTS
   ============================== */
.ras-no-results {
    padding: 24px 20px;
    text-align: center;
    color: #808080;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

/* ==============================
   LOADING SPINNER
   ============================== */
.ras-loading {
    padding: 24px 20px;
    text-align: center;
}

.ras-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2px solid #e0e0e0;
    border-top-color: #000;
    border-radius: 50%;
    animation: ras-spin 0.6s linear infinite;
}

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

/* ==============================
   MOBILE (≤1024px)
   ============================== */
@media (max-width: 1024px) {

    /* White overlay on mobile */
    .ras-overlay {
        background: #fff;
    }

    /* Results blend into the white overlay – fill all space below header */
    .ras-dropdown {
        left: 0 !important;
        width: 100% !important;
        height: calc(100vh - 100%);
        height: calc(100dvh - 100%);
        max-height: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    /* Account for WP admin bar (32px desktop, 46px mobile ≤782px) */
    .admin-bar .ras-dropdown {
        height: calc(100vh - 100% - 32px);
        height: calc(100dvh - 100% - 32px);
    }
    @media (max-width: 782px) {
        .admin-bar .ras-dropdown {
            height: calc(100vh - 100% - 46px);
            height: calc(100dvh - 100% - 46px);
        }
    }

    /* Always show X button on mobile when search is active */
    body.ras-search-active .header-search-mobile .search-clear-btn {
        display: inline-flex !important;
    }

    /* Hide search icon on mobile when search is active */
    body.ras-search-active .header-search-mobile .search-button {
        display: none;
    }

    .ras-section-title {
        padding: 10px 16px 4px;
        font-size: 12px;
    }

    .ras-item {
        padding: 10px 16px;
        font-size: 15px;
    }

    .ras-product-item {
        padding: 10px 16px;
    }

    .ras-view-all {
        padding: 14px 16px;
        margin-top: auto;
        background: #fff;
    }

    .ras-view-all a {
        font-size: 15px;
    }
}

/* ==============================
   SCROLLBAR
   ============================== */
.ras-dropdown::-webkit-scrollbar {
    width: 4px;
}

.ras-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.ras-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.ras-dropdown::-webkit-scrollbar-thumb:hover {
    background: #999;
}
