.form-box {
    border-radius: 10px;
    border: 2px solid #adaeae;
    background: #fefefe;
    padding: 0;
    display: flex;
    grid-gap: 10px;
    max-width: 1000px;
    margin: 0 auto 309px;
    align-items: center;
}

.form-box .dropdown-menu {
    position: absolute;
    bottom: auto;
    border-radius: 10px;
    background: #fff;
    width: 120px;
    padding: 10px;
    padding-bottom: 0px;
    left: 50%;
    opacity: 0;
    transition: all 0.5s ease-in-out;
    visibility: hidden;
    transform: translate(-50%, 0%);
    top: 68px;
}

.form-box .dropdown-menu li a {
    color: #333434;
    font-family: "Helvetica";
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 400;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 20px;
}

.form-box .space .dropdown-menu {
    opacity: 1;
    visibility: visible;
}

.form-box .dropdown-toggle {
    position: relative;
}

.form-box .space .dropdown-toggle::after {
    transform: translate(-50%, 0) rotate(-180deg);
}

.form-box .dropdown-toggle::after {
    content: "";
    background-image: url(../images/drop-arrow.svg);
    background-repeat: no-repeat;
    background-size: contain;
    position: absolute;
    right: -12px;
    width: 24px;
    transition: all 0.5s ease-in-out;
    height: 24px;
    transition: all 0.5s ease-in-out;
    top: 27%;
    transform: translate(-50%, 0);
}

.form-box .dropdown-toggle svg {
    transition: all 0.5s ease-in-out;
}

.form-box .space .dropdown-toggle svg {
    transform: rotate(-180deg);
}

.form-box .dropdown button {
    padding: 10px 30px;
    color: #333434;
    font-family: "Helvetica";
    font-size: 18px;
    font-weight: 400;
    line-height: 26px;
    display: flex;
    cursor: pointer;
    grid-gap: 5px;
    align-items: center;
    border: none;
    background-color: transparent;
}

.form-box .dropdown {
    display: inline-block;
    position: relative;
    outline: none;
}

/* Search widget: wider dropdown menu */
.search-field-widget .form-box .dropdown-menu {
    width: 200px;
    min-width: 200px;
}

/* Search widget: left/right padding (like home page container) */
.search-field-widget .form-box {
    padding-left: 20px;
    padding-right: 20px;
}

.hero-sec {
    position: relative;
}

/* Make video wrapper fill the entire hero so the dark overlay extends to the bottom */
.hero-sec .bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.hero-sec video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 50% opacity black overlay */
    z-index: 2;
}

.hero-sec .container, .hero-sec .text-box, .hero-sec .form-box, .hero-sec .agent-shape {
    position: relative;
    z-index: 3; /* Ensure content stays above the overlay */
}

/* Mobile: keep dropdown and search results within viewport and aligned with inputs */
@media (max-width: 991px) {
    .form-box .dropdown button {
        padding: 5px 30px;
    }

    .hero-sec .form-box,
    .search-field-widget .form-box {
        overflow: visible;
        max-width: 100%;
    }

    .hero-sec .form-box {
        padding-left: 0;
        padding-right: 0;
    }

    /* Dropdown menu (Buy/Sell/Rent): position below trigger for both hero and widget */
    .form-box .dropdown-menu {
        top: 100% !important;
        margin-top: 4px !important;
        left: 0 !important;
        transform: none !important;
        z-index: 1001;
    }

    /* Search widget: copy hero/home layout (tab-dropdown above, then input+filter+search row) */
    .search-field-widget .form-box {
        flex-wrap: nowrap;
        position: relative;
    }

    .search-field-widget .form-box .tab-dropdown {
        position: absolute;
        top: -54px;
        right: 0;
        left: 0;
        width: 100%;
        padding-right: 0;
        border: none;
    }

    .search-field-widget .form-box .tab-dropdown .dropdown {
        width: 100%;
        border-radius: 10px;
        border: 1px solid #D6D6D6;
        background: #FEFEFE;
        height: 36px;
    }

    .search-field-widget .form-box .tab-dropdown .dropdown button {
        width: 100%;
        justify-content: space-between;
        padding: 5px 38px 5px 20px;
        font-size: 14px;
        height: 36px;
        color: #222;
    }

    .search-field-widget .form-box .tab-content {
        position: relative;
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
    }

    .search-field-widget .form-box .tab-content .input-box {
        position: static;
        flex: 1;
        min-width: 0;
    }

    .search-field-widget .form-box .filter-box {
        position: static;
        flex-shrink: 0;
    }

    .search-field-widget .form-box .btn-search {
        order: 4;
        flex-shrink: 0;
        padding: 0 10px;
        width: 38px;
        height: 38px;
    }

    .search-field-widget .form-box .form-control {
        font-size: 16px;
        max-width: 100%;
    }

    /* Search widget: dropdown menu full width like home page */
    .search-field-widget .form-box .dropdown-menu {
        width: 100%;
        min-width: 120px;
    }

    /* Typesense search results: full width of tab-content, left-aligned, no offset */
    .hero-sec #typesense-results-container,
    .hero-sec .form-box .search-box,
    .search-field-widget #typesense-results-container,
    .search-field-widget .form-box .search-box {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        z-index: 1000;
    }

    .hero-sec .form-box .input-box,
    .search-field-widget .form-box .input-box {
        overflow: visible;
        min-width: 0;
        position: static; /* so results position relative to .tab-content */
    }

    .hero-sec .form-box .search-inner-box,
    .hero-sec #typesense-results,
    .search-field-widget .form-box .search-inner-box,
    .search-field-widget #typesense-results {
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 767px) {
    /* Prevent input-box negative margin from causing overflow and cutting off dropdown */
    .hero-sec .form-box .input-box,
    .search-field-widget .form-box .input-box {
        margin-right: 0;
    }

    /* Fix alignment: pin search results panel to viewport so it always aligns full width (hero only) */
    .hero-sec #typesense-results-container,
    .hero-sec .form-box .search-box {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        top: 260px !important;
        bottom: auto !important;
        z-index: 10000;
        border-radius: 0 0 10px 10px;
        max-height: calc(100vh - 280px);
    }

    .hero-sec .form-box .search-inner-box,
    .hero-sec #typesense-results {
        max-height: calc(100vh - 340px);
    }

    /* Search widget: keep results panel aligned, no fixed position (widget may be mid-page) */
    .search-field-widget #typesense-results-container,
    .search-field-widget .form-box .search-box {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}