/* --- Search Bar Styles --- */
.search-row {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #c2c2c2; 
    padding-bottom: 8px;
}

.search-input {
    flex-grow: 1;
    border: none !important;
    background: transparent;
    font-size: 22px !important;
    outline: none;
    padding: 5px 0 !important;
    margin-bottom: 0px;
    box-shadow: none !important;
    height: auto !important;
}

.search-input::placeholder {
    color: #aeb4bc;
    font-weight: 300;
}

.search-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.search-button svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: #052d59;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Dropdown Filters Styles --- */
.dropdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-header {
    padding: 12px 15px;
    font-size: 16px;
    color: #052d59;
    font-weight: 700;
    background-color: #f1f4f6;
    border: 1px solid #c7d4de;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.dropdown-header svg {
    width: 25px;
    height: 25px;
    stroke: #052d59;
    stroke-width: 1;
    transition: transform 0.2s ease;
}

.custom-dropdown.is-open .dropdown-header svg {
    transform: rotate(180deg);
}

.dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #dcdcdc;
    border-top: none;
    z-index: 10;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    padding-top: 8px;
    padding-bottom: 8px;
}

.custom-dropdown.is-open .dropdown-list {
    display: block;
}

/* --- Custom Checkbox Styles --- */
.custom-checkbox-label {
    display: flex;
    width: fit-content; /* Make the pill wrap tightly around the text */
    max-width: calc(100% - 24px); /* Ensure it doesn't overflow horizontally on very long text */
    align-items: center;
    padding: 8px 16px 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #d3d9df;
    border-radius: 50px; /* Pill shape */
    margin: 6px 12px;
    background-color: #ffffff;
}

.custom-checkbox-label:hover {
    background: #f8f9fa;
}

/* Change the whole pill when the inner checkbox is checked */
.custom-checkbox-label:has(.custom-checkbox-input:checked) {
    border-color: #0065a4;
    background-color: #f0f4f7;
}

.custom-checkbox-input {
    /* Visually hide to override builder defaults without relying on display:none */
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    pointer-events: none;
}

.custom-checkbox-button {
    width: 23px;
    height: 23px;
    border: 2px solid #a0a6ab;
    border-radius: 50%; /* Circle shape */
    margin-right: 10px;
    position: relative;
    background: transparent;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* The Filled Circle Background */
.custom-checkbox-input:checked + .custom-checkbox-button {
    background-color: #042e5b;
    border-color: #042e5b;
}

/* The Checkmark */
.custom-checkbox-input:checked + .custom-checkbox-button::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox-text {
    font-size: 15px;
    color: #4a5568;
    transition: color 0.2s ease;
}

.custom-checkbox-input:checked ~ .custom-checkbox-text {
    color: #0065a4; /* Blue text when active */
}

/* --- Active Filters & Tags Area --- */
#active-filters-area {
    background-color: #f1f4f6;
    padding: 15px 20px;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Aligns contents to the top */
    border-radius: 5px;
}

#active-filters-area.hidden {
    display: none !important;
}

#tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex-grow: 1;
}

.filter-tag {
    background: #fff;
    border: 1px solid #c7d4de;
    padding: 5px 10px;
    font-size: 13px;
    color: #000;
    border-radius: 99px;
    display: flex;
    align-items: center;
}

.remove-tag {
    margin-left: 8px;
    cursor: pointer;
    color: #888;
    font-weight: normal;
    font-size: 16px;
    line-height: 1;
}

.remove-tag:hover {
    color: #000;
}

#clear-all-btn {
    background: transparent;
    border: none;
    color: #2283c6;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 20px;
    margin-bottom: 0; /* Fixed typo */
    flex-shrink: 0; /* Prevents button from being pushed out by long tags */
    margin-top: 6px; /* Visually align text baseline with tags */
}

#clear-all-btn:hover {
    text-decoration: underline;
}

/* Responsive behavior */
@media (max-width: 768px) {
    .dropdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .dropdown-grid {
        grid-template-columns: 1fr;
    }
    #active-filters-area {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    #clear-all-btn {
        margin-left: 0;
    }
}