/* Main Container */
.csb-search-bar {
    margin: 20px 0;
    position: relative;
    z-index: 10;
    width: 100%;
}

/* Form Layout */
.csb-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* 1. Filters Row (Top) */
.csb-filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.csb-filter-select {
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 150px;
}

/* 2. Main Search Row (Input + Button) */
.csb-main-search-row {
    display: flex;
    position: relative;
    width: 100%;
    align-items: stretch; /* Ensure input and button are same height */
}

/* Input Wrapper (Holds Input + Clear Button) */
.csb-input-wrapper {
    flex-grow: 1; /* Takes all available space */
    position: relative;
    display: flex;
    align-items: center;
}

/* The Input Field */
.csb-input-wrapper input[type="text"] {
    width: 100%;
    padding: 12px 40px 12px 15px; /* Right padding makes room for X button */
    font-size: 16px;
    border: 1px solid #ccc;
    border-right: none;
    border-radius: 4px 0 0 4px;
    outline: none;
    box-sizing: border-box; /* Crucial for padding to not break width */
}

.csb-input-wrapper input[type="text"]:focus {
    border-color: #0073aa;
}

/* The Clear (X) Button */
.csb-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0 5px;
    z-index: 2;
}

.csb-clear-btn:hover {
    color: #333;
}

/* The Search Button */
.csb-submit-btn {
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    background-color: #0073aa;
    color: #fff;
    border: 1px solid #0073aa;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    white-space: nowrap;
}

.csb-submit-btn:hover {
    background-color: #005177;
}

/* Loading State */
.csb-form.loading .csb-submit-btn {
    opacity: 0.7;
    pointer-events: none;
}

/* 3. Dropdown Results */
.csb-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 9999;
    max-height: 300px;
    overflow-y: auto;
}

/* Visual tweaks when results are open */
.csb-main-search-row.has-results .csb-input-wrapper input[type="text"] {
    border-radius: 4px 0 0 0;
}

.csb-main-search-row.has-results .csb-submit-btn {
    border-radius: 0 4px 0 0;
}

/* Results List */
.csb-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.csb-results li {
    border-bottom: 1px solid #eee;
}

.csb-results li:last-child {
    border-bottom: none;
}

.csb-results li a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
}

.csb-results li a:hover {
    background-color: #f0f0f0;
    color: #0073aa;
}

.csb-results p {
    padding: 15px;
    margin: 0;
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .csb-main-search-row {
        flex-wrap: wrap;
    }
    .csb-input-wrapper {
        width: 100%;
    }
    .csb-input-wrapper input[type="text"] {
        border-right: 1px solid #ccc;
        border-radius: 4px;
        margin-bottom: 10px;
    }
    .csb-submit-btn {
        width: 100%;
        border-radius: 4px;
    }
}