/* #search-container positioning is in layout.css */
#search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid #b8b8b8;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden; /* For data loading bar */
}

#search-wrapper:focus-within {
    border-color: #0078A8;
    box-shadow: 0 0 0 4px rgba(0, 120, 168, 0.2);
}

#search-wrapper.disabled {
    background-color: #f8f9fa;
    opacity: 0.7;
    pointer-events: none;
    transition: background-color 0.2s, opacity 0.2s;
}

.search-icon {
    position: static;
    transform: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    padding: 0 15px;
    line-height: 1;
}

.search-icon.fa-spinner {
    animation: spin 1s linear infinite; /* Uses @keyframes spin from base.css */
}

#search-input {
    width: 100%;
    height: 46px;
    padding: 0 10px 0 0;
    border: none;
    border-radius: 8px; /* Redundant if #search-wrapper has overflow:hidden and border-radius */
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
    box-shadow: none;
    flex-grow: 1;
    background: transparent;
}

#search-input::placeholder {
    color: #888;
}

#search-input:focus {
    box-shadow: none;
}

#filter-trigger-btn {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    border: 1px solid #b8b8b8;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 2px 20px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: -1px;
    z-index: 10;
    transition: all 0.2s ease;
    height: 22px;
    width: auto;
    min-width: 60px;
}

#filter-trigger-btn:hover {
    background-color: #f8f9fa;
    color: #0078A8;
    box-shadow: 0 5px 8px rgba(0, 0, 0, 0.15);
}

#filter-trigger-btn.active-filters {
    color: #0078A8;
    background-color: #eef7fb;
    border-color: #0078A8;
    border-top-color: #eef7fb; /* Seamless blend */
}

.filter-count-badge {
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%) scale(0);
    background-color: #0078A8;
    color: white;
    border-radius: 50%;
    min-width: 14px;
    height: 14px;
    font-size: 9px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.filter-count-badge.visible {
    transform: translateY(-50%) scale(1);
}

#search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    display: none;
    overscroll-behavior-y: contain;
    z-index: 9;
}

#search-suggestions li {
    padding: 12px 15px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

#search-suggestions li:last-child {
    border-bottom: none;
}

#search-suggestions li.suggestion-active {
    background-color: #f0f0f0;
}

#search-suggestions li .suggestion-name {
    font-weight: 500;
    color: #333;
}

#search-suggestions li .suggestion-alias {
    font-size: 12px;
    color: #777;
    display: block;
    margin-top: 2px;
    font-style: italic;
}

#search-suggestions .no-results {
    padding: 12px 15px;
    color: #888;
    font-style: italic;
    cursor: default;
}

#search-suggestions li.filtered-out {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.filtered-out-indicator {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #e74c3c;
    margin-top: 4px;
}

.filtered-out-indicator i {
    margin-right: 4px;
}

#search-suggestions li.confirming {
    padding-bottom: 50px; /* Space for confirmation bar */
    position: relative;
}

.confirm-clear-filters {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff8e1;
    border-top: 1px solid #ffecb3;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.confirm-text {
    font-weight: 500;
    color: #6d4c41;
}

.confirm-actions button {
    background-color: #0078A8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
    transition: background-color 0.2s;
}

.confirm-actions button.confirm-no {
    background-color: #757575;
}

#filter-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: -1; /* Below suggestions, above map */
    max-height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
    visibility: hidden; /* Controlled by GSAP */
    opacity: 0; /* Controlled by GSAP */
    transform-origin: top center;
}

#filter-panel.open {
    visibility: visible; /* GSAP handles animation */
}

#filter-panel-content {
    padding: 15px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    display: flex;
    flex-direction: column;
}

#filter-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #eee;
    margin: -15px -15px 20px; /* Pull to edges */
    padding: 10px 15px;
}

.filter-controls-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-controls-left .validated-filter-button { /* For sizing within header */
    padding: 8px 10px;
    flex-shrink: 0;
    width: auto;
}

.filter-controls-left .filter-logic-container {
    max-width: 150px;
}

#clear-all-filters-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: color 0.2s, background-color 0.2s;
}

#clear-all-filters-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.filter-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.offer-filter-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin: 0;
    background-color: #f8f9fa;
    color: #343a40;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    user-select: none;
    box-sizing: border-box;
    text-align: left;
    font-family: inherit;
}

.offer-filter-button input[type="checkbox"] {
    display: none;
}

.offer-filter-button.active {
    background-color: #0078A8;
    color: white;
    border-color: #005c82;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) inset;
    transform: translateY(0);
}

.offer-filter-button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f8f9fa !important; /* Ensure override */
    color: #6c757d !important;
    border-color: #dee2e6 !important;
    box-shadow: none !important;
    transform: none !important;
    pointer-events: none;
}

.validated-filter-button i {
    color: #28a745;
    transition: color 0.2s ease;
}

.validated-filter-button.active {
    background-color: #28a745;
    color: white;
    border-color: #218838;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) inset;
}

.validated-filter-button.active i {
    color: white;
}

.offer-filter-button i {
    font-size: 1.15em;
    width: 1.3em;
    text-align: center;
    flex-shrink: 0;
}

.filter-logic-container {
    display: flex;
    border: 1px solid #0078A8;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.filter-logic-button {
    flex: 1;
    padding: 8px 5px;
    font-size: 12px;
    font-weight: 500;
    background-color: #f8f9fa;
    color: #333;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.filter-logic-button:not(:last-child) {
    border-right: 1px solid #0078A8;
}

.filter-logic-button.active {
    background-color: #0078A8;
    color: white;
    font-weight: 600;
}
