/* Container cho form tìm kiếm */
.my-unified-search-form-container {
    position: relative;
    max-width: 500px;
}

.my-unified-search-form .search-field {
    width: 100%;
    padding: 8px 20px 8px 40px;
    border: 1px solid #ddd;
    border-radius: 50px; 
    font-size: 13px;
    transition: box-shadow 0.2s ease-in-out;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: left 15px center;
}

.my-unified-search-form .search-field:focus {
    outline: none;
    border-color: #ddd;
}

/* Popup chứa kết quả */
.my-unified-search-popup {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow: hidden; 
}

.search-popup-content {
    max-height: 450px;
    overflow-y: auto;
    padding: 23px 0;
}

/* Loader */
.search-loader {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0,0,0,0.1);
    border-left-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Danh sách kết quả */
.search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-result-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    text-decoration: none;
    color: #333;
    border-bottom: none; 
}

.search-result-item:not(:last-child) a {
    border-bottom: 1px solid #eee;
}

.search-result-item a:hover {
    background-color: #f5f5f5;
}

.result-thumbnail, .result-thumbnail-placeholder {
    width: 45px;
    height: 45px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 6px;
}
.result-thumbnail-placeholder {
    background-color: #f0f0f0;
}

.result-details {
    flex-grow: 1;
    min-width: 0;
}

.result-type {
    font-size: 11px;
    color: #777;
    display: block;
}

