/* ==========================================================================
   REDESIGNED SEARCH BAR - Madara Child X
   ========================================================================== */

.menu-right #search-sidebar {
    position: relative;
}

.menu-right #search-sidebar form {
    margin-bottom: 0;
    position: relative;
    display: flex;
    align-items: center;
}

/* Polished glassmorphism input */
.menu-right #search-sidebar input[type="text"] {
    width: 220px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.03) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 20px;
    padding: 10px 44px 10px 38px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.05);
}

.menu-right #search-sidebar input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    font-size: 13.5px;
    letter-spacing: 0.3px;
}

.menu-right #search-sidebar input[type="text"]:focus {
    width: 300px;
    border-color: var(--red, rgba(209, 53, 53, 0.6));
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 0 0 3px rgba(209, 53, 53, 0.15), inset 0 1px 0 rgba(255,255,255,0.08);
    outline: none;
}

.menu-right #search-sidebar input[type="text"]:focus::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Search icon */
.menu-right #search-sidebar:before {
    content: '\f002';
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 13px;
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    z-index: 2;
    transition: color 0.3s ease;
    pointer-events: none;
}

.menu-right #search-sidebar:focus-within:before {
    color: var(--red, rgba(209, 53, 53, 0.8));
}

/* Submit button — colored pill */
.menu-right #search-sidebar button[type="submit"] {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 6px;
    background: var(--red, rgb(209, 53, 53));
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.85;
    padding: 0;
}

.menu-right #search-sidebar button[type="submit"]:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 2px 8px rgba(209, 53, 53, 0.4);
}

.menu-right #search-sidebar button[type="submit"] i {
    font-size: 14px;
    line-height: 1;
}

/* Light theme search bar */
body.text-ui-light .menu-right #search-sidebar input[type="text"] {
    background: linear-gradient(135deg, rgba(0,0,0,0.04) 0%, rgba(0,0,0,0.02) 100%);
    border-color: rgba(0, 0, 0, 0.1);
    color: #222;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
}

body.text-ui-light .menu-right #search-sidebar input[type="text"]::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

body.text-ui-light .menu-right #search-sidebar input[type="text"]:focus {
    background: linear-gradient(135deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.03) 100%);
    border-color: var(--red, rgba(209, 53, 53, 0.5));
    box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 0 0 3px rgba(209, 53, 53, 0.1), inset 0 1px 0 rgba(255,255,255,0.8);
}

body.text-ui-light .menu-right #search-sidebar:before {
    color: rgba(0, 0, 0, 0.35);
}

body.text-ui-light .menu-right #search-sidebar:focus-within:before {
    color: var(--red, rgba(209, 53, 53, 0.7));
}

/* Responsive search bar */
@media (max-width: 991px) {
    .menu-right #search-sidebar input[type="text"] {
        width: 180px;
    }
    .menu-right #search-sidebar input[type="text"]:focus {
        width: 220px;
    }
}

@media (max-width: 767px) {
    .menu-right #search-sidebar input[type="text"],
    .menu-right #search-sidebar input[type="text"]:focus {
        width: 100%;
    }
}

/* Mobile menu search */
.mobile-menu #search-sidebar input[type="text"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 44px 10px 38px;
    color: #fff;
    font-size: 14px;
}

.mobile-menu #search-sidebar input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.mobile-menu #search-sidebar {
    position: relative;
    padding: 10px 15px;
}

.mobile-menu #search-sidebar:before {
    left: 28px;
}

.mobile-menu #search-sidebar .btn-search {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--red, rgb(209, 53, 53));
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   ENHANCED AUTOCOMPLETE DROPDOWN
   ========================================================================== */

.manga-autocomplete.enhanced-search-dropdown,
.site-header .c-header__top .manga-autocomplete.ui-autocomplete.enhanced-search-dropdown,
.c-search-header__wrapper .manga-autocomplete.ui-autocomplete.enhanced-search-dropdown {
    max-height: 450px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #1c1c2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
    padding: 6px 0;
    z-index: 99999 !important;
    margin-top: 8px;
    min-width: 400px !important;
    width: auto !important;
}

