/* File: /assets/css/components/form-search.css */

.search-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-m);
    width: 100%;
}

/* 1. Xử lý đồng bộ chiều cao cho Input và Select */
.search-form select,
.search-form input[type="text"] {
    /* Loại bỏ height cứng 3rem để dùng chung cơ chế padding + line-height */
    height: auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.search-form-select {
    width: 100%;
}

.search-form-input-wrapper {
    position: relative;
    flex-grow: 1;
    width: 100%;
}

#search-form-input-keyword {
    padding-right: 40px;
    /* Chừa chỗ cho nút xóa */
}

/* 2. Căn giữa nút xóa theo chiều dọc chính xác hơn */
.search-button-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--color-gray-base);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* --- Suggestions Dropdown --- */
#search-form-suggestion-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-gray-light);
    border-top: none;
    z-index: 100;
    display: none;
}

#search-form-suggestion-list.is-visible {
    display: block;
}

.suggestion-item {
    padding: var(--spacing-xs) var(--spacing-m);
    cursor: pointer;
}

.suggestion-item.is-active,
.suggestion-item:hover {
    background-color: var(--color-gray-light);
}

/* --- Responsive Desktop --- */
@media (min-width: 768px) {
    .search-form {
        flex-direction: row;
        align-items: stretch;
        /* Đảm bảo các phần tử con có chiều cao bằng nhau */
    }

    .search-form-select {
        /* Tăng width lên 280px để hiển thị đủ tên ngôn ngữ native */
        width: 280px;
        flex-shrink: 0;
    }

    .search-form-input-wrapper {
        flex-grow: 1;
    }
}