.site-header {
    background: #161616;
    color: #fff;
    border-bottom: 1px solid #242424;
    position: relative;
    z-index: 80;
    transition: background 0.24s ease, box-shadow 0.24s ease, transform 0.24s ease, padding 0.24s ease;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 100px;
    gap: 20px;
    transition: min-height 0.24s ease, gap 0.24s ease;
}

.header-left .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    transition: gap 0.24s ease, transform 0.24s ease;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    background: #0984e3;
    border-radius: 16px;
    font-size: 28px;
    color: #fff;
    flex: 0 0 58px;
    transition: width 0.24s ease, height 0.24s ease, font-size 0.24s ease, border-radius 0.24s ease, flex-basis 0.24s ease;
}

.logo-text {
    line-height: 1.05;
    font-size: 21px;
    font-weight: 700;
    transition: font-size 0.24s ease;
}

.logo-text strong,
.logo-text span {
    color: #fff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 26px;
    transition: gap 0.24s ease;
}

.header-link {
    font-size: 17px;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.24s ease, font-size 0.24s ease, transform 0.24s ease;
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.header-link__text--mobile {
    display: none;
}

.header-link__icon {
    line-height: 1;
    flex: 0 0 auto;
}

.header-link:first-of-type {
    color: #0984e3 !important;
}

.header-link:nth-of-type(2) {
    color: #27ae60 !important;
}

.header-link:hover,
.header-link:focus {
    color: #ffffff !important;
}

.btn-login {
    background: #8ad321;
    color: #fff;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    transition: background 0.2s ease, transform 0.2s ease, padding 0.24s ease;
}

.btn-login:hover {
    background: #78bc1f;
    transform: translateY(-1px);
}

.header-user-menu {
    position: relative;
}

.header-user-menu__toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    padding: 0;
}

.header-user-menu__avatar {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6e8df7 0%, #33d0d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex: 0 0 60px;
    transition: width 0.24s ease, height 0.24s ease, font-size 0.24s ease, flex-basis 0.24s ease;
}

.header-user-menu__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-user-menu__name {
    font-size: 18px;
    font-weight: 500;
    white-space: nowrap;
    transition: font-size 0.24s ease;
}

.header-user-menu__dropdown {
    position: absolute;
    top: calc(100% + 18px);
    right: 0;
    width: 290px;
    background: #111;
    border-radius: 0 0 22px 22px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    padding: 20px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 99;
}

.header-user-menu__dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    right: 62px;
    width: 20px;
    height: 20px;
    background: #111;
    transform: rotate(45deg);
}

.header-user-menu.is-open .header-user-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-user-menu__item {
    display: block;
    color: #fff;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 500;
    padding: 9px 28px;
}

.header-user-menu__item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.header-center {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.header-search {
    width: min(100%, 680px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s ease;
}

.site-header.is-search-visible .header-search,
.header-search.is-always-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.site-header.is-sticky {
    position: sticky;
    top: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    background: rgba(22, 22, 22, 0.96);
    backdrop-filter: blur(12px);
}

.site-header.is-sticky .header-inner {
    min-height: 78px;
    gap: 16px;
}

.site-header.is-sticky .header-left .logo {
    gap: 10px;
}

.site-header.is-sticky .logo-icon {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    font-size: 22px;
    border-radius: 14px;
}

.site-header.is-sticky .logo-text {
    font-size: 18px;
}

.site-header.is-sticky .header-link {
    font-size: 15px;
}

.site-header.is-sticky .btn-login {
    padding: 10px 18px;
}

.site-header.is-sticky .header-user-menu__avatar {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    font-size: 26px;
}

.site-header.is-sticky .header-user-menu__name {
    font-size: 16px;
}

.header-search__form {
    width: 100%;
}

.header-search__inner {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.14);
    padding: 6px 6px 6px 16px;
    gap: 0;
    min-height: 60px;
    border: 1px solid rgba(255,255,255,0.08);
}

.header-search__select-wrap {
    position: relative;
    flex: 0 0 auto;
    max-width: 150px;
}

.header-search__select,
.header-search__input,
.header-search__button {
    font-family: inherit;
}

.header-search__select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    padding: 8px 28px 8px 4px;
    white-space: nowrap;
}

.header-search__select-arrow {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #9ca3af;
    display: flex;
}

.header-search__divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    margin: 0 12px;
    flex: 0 0 auto;
}

.header-search__input-wrap {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: #9ca3af;
}

.header-search__input-wrap.is-open .header-search__suggestions {
    display: block;
}

.header-search__icon {
    flex: 0 0 auto;
}

.header-search__input {
    width: 100%;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #111827;
    font-size: 15px;
    padding: 8px 0;
}

.header-search__input::placeholder {
    color: #9ca3af;
}

.header-search__clear {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: color 0.15s ease, background 0.15s ease;
}

.header-search__clear:hover {
    color: #374151;
    background: #f3f4f6;
}