.enhanced-search-dropdown::-webkit-scrollbar { width: 5px; }
.enhanced-search-dropdown::-webkit-scrollbar-track { background: transparent; }
.enhanced-search-dropdown::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
.enhanced-search-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* Reset jQuery UI + old theme styles */
.enhanced-search-dropdown .ui-menu-item { padding: 0; margin: 0; border: none; list-style: none; }
.enhanced-search-dropdown .ui-menu-item .ui-menu-item-wrapper { padding: 0; margin: 0; border: none; background: none; }
.enhanced-search-dropdown .ui-menu-item .ui-menu-item-wrapper.ui-state-active,
.enhanced-search-dropdown .ui-menu-item .ui-menu-item-wrapper.ui-state-focus { background: none !important; border: none !important; margin: 0; }

.site-header .c-header__top .manga-autocomplete.ui-autocomplete.enhanced-search-dropdown > li:hover,
.c-search-header__wrapper .manga-autocomplete.ui-autocomplete.enhanced-search-dropdown > li:hover { background: none; color: inherit; }

/* Result item */
.enhanced-search-dropdown .search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 14px;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.enhanced-search-dropdown .search-result-item:hover,
.enhanced-search-dropdown .ui-state-active .search-result-item,
.enhanced-search-dropdown .ui-state-focus .search-result-item {
    background: rgba(255, 255, 255, 0.06);
}

.enhanced-search-dropdown li:last-child .search-result-item { border-bottom: none; }

/* Thumbnail */
.enhanced-search-dropdown .search-result-thumb {
    width: 48px; min-width: 48px; height: 66px;
    border-radius: 6px; overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.enhanced-search-dropdown .search-result-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.enhanced-search-dropdown .search-result-thumb .no-thumb { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.15); font-size: 22px; }

/* Info */
.enhanced-search-dropdown .search-result-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 2px 0; }

.enhanced-search-dropdown .search-result-title {
    font-size: 14px; font-weight: 600; color: #eee;
    line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-family: 'Urbanist', sans-serif;
}

.enhanced-search-dropdown .manga-text-highlight { color: var(--red, #d13535); font-weight: 700; }

/* Genres */
.enhanced-search-dropdown .search-result-genres { display: flex; flex-wrap: wrap; gap: 4px; }
.enhanced-search-dropdown .search-genre-tag {
    font-size: 10px; padding: 2px 7px; border-radius: 4px;
    background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.45);
    white-space: nowrap; line-height: 1.5; font-weight: 500; letter-spacing: 0.2px;
}

/* Meta */
.enhanced-search-dropdown .search-result-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(255,255,255,0.35); }

