/* ============================================
   MERCURY ADVANCED SEARCH — v2
   ============================================ */

/* --- OVERLAY OVERRIDE --- */
.space-header-search-block {
    background: rgba(26, 27, 37, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.space-header-search-block .mercury-search-notification-container {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 60px 20px 40px;
    position: relative;
    top: 8vh;
}
/* Prevent Mercury from overriding search input sizing */
.space-header-search-block .mas-input-wrap,
.space-header-search-block .mas,
.space-header-search-block .mas-form {
    width: 100% !important;
    max-width: 100% !important;
}
.space-header-search-block input[type="search"] {
    width: 100% !important;
    float: none !important;
    font-size: inherit !important;
    padding: 18px 0 !important;
    border: none !important;
    border-bottom: none !important;
    border-radius: 0 !important;
    height: auto !important;
    background: transparent !important;
}

/* --- CLOSE BUTTON --- */
.desktop-search-close-button {
    top: 24px !important;
    right: 28px !important;
    z-index: 10;
}
.desktop-search-close-button .to-right,
.desktop-search-close-button .to-left {
    background-color: rgba(255,255,255,0.5) !important;
    width: 24px !important;
    height: 2px !important;
}
.desktop-search-close-button:hover .to-right,
.desktop-search-close-button:hover .to-left {
    background-color: #fff !important;
}

/* --- FORM CONTAINER --- */
.mas {
    font-family: 'Roboto', sans-serif;
    color: #fff;
}
.mas-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* --- INPUT --- */
.mas-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 0 18px;
    transition: all 0.25s;
}
.mas-input-wrap:focus-within {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 4px rgba(92, 38, 152, 0.2);
}
.mas-icon-search {
    flex-shrink: 0;
    color: rgba(255,255,255,0.4);
    margin-right: 14px;
}
.mas-input-wrap:focus-within .mas-icon-search {
    color: rgba(255,255,255,0.7);
}
#mas-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #fff !important;
    font-size: 1.35em;
    font-weight: 600;
    padding: 18px 0;
    height: auto !important;
    width: 100%;
    box-shadow: none !important;
}
#mas-input::placeholder {
    color: rgba(255,255,255,0.35);
    font-weight: 400;
}
.mas-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    font-size: 0.7em;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    font-family: inherit;
    pointer-events: none;
    flex-shrink: 0;
}
.mas-clear {
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.5);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.mas-clear:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* --- CATEGORY TABS --- */
.mas-cats {
    display: flex;
    gap: 6px;
    padding: 14px 0 0;
}
.mas-cat {
    padding: 7px 18px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px;
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.mas-cat:hover {
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.8);
}
.mas-cat.active {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}

/* --- TRENDING TAGS --- */
.mas-trending {
    padding: 24px 0 0;
}
.mas-trending-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.3);
    margin-bottom: 12px;
}
.mas-trending-label svg {
    color: #f59e0b;
}
.mas-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.mas-tag {
    padding: 8px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: rgba(255,255,255,0.65);
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.mas-tag:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    transform: translateY(-1px);
}

/* --- RESULTS --- */
.mas-results {
    margin-top: 16px;
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.mas-results::-webkit-scrollbar { width: 4px; }
.mas-results::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* --- RESULT ITEM --- */
.mas-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    transition: background 0.15s;
    cursor: pointer;
}
.mas-item:hover,
.mas-item.is-active {
    background: rgba(255,255,255,0.08);
}
.mas-item-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.mas-item-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}
.mas-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mas-item-title {
    font-size: 0.95em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mas-item-meta {
    font-size: 0.8em;
    color: #f59e0b;
    font-weight: 700;
    flex-shrink: 0;
}
.mas-item-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 50px;
    font-size: 0.65em;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.85;
    width: fit-content;
}
.mas-item-arrow {
    flex-shrink: 0;
    color: rgba(255,255,255,0.15);
    transition: all 0.15s;
}
.mas-item:hover .mas-item-arrow,
.mas-item.is-active .mas-item-arrow {
    color: rgba(255,255,255,0.5);
    transform: translateX(3px);
}

/* --- VIEW ALL --- */
.mas-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
    margin-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
    transition: color 0.2s;
}
.mas-view-all:hover {
    color: #fff;
}

/* --- EMPTY STATE --- */
.mas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    color: rgba(255,255,255,0.35);
    font-size: 0.9em;
    text-align: center;
}

/* --- LOADING --- */
.mas-loading {
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: rgba(255,255,255,0.4);
    font-size: 0.85em;
}
.mas-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: rgba(255,255,255,0.5);
    border-radius: 50%;
    animation: mas-spin 0.6s linear infinite;
}
@keyframes mas-spin {
    to { transform: rotate(360deg); }
}

/* --- RESPONSIVE --- */
@media screen and (max-width: 768px) {
    .space-header-search-block .mercury-search-notification-container {
        top: 2vh;
        padding: 30px 16px 20px;
    }
    #mas-input {
        font-size: 1.1em;
    }
    .mas-kbd {
        display: none;
    }
    .mas-cats {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .mas-cats::-webkit-scrollbar { display: none; }
    .mas-cat {
        white-space: nowrap;
        padding: 6px 14px;
        font-size: 0.78em;
    }
    .mas-item-thumb {
        width: 40px;
        height: 40px;
    }
    .mas-results {
        max-height: 50vh;
    }
}