.result-title {
    font-size: 11px;
    font-weight: 600;
    margin: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-excerpt {
    font-size: 11px;
    color: #555;
    margin: 0;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
}

.result-price {
    font-size: 11px;
    font-weight: bold;
    color: #d90429;
    padding-left: 10px;
    white-space: nowrap;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #777;
}

/* --- CSS CHO GIAO DIỆN BAN ĐẦU --- */

.initial-state-section {
    padding: 10px 20px;
    border-bottom: 1px solid #f0f0f0;
}
.initial-state-section:last-child {
    border-bottom: none;
}

.initial-state-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Định dạng cho nội dung shortcode */
.initial-state-content {
    font-size: 14px;
}
.initial-state-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.initial-state-content ul li a {
    display: block;
    padding: 6px 0;
    color: #555;
    text-decoration: none;
    transition: color 0.2s;
}
.initial-state-content ul li a:hover {
    color: #0073aa;
}

/* Định dạng cho lịch sử tìm kiếm */
.previous-searches-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.previous-searches-list li a.previous-search-term {
    display: inline-block;
    padding: 5px 12px;
    background-color: #f5f5f5;
    border-radius: 20px;
    font-size: 13px;
    color: #444;
    text-decoration: none;
    transition: background-color 0.2s;
}

.previous-searches-list li a.previous-search-term:hover {
    background-color: #e0e0e0;
}
/* --- CSS CHO GIAO DIỆN GỢI Ý NÂNG CAO --- */

.mus-section {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}
.mus-section:last-child {
    border-bottom: none;
}

.mus-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Danh sách gợi ý tìm kiếm (text) */
.mus-suggestion-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.mus-suggestion-list li a {
    display: block;
    padding: 8px 0;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}
.mus-suggestion-list li a:hover {
    color: #0073aa;
}

/* Tinh chỉnh lại giao diện gợi ý sản phẩm */
.search-results-list .result-details {
    display: flex;
    align-items: center;
}
.search-results-list .result-details .result-type,
.search-results-list .result-details .result-excerpt {
    display: none;
}
.search-results-list .result-details .result-title {
    font-size: 14px;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.initial-state-section {
    padding: 10px 20px;
    border-bottom: 1px solid #f0f0f0;
}
.initial-state-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.initial-state-content a:hover {
    color: #0073aa;
}

/*
==============================================
--- XỬ LÝ DỨT ĐIỂM: ẨN NÚT "HỦY BỎ" TRÊN DESKTOP ---
==============================================
*/
#my-unified-search-popup .mus-close-btn {
    display: none !important;
}


/*
==============================================
--- CSS CHO GIAO DIỆN MOBILE ---
==============================================
*/
@media (max-width: 768px) {
    body.mus-search-active {
        overflow: hidden;
    }

    .my-unified-search-popup.mus-fullscreen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        border: none;
        background: #fff;
        display: flex;
        flex-direction: column;
        z-index: 99999;
    }

    .mus-popup-mobile-header {
        display: flex;
        align-items: center;
        padding: 10px 15px;
        border-bottom: 1px solid #e0e0e0;
        flex-shrink: 0;
    }

    .mus-mobile-search-form-container {
        flex-grow: 1;
    }

    .mus-mobile-search-form-container .search-field {
        width: 100%;
        padding: 8px 20px 8px 40px;
        border: 1px solid #ddd;
        border-radius: 50px;
        font-size: 13px;
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
        background-repeat: no-repeat;
        background-position: left 15px center;
    }
     .mus-mobile-search-form-container .search-field:focus {
        outline: none;
        border-color: #ddd;
    }

    /* HIỂN THỊ LẠI NÚT "HỦY BỎ" TRÊN MOBILE */
    #my-unified-search-popup .mus-close-btn {
        display: inline-block !important; /* Đảm bảo nút luôn hiển thị trên mobile */
        background: none;
        border: none;
        font-size: 16px;
        color: #0073aa;
        cursor: pointer;
        padding: 5px 0 5px 15px;
        margin-left: 10px;
        white-space: nowrap;
        font-weight: 500;
    }
    
    .my-unified-search-popup.mus-fullscreen .search-popup-content {
        flex-grow: 1;
        overflow-y: auto;
        max-height: none;
    }

    .mus-popup-mobile-header {
        display: none;
    }
    
    .my-unified-search-popup.mus-fullscreen .mus-popup-mobile-header {
        display: flex;
    }

    .initial-state-content ul li a {
        position: relative;
        padding-left: 30px;
        font-size: 14px;
        line-height: 1.5;
    }

    .initial-state-content ul li a::before {
        content: '';
        position: absolute;
        left: 5px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
        background-color: #333;
        mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16"><path d="M7.247 4.86c.13-.13.34-.13.47 0l2.5 2.5a.33.33 0 0 1 0 .47l-2.5 2.5a.33.33 0 0 1-.47 0a.33.33 0 0 1 0-.47l2.265-2.265L7.247 5.33a.33.33 0 0 1 0-.47z" fill-rule="evenodd"></path></svg>');
        mask-repeat: no-repeat;
        mask-size: contain;
        -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16"><path d="M7.247 4.86c.13-.13.34-.13.47 0l2.5 2.5a.33.33 0 0 1 0 .47l-2.5 2.5a.33.33 0 0 1-.47 0a.33.33 0 0 1 0-.47l2.265-2.265L7.247 5.33a.33.33 0 0 1 0-.47z" fill-rule="evenodd"></path></svg>');
        -webkit-mask-repeat: no-repeat;
        -webkit-mask-size: contain;
    }

    .previous-searches-list {
        display: block;
        gap: 0;
    }

    .previous-searches-list li {
        width: 100%;
    }
    
    .previous-searches-list li a.previous-search-term {
        background-color: transparent;
        border-radius: 0;
        padding: 8px 0 8px 30px;
        font-size: 14px;
        color: #333;
        display: block;
        width: 100%;
        position: relative;
    }

    .previous-searches-list li a.previous-search-term::before {
        content: '';
        position: absolute;
        left: 5px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
        background-color: #777;
        mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16"><path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z"/><path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z"/></svg>');
        mask-repeat: no-repeat;
        mask-size: contain;
        -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16"><path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z"/><path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z"/></svg>');
        -webkit-mask-repeat: no-repeat;
        -webkit-mask-size: contain;
    }

     .previous-searches-list li a.previous-search-term:hover {
        background-color: #f5f5f5;
    }
}