/**
 * Property Search Widget Styles
 */

.property-search-widget {
    width: 100%;
    max-width: 100%;
    margin: 0px 0 20px;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body.rtl .property-search-widget,
.property-search-widget.rtl {
    font-family: 'Arabic-DroidKufi', 'Droid Arabic Kufi', 'DroidKufi-Regular', Arial, sans-serif;
}

.property-search-widget .wrapper {
    overflow: hidden;
    transition: .25s linear;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.property-search-widget .wrapper.fixed {
    position: fixed;
    top: 20px;
    width: 100%;
}

.default_sidebar_widget .property-search-widget .wrapper {
    overflow: hidden;
    transition: .25s linear;
}

#default_sidebar_widget .property-search-widget .wrapper {
    overflow: initial !important;
}

.property-search-widget .search-widget-wrapper {
    background-color: #F0FAFC;
    position: relative;
    border-radius: 8px;
    max-width: 350px;
    padding: 20px 0;
    margin: 0 auto;
    min-height: 250px;
}

.property-search-widget .search-widget-wrapper::before,
.property-search-widget .search-widget-wrapper::after {
    content: '';
    display: block;
    width: auto;
    height: 100px;
    background-repeat: no-repeat;
    background-size: 100%;
}

.property-search-widget .search-widget-wrapper::before {
    background-image: url('../images/property-widget-top-bg.png');
    border-top-right-radius: 8px;
    border-top-left-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
}

.property-search-widget .search-widget-wrapper::after {
    background-image: url('../images/property-widget-bottom-bg.png');
    background-position: bottom;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
    z-index: 1;
    position: relative;
    margin-top: -10px;
    pointer-events: none;
    bottom: 0;
    position: absolute;
    left: 0;
    right: 0;
}

.property-search-widget .logo {
    background: url('../images/bayut-egypt-logo-2x.png') no-repeat;
    background-size: contain;
    position: absolute;
    height: 50px;
    width: 160px;
    top: 30px;
    left: 30px;
    z-index: 2;
}

.property-search-widget .logo img {
    display: none;
}

.property-search-widget .purpose-selection {
    background: #E6F1F0;
    display: flex;
    padding: 10px;
    width: fit-content;
    gap: 10px;
    border-radius: 24px;
    color: #767676;
    margin-left: 30px;
    margin-top: 80px;
    position: relative;
    z-index: 2;
}

.property-search-widget .purpose {
    padding: 0 15px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    font-size: 14px;
    line-height: 1.7em;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.property-search-widget .purpose.selected {
    background: #FEFEFE;
    color: #000;
    font-weight: 700;
}

.property-search-widget .illustration {
    background: url('../images/property-widget-Illustration.png') no-repeat;
    height: 140px;
    width: 125px;
    position: absolute;
    right: 10px;
    background-size: contain;
    bottom: 70px;
    z-index: 1;
}

.property-search-widget .illustration img {
    display: none;
}

.property-search-widget .location-search-container {
    display: none;
}

.property-search-widget .location-input-wrapper {
    background-color: #FFFFFF;
    position: absolute;
    width: calc(100% - 60px);
    margin: 0 30px;
    z-index: 3;
    bottom: 20px;
    height: 46px;
    padding: 8px 12px 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.property-search-widget .location-input-wrapper input {
    width: 100%;
    border: 0;
    font-size: 14px;
    background-color: transparent;
    padding: 0 8px 0 0;
    margin: 0;
    outline: 0px !important;
    color: #333;
    line-height: 1.5;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.property-search-widget .location-input-wrapper .algolia-autocomplete {
    width: 100% !important;
    display: block !important;
}

.property-search-widget .location-input-wrapper .algolia-autocomplete input {
    width: 100% !important;
}

.property-search-widget .location-input-wrapper input:focus {
    outline: 0px !important;
    border: 0;
    box-shadow: none;
}

.property-search-widget .location-input-wrapper input::placeholder {
    color: #999;
}

.property-search-widget .location-input-wrapper .search-icon {
    background: url('../images/property-widget-search.png') no-repeat;
    display: block;
    background-size: contain;
    width: 24px;
    height: 24px;
    margin-top: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Lookup in flight.

   jQuery UI puts .ui-autocomplete-loading on the input for the duration of the
   request. Nothing styled it, so the widget sat inert for the whole round trip
   and read as a broken dropdown rather than a slow one. Reuse the search icon's
   own 24px box as the spinner so the layout does not shift. */
.property-search-widget .location-input-wrapper input.ui-autocomplete-loading + .search-icon {
    background-image: none;
    box-sizing: border-box;
    border: 2px solid #E6F1F0;
    border-top-color: #28B16D;
    border-radius: 50%;
    animation: bayut-location-spin 0.7s linear infinite;
}

@keyframes bayut-location-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .property-search-widget .location-input-wrapper input.ui-autocomplete-loading + .search-icon {
        animation: none;
        border-top-color: #E6F1F0;
        opacity: 0.6;
    }
}

/* Autocomplete dropdown styles */
.ui-widget.ui-widget-content,
.ui-autocomplete,
.ui-menu.ui-widget-content.ui-autocomplete,
#ui-id-1 {
    width: calc(100% - 60px) !important;
    min-width: 200px !important;
    border: 1px solid #ddd !important;
    border-radius: 8px;
    padding: 10px 0 !important;
    margin: 5px 0 0 0 !important;
    max-height: 250px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-shadow: 0px 4px 12px rgba(0,0,0,0.15) !important;
    font-size: 16px !important;
    color: #767676 !important;
    scrollbar-color: #C1BFBF #DBDBDB;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    z-index: 99999 !important;
    position: absolute !important;
    background: #fff !important;
    top: 226px !important;
    left: 30px !important;
}

/* Override inline display:none when menu has items - but allow JavaScript to close it */
.ui-menu.ui-widget-content.ui-autocomplete:not(:empty):not(.ui-autocomplete-closed) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#ui-id-1:not(:empty):not(.ui-autocomplete-closed) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* When closed, ensure it's hidden */
.ui-menu.ui-widget-content.ui-autocomplete.ui-autocomplete-closed,
#ui-id-1.ui-autocomplete-closed {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Arabic font for dropdown when RTL/Arabic */
body.rtl .property-search-widget .ui-widget.ui-widget-content,
body.rtl .property-search-widget .ui-autocomplete,
body.rtl .property-search-widget .ui-menu.ui-widget-content.ui-autocomplete,
body.rtl .property-search-widget #ui-id-1,
body.rtl .property-search-widget .ui-menu li,
body.rtl .property-search-widget .ui-autocomplete li,
.property-search-widget.rtl .ui-widget.ui-widget-content,
.property-search-widget.rtl .ui-autocomplete,
.property-search-widget.rtl .ui-menu.ui-widget-content.ui-autocomplete,
.property-search-widget.rtl #ui-id-1,
.property-search-widget.rtl .ui-menu li,
.property-search-widget.rtl .ui-autocomplete li {
    font-family: 'Arabic-DroidKufi', 'Droid Arabic Kufi', 'DroidKufi-Regular', Arial, sans-serif !important;
}

.ui-menu .ui-state-active {
    border: 1px solid #E9F7F0 !important;
    background: #E9F7F0 !important;
    color: #28B16D !important;
    font-weight: 700 !important;
}

.ui-widget.ui-widget-content li,
.ui-autocomplete li {
    padding: 8px 15px !important;
    list-style: none !important;
    cursor: pointer;
}

.ui-widget.ui-widget-content li:hover,
.ui-autocomplete li:hover {
    background-color: #f5f5f5;
}

.ui-menu .ui-menu-item-wrapper {
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* RTL Support */
body.rtl .property-search-widget .search-widget-wrapper::before,
body.rtl .property-search-widget .search-widget-wrapper::after,
.property-search-widget.rtl .search-widget-wrapper::before,
.property-search-widget.rtl .search-widget-wrapper::after {
    transform: scaleX(-1);
}

/* RTL positioning for dropdown */
body.rtl .property-search-widget .ui-widget.ui-widget-content,
body.rtl .property-search-widget .ui-autocomplete,
body.rtl .property-search-widget .ui-menu.ui-widget-content.ui-autocomplete,
body.rtl .property-search-widget #ui-id-1,
.property-search-widget.rtl .ui-widget.ui-widget-content,
.property-search-widget.rtl .ui-autocomplete,
.property-search-widget.rtl .ui-menu.ui-widget-content.ui-autocomplete,
.property-search-widget.rtl #ui-id-1 {
    left: auto !important;
    right: 30px !important;
}

body.rtl .property-search-widget .logo,
.property-search-widget.rtl .logo {
    background-image: url('../images/bayut-egypt-ar-logo-2x.png');
    left: initial;
    right: 30px;
    width: 154px;
}

body.rtl .property-search-widget .purpose-selection,
.property-search-widget.rtl .purpose-selection {
    margin-left: initial;
    margin-right: 30px;
    font-family: 'Arabic-DroidKufi', 'Droid Arabic Kufi', 'DroidKufi-Regular', Arial, sans-serif;
}

body.rtl .property-search-widget .purpose,
.property-search-widget.rtl .purpose {
    font-family: 'Arabic-DroidKufi', 'Droid Arabic Kufi', 'DroidKufi-Regular', Arial, sans-serif;
}

body.rtl .property-search-widget .illustration,
.property-search-widget.rtl .illustration {
    right: initial;
    left: 10px;
}

body.rtl .property-search-widget .location-input-wrapper {
    padding: 8px 12px 8px 12px;
}

body.rtl .property-search-widget .location-input-wrapper input {
    padding: 0 0 0 8px;
}

body.rtl .property-search-widget .location-input-wrapper .algolia-autocomplete {
    width: 100% !important;
}

body.rtl .property-search-widget .location-input-wrapper .algolia-autocomplete input {
    width: 100% !important;
}

body.rtl .property-search-widget .location-input-wrapper input,
.property-search-widget.rtl .location-input-wrapper input {
    text-align: right;
    font-family: 'Arabic-DroidKufi', 'Droid Arabic Kufi', 'DroidKufi-Regular', Arial, sans-serif;
}

/* Responsive Design */
@media (max-width: 768px) {
   
}

@media (max-width: 480px) {
    body.rtl .property-search-widget .purpose-selection, .property-search-widget.rtl .purpose-selection{
        margin-inline-start: 15px;
    }
    body.rtl .property-search-widget .logo, .property-search-widget.rtl .logo {
        right: 20px;
    }
    .property-search-widget .location-input-wrapper {
        width: calc(100% - 30px);
        margin: 0 15px
    }
}

/* Dropdown row: name, the ancestors that disambiguate it, and the completion
   badge. Several places share a name - "7th District" exists in five
   governorate/city combinations - so the context is what makes the list
   readable rather than looking like repeated entries. */
.property-search-widget .ui-autocomplete .bayut-loc,
.ui-autocomplete .bayut-loc {
    display: flex;
    align-items: baseline;
    gap: 6px;
    width: 100%;
}

.ui-autocomplete .bayut-loc__name {
    color: #222;
    /* Never shrink: the name is what the reader is looking for, so the context
       absorbs the truncation instead. */
    flex: 0 0 auto;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-autocomplete .bayut-loc__name strong {
    font-weight: 700;
    color: #000;
}

.ui-autocomplete .bayut-loc__context {
    color: #767676;
    font-size: 13px;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-autocomplete .bayut-loc__badge {
    flex: none;
    margin-inline-start: auto;
    padding: 1px 8px;
    border: 1px solid #cfe3f5;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.6;
    color: #4a7fb5;
    background: #fff;
}