.enhanced-search-dropdown .search-meta-status { padding: 2px 7px; border-radius: 4px; font-weight: 700; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.5px; }
.enhanced-search-dropdown .search-meta-status.status-ongoing,
.enhanced-search-dropdown .search-meta-status.status-on-going { background: rgba(46,204,113,0.12); color: #2ecc71; }
.enhanced-search-dropdown .search-meta-status.status-completed,
.enhanced-search-dropdown .search-meta-status.status-end { background: rgba(52,152,219,0.12); color: #5dade2; }
.enhanced-search-dropdown .search-meta-status.status-hiatus,
.enhanced-search-dropdown .search-meta-status.status-on-hold { background: rgba(241,196,15,0.12); color: #f1c40f; }
.enhanced-search-dropdown .search-meta-status.status-canceled { background: rgba(231,76,60,0.12); color: #e74c3c; }

.enhanced-search-dropdown .search-meta-type,
.enhanced-search-dropdown .search-meta-chapters { color: rgba(255,255,255,0.3); font-weight: 500; }

/* No results */
.enhanced-search-dropdown .search-no-results { padding: 20px 14px; text-align: center; color: rgba(255,255,255,0.35); font-size: 13px; font-weight: 500; }

/* View all */
.enhanced-search-dropdown .search-view-all { padding: 10px 14px; text-align: center; border-top: 1px solid rgba(255,255,255,0.06); cursor: pointer; margin-top: 2px; }
.enhanced-search-dropdown .search-view-all a { color: var(--red, #d13535); font-size: 12px; font-weight: 700; text-decoration: none; letter-spacing: 0.3px; transition: opacity 0.2s; }
.enhanced-search-dropdown .search-view-all a:hover { opacity: 0.8; text-decoration: none; }

/* Loading */
#search-sidebar .search-loading { position: absolute; right: 50px; top: 50%; transform: translateY(-50%); display: none; }
#search-sidebar.is-loading .search-loading { display: block; }
#search-sidebar .search-loading::after {
    content: ''; display: block; width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.15); border-top-color: var(--red, rgba(209,53,53,0.8));
    border-radius: 50%; animation: search-spin 0.6s linear infinite;
}
@keyframes search-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   LIGHT THEME DROPDOWN
   ========================================================================== */
body.text-ui-light .enhanced-search-dropdown,
body.text-ui-light .site-header .c-header__top .manga-autocomplete.ui-autocomplete.enhanced-search-dropdown {
    background: #fff; border-color: rgba(0,0,0,0.08);
    box-shadow: 0 12px 48px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
}
body.text-ui-light .enhanced-search-dropdown .search-result-item { border-bottom-color: rgba(0,0,0,0.05); }
body.text-ui-light .enhanced-search-dropdown .search-result-item:hover { background: rgba(0,0,0,0.03); }
body.text-ui-light .enhanced-search-dropdown .search-result-title { color: #1a1a1a; }
body.text-ui-light .enhanced-search-dropdown .search-genre-tag { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.45); }
body.text-ui-light .enhanced-search-dropdown .search-result-meta { color: rgba(0,0,0,0.35); }
body.text-ui-light .enhanced-search-dropdown .search-meta-type,
body.text-ui-light .enhanced-search-dropdown .search-meta-chapters { color: rgba(0,0,0,0.3); }
body.text-ui-light .enhanced-search-dropdown .search-no-results { color: rgba(0,0,0,0.35); }
body.text-ui-light .enhanced-search-dropdown .search-result-thumb { background: rgba(0,0,0,0.04); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
body.text-ui-light .enhanced-search-dropdown .search-result-thumb .no-thumb { color: rgba(0,0,0,0.15); }
body.text-ui-light .enhanced-search-dropdown .search-view-all { border-top-color: rgba(0,0,0,0.06); }
body.text-ui-light #search-sidebar .search-loading::after { border-color: rgba(0,0,0,0.1); border-top-color: var(--red, rgba(209,53,53,0.7)); }

/* ==========================================================================
   MOBILE DROPDOWN
   ========================================================================== */
@media (max-width: 575px) {
    .enhanced-search-dropdown,
    .site-header .c-header__top .manga-autocomplete.ui-autocomplete.enhanced-search-dropdown {
        min-width: 290px !important; max-width: calc(100vw - 30px) !important; border-radius: 12px;
    }
    .enhanced-search-dropdown .search-result-item { padding: 8px 10px; gap: 10px; }
    .enhanced-search-dropdown .search-result-thumb { width: 40px; min-width: 40px; height: 55px; }
    .enhanced-search-dropdown .search-result-title { font-size: 13px; }
    .enhanced-search-dropdown .search-genre-tag { font-size: 9px; }
}

.mobile-menu #search-sidebar .enhanced-search-dropdown {
    position: fixed; left: 10px; right: 10px; width: auto !important; min-width: unset !important; max-height: 350px;
}
