/*===================================
=            SEARCH WIDGET          =
===================================*/

#search_widget {
    margin-bottom: 1.5rem;
    margin: 0 auto;
}

#search_widget .search-row {
    display: flex;
    align-items: center;
    width: 100%;
}

#search_widget .search-input-wrapper {
    position: relative;
    flex: 3;
    min-width: 300px;
}

#search_widget input[type="text"] {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#search_widget input[type="text"]::placeholder {
    color: rgba(0, 0, 0, 0.5); /* Black text with 50% opacity */
}
 
#search_widget .material-icons.search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 18px;
}

#search_widget .material-icons.clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: pointer;
    font-size: 18px;
    display: none;
}

/* Category Selector Styling */
#search_widget .category-selector-wrapper {
    position: relative;
    flex: 1; /* Takes 1 part of the available space */
    min-width: 300px; /* Increased from 180px to 220px */
    max-width: 330px; /* Maximum width */
}

#search_widget .category-selector {
    position: relative;
}

#search_widget .selector-display {
    cursor: pointer;
    border: 1px solid #e0e0e0;
    padding: 8px 15px;
    background: #fff;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

#search_widget .selector-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    padding-right: 20px;
}

#search_widget .toggle-icon {
    margin-left: 5px;
    transition: transform 0.2s;
}

#search_widget .category-selector.active .toggle-icon {
    transform: rotate(180deg);
}

#search_widget .selected-tags-container {
    display: none;
}

#search_widget .selector-tags {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    align-items: center;
    gap: 4px;
    flex-grow: 1;
}

#search_widget .selector-tag {
    background: #f0f8ff;
    border: 1px solid #e1eeff;
    color: #0066cc;
    padding: 2px 6px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 15px;
    white-space: nowrap;
}

#search_widget .selector-tag .remove-tag {
    cursor: pointer;
    color: #0066cc;
    font-size: 13px;
    line-height: 1;
    padding: 0 1px;
    margin-left: 3px;
}


#search_widget .selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 5px 10px;
}

#search_widget .category-tag {
    background: #f0f8ff;
    border: 1px solid #e1eeff;
    color: #0066cc;
    padding: 3px 8px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 3px;

}

#search_widget .category-tag .remove-tag {
    cursor: pointer;
    color: #0066cc;
    font-size: 13px;
    line-height: 1;
    padding: 0 1px;
}

#search_widget .category-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    padding: 10px;
    z-index: 20;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
}

#search_widget .category-dropdown.active {
    display: block;
}

#search_widget .category-item {
    padding: 8px 10px;
    display: flex;
    align-items: center;
}

#search_widget .category-item:hover {
    background: #f8f9fa;
}

#search_widget .category-item input[type="checkbox"] {
    margin-right: 8px;
}

#search_widget .category-item label {
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

#search_widget .search-btn {
    flex-shrink: 0;
    padding: 0 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}


/* Keyboard base styles */
.keyboard-container {
    padding: 0 15px;
    box-sizing: border-box;
    width: 100%;
}

.keyboard-row {
    margin: 0 auto;
    max-width: 100%;
    display: flex;
    justify-content: center;
}

.keyboard-key {
    margin: 3px;
    flex-grow: 1;
    max-width: calc(100% / 10 - 6px);
}

.special-key {
    flex-grow: 2;
}

.top-nav {
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
}
/*=========================
=      MEDIA QUERIES     =
=========================*/

/* Desktop: Set max-width for suggestion dropdown */
@media (min-width: 768px) {
    .searchbar-autocomplete {
        max-width: 618px!important;
    }
}
@media (min-width: 531px) and (max-width: 767px) {
    .searchbar-autocomplete {
        width:520px!important;
    }
}

@media (max-width: 767px) {
    .keyboard-key {
       margin: 2px; /* Tighter spacing on small screens */
       font-size: 14px; /* Smaller text */
   }
    
    #search_widget .search-row {
        flex-direction: column;
        position: relative;
        width: 100%;
    }

    #search_widget .search-input-wrapper {
        width: 100%;
        margin-bottom: 3px;
        position: relative;
    }

    #search_widget .search-input {
        width: 100%;
        padding-left: 40px; /* Space for search icon */
        padding-right: 90px; /* Space for clear and search buttons */
        box-sizing: border-box;
    }

    #search_widget .material-icons.search {
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
    }

    #search_widget .search-btn {
        position: absolute;
        right: 5px;
        width: 34px;
        padding: 0;
        z-index: 2;
    }

    #search_widget .material-icons.clear {
        position: absolute;
        right: 45px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
    }

    #search_widget .category-selector-wrapper {
        width: 100%;
        max-width: none;
    }

    #search_widget .selector-display {
        width: 100%;
    }
}

@media only screen and (min-width: 768px) {
    #search_widget {
        float: none;
    }
}


@media (max-width: 530px) {
     .searchbar-autocomplete {
        left: 11px!important;
    }
    /* Optional: Further adjustments for very small screens */
    .keyboard-container {
        padding: 0 10px; /* Reduce side padding */
    }
}