.header-search__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    background: #3867ff;
    color: #fff;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    padding: 18px 26px;
    cursor: pointer;
    flex: 0 0 auto;
    white-space: nowrap;
    transition: background 0.18s ease, transform 0.18s ease;
}


.header-search__button {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 10px;
}
.header-search__button svg {
    width: 16px;
    height: 16px;
}

.header-search__button span {
    display: none;
}
.header-search__button:hover {
    background: #2550e0;
    transform: translateY(-1px);
}

.header-search__suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: -44px;
    right: -44px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14);
    list-style: none;
    margin: 0;
    padding: 6px;
    z-index: 999;
    display: none;
    max-height: 360px;
    overflow: auto;
}

.header-search__suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s ease;
    color: #374151;
}

.header-search__suggestion-item:hover {
    background: #f3f4f6;
}

.header-search__suggestion-thumb {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eef2f7;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
}

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

.header-search__suggestion-thumb.is-placeholder {
    color: #9ca3af;
}

.header-search__suggestion-icon {
    flex: 0 0 auto;
}

.header-search__suggestion-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
}

.header-search__suggestion-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header-search__suggestion-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
}

.header-search__suggestion-type {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 20px;
    flex: 0 0 auto;
}

.header-search__suggestion-address {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1199px) {
    .header-right {
        gap: 18px;
    }

    .header-link {
        font-size: 15px;
    }

    .header-search {
        width: min(100%, 560px);
    }

    .header-search__suggestions {
        left: -18px;
        right: -18px;
    }
}

@media (max-width: 991px) {
    /* Hàng 1: logo | right (nowrap) — Hàng 2: search full width */
    .header-inner {
        flex-wrap: wrap;
        align-items: center;
        padding-top: 8px;
        padding-bottom: 8px;
        gap: 0;
        min-height: auto;
    }

    /* Hàng 1 */
    .header-left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-right {
        flex-shrink: 0;
        gap: 12px;
        width: auto;
    }

    .header-link {
        font-size: 13px;
        white-space: nowrap;
    }

    .header-user-menu__name { display: none; }

    /* Hàng 2: search chiếm full width */
    .header-center {
        order: 3;
        flex: 0 0 100%;
        width: 100%;
        padding: 6px 0 8px;
    }

    .site-header.is-search-visible .header-search,
    .header-search {
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        width: 100%;
    }

    .site-header.is-sticky .header-inner { min-height: auto; }

    .header-search__inner    { min-height: 44px; }
    .header-search__suggestions { left: 0; right: 0; }
}

@media (max-width: 767px) {
    .header-inner {
        min-height: auto;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 12px;
        flex: 0 0 40px;
    }

    .logo-text {
        font-size: 14px;
    }

    .header-right {
        width: auto;
        flex-shrink: 0;
    }

    .header-link {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: none;
    }

    .header-link__text--desktop {
        display: none;
    }

    .header-link__text--mobile {
        display: inline;
    }

    .header-link--community {
        max-width: 120px;
    }

    .header-link--request {
        max-width: 108px;
    }

    .header-user-menu__avatar {
        width: 48px;
        height: 48px;
        font-size: 26px;
        flex: 0 0 48px;
    }

    .header-user-menu__dropdown {
        width: 240px;
    }

    .header-user-menu__item {
        font-size: 20px;
        padding: 16px 20px;
    }

    /* Mobile: tất cả loại + input + nút tìm nằm 1 hàng */
    .header-search__inner {
        border-radius: 999px;
        padding: 4px 4px 4px 10px;
        flex-wrap: nowrap;
        gap: 4px;
        min-height: 44px;
    }

    .header-search__select-wrap {
        flex: 0 0 auto;
        max-width: 100px;
    }

    .header-search__select {
        font-size: 12px;
        padding: 0 20px 0 0;
        min-width: 0;
        max-width: 100px;
    }

    .header-search__select-arrow {
        right: 2px;
    }

    .header-search__divider {
        display: block;
        height: 20px;
        margin: 0 2px;
    }

    .header-search__input-wrap {
        order: 0;
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        background: transparent;
        border-radius: 0;
        padding: 0 4px;
        min-height: 36px;
    }

    .header-search__input {
        font-size: 13px;
    }

    .header-search__button {
        order: 0;
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        min-height: 36px;
        border-radius: 50%;
        padding: 0;
    }

    .header-search__button span {
        display: none;
    }

    .header-search__suggestions {
        left: 0;
        right: 0;
        top: calc(100% + 8px);
    }

    .header-search__suggestion-top {
        flex-wrap: wrap;
    }

    .header-search__suggestion-address {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* Fix desktop/mobile header text visibility */
.header-link__text--desktop {
    display: inline !important;
}

.header-link__text--mobile {
    display: none !important;
}

@media (max-width: 767px) {
    .header-link__text--desktop {
        display: none !important;
    }

    .header-link__text--mobile {
        display: inline !important;
    }
}
