/* Museluxe Smart Search - Amazon-style overlay search */

/* ==========================================
   HEADER SEARCH BAR REPLACEMENT
   ========================================== */

/* Hide original Elementor search widget internals */
.elementor-widget-search .e-search,
.elementor-widget-search .elementor-widget-container > search {
    display: none !important;
}

.mls-header-search {
    cursor: pointer;
    width: 100%;
}

.mls-header-search-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 16px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    min-width: 200px;
}

.mls-header-search-inner:hover {
    border-color: #1a1a1a;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mls-header-search-icon {
    color: #888;
    flex-shrink: 0;
}

.mls-header-search-text {
    color: #999;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Dark mode — black bg, white outline */
html.museluxe-dark-mode .mls-header-search-inner {
    background: #000000;
    border-color: #FFFFFF;
}

html.museluxe-dark-mode .mls-header-search-inner:hover {
    background: #111;
    border-color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

html.museluxe-dark-mode .mls-header-search-icon {
    color: #FFFFFF;
}

html.museluxe-dark-mode .mls-header-search-text {
    color: rgba(255, 255, 255, 0.6);
}

/* Widget search replacement (sidebar/footer) */
.mls-widget-search .mls-header-search-inner {
    min-width: 0;
}

@media (max-width: 767px) {
    .mls-header-search-inner {
        padding: 8px 12px;
        min-width: 0;
    }
    .mls-header-search-text {
        font-size: 13px;
    }
}

/* ==========================================
   OVERLAY & MODAL
   ========================================== */
.mls-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8vh;
    animation: mlsFadeIn 0.2s ease;
}

@keyframes mlsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mls-modal {
    background: #fff;
    width: 95%;
    max-width: 720px;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mlsSlideDown 0.25s ease;
}

@keyframes mlsSlideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================
   SEARCH HEADER / INPUT
   ========================================== */
.mls-search-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    gap: 12px;
}

.mls-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 0 14px;
    transition: background 0.2s, box-shadow 0.2s;
}

.mls-search-input-wrap:focus-within {
    background: #fff;
    box-shadow: 0 0 0 2px #1a1a1a;
}

.mls-search-icon {
    color: #999;
    flex-shrink: 0;
    margin-right: 10px;
}

#mls-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    padding: 12px 0;
    outline: none;
    font-family: inherit;
    color: #1a1a1a;
}

#mls-search-input::placeholder {
    color: #aaa;
}

.mls-clear-btn {
    background: #ddd;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mls-clear-btn:hover {
    background: #ccc;
}

.mls-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.mls-close:hover {
    color: #333;
}

/* ==========================================
   RESULTS CONTAINER
   ========================================== */
.mls-results {
    overflow-y: auto;
    padding: 16px 20px 20px;
    flex: 1;
}

.mls-section {
    margin-bottom: 20px;
}

.mls-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #999;
    margin: 0 0 10px 0;
    padding: 0;
}

/* ==========================================
   SUGGESTIONS (Autocomplete)
   ========================================== */
#mls-suggestions-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#mls-suggestions-list li {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

#mls-suggestions-list li:hover,
#mls-suggestions-list li.mls-active {
    background: #f5f5f5;
}

#mls-suggestions-list li .mls-suggestion-icon {
    color: #bbb;
    font-size: 12px;
    flex-shrink: 0;
}

#mls-suggestions-list li .mls-suggestion-type {
    font-size: 10px;
    color: #bbb;
    margin-left: auto;
    text-transform: uppercase;
}

#mls-suggestions-list li mark {
    background: none;
    font-weight: 700;
    color: #1a1a1a;
}

/* ==========================================
   CATEGORIES GRID
   ========================================== */
.mls-cat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mls-cat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    cursor: pointer;
}

.mls-cat-item:hover {
    background: #1a1a1a;
    color: #fff;
    transform: translateY(-1px);
}

.mls-cat-count {
    font-size: 11px;
    color: #999;
    background: #e5e5e5;
    border-radius: 10px;
    padding: 1px 7px;
}

.mls-cat-item:hover .mls-cat-count {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* ==========================================
   PRODUCTS GRID
   ========================================== */
.mls-product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.mls-product-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.mls-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mls-product-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f0f0f0;
}

.mls-product-info {
    padding: 10px;
}

.mls-product-title {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #1a1a1a;
}

.mls-product-category {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.mls-product-price {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
}

.mls-product-price del {
    color: #bbb;
    font-weight: 400;
    font-size: 11px;
}

.mls-product-price ins {
    text-decoration: none;
    color: #c0392b;
}

.mls-product-stock {
    font-size: 10px;
    color: #27ae60;
    margin-top: 2px;
}

.mls-product-stock.out-of-stock {
    color: #c0392b;
}

.mls-product-rating {
    font-size: 11px;
    color: #f39c12;
    margin-top: 2px;
}

/* ==========================================
   VIEW ALL RESULTS
   ========================================== */
.mls-view-all {
    text-align: center;
    padding: 12px;
    margin-top: 8px;
}

.mls-view-all a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: background 0.2s;
}

.mls-view-all a:hover {
    background: #333;
}

/* ==========================================
   NO RESULTS
   ========================================== */
.mls-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.mls-no-results-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.mls-no-results p {
    margin: 4px 0;
    font-size: 14px;
}

.mls-no-results-hint {
    color: #aaa;
    font-size: 13px !important;
}

/* ==========================================
   LOADING
   ========================================== */
.mls-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.mls-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: mlsSpin 0.7s linear infinite;
    margin: 0 auto 12px;
}

@keyframes mlsSpin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   TRENDING / POPULAR TAGS
   ========================================== */
.mls-trending-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mls-trending-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.mls-trending-tag:hover {
    background: #1a1a1a;
    color: #fff;
}

/* ==========================================
   KEYBOARD SHORTCUT HINT
   ========================================== */
.mls-kbd-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 999998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 640px) {
    .mls-overlay {
        padding-top: 0;
        align-items: stretch;
    }

    .mls-modal {
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .mls-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #mls-search-input {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

@media (max-width: 400px) {
    .mls-product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

