/**
 * Mahendra Developers - Global Responsive Overrides
 * Covers: mobile (320-767), tablet (768-1023), laptop (1024-1439), desktop (1440+)
 * Load last to fix overflow, layout, typography, forms, tables, modals, and navigation.
 */

/* ==========================================================================
   Base & Global
   ========================================================================== */

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
}

img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

iframe {
    max-width: 100%;
}

.container,
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

.row {
    margin-left: -15px;
    margin-right: -15px;
}

/* Prevent Bootstrap columns from causing horizontal scroll */
[class*="col-"] {
    min-width: 0;
}

/* ==========================================================================
   Typography - responsive scaling
   ========================================================================== */

h1, .h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2, .h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
h3, .h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4, .h4 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }

.homec-section__title,
.homec-section__title-2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem) !important;
    line-height: 1.3;
    word-wrap: break-word;
}

.breadcrumb__title {
    font-size: clamp(1.25rem, 3.5vw, 2rem);
}

/* ==========================================================================
   Touch-friendly buttons & links
   ========================================================================== */

.homec-btn,
.btn,
button[type="submit"],
a.homec-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.homec-header__icon {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.offcanvas-toggler {
    min-width: 44px;
    min-height: 44px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.homec-header__logo img {
    max-width: 140px;
    width: auto;
    height: auto;
}

.homec-header__inside {
    flex-wrap: wrap;
    gap: 10px;
}

.homec-header__group {
    flex: 1;
    min-width: 0;
}

/* Laptop: reduce nav spacing to prevent overflow (1024px - 1439px) */
@media only screen and (min-width: 1024px) and (max-width: 1439px) {
    .homec-header__menu .nav-menu li {
        margin-right: 10px !important;
    }

    .homec-header__group {
        gap: 20px !important;
    }

    .homec-header__menu .nav-menu li a {
        font-size: 14px;
    }

    .homec-header__button .homec-btn span {
        font-size: 13px;
        padding: 0 12px;
    }
}

/* Tablet header */
@media only screen and (min-width: 768px) and (max-width: 1023px) {
    .homec-header__inside {
        padding: 12px 15px;
    }

    .homec-header__logo img {
        max-width: 120px;
    }
}

/* Mobile header */
@media only screen and (max-width: 767px) {
    .homec-header__inside {
        padding: 10px 15px;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .homec-header__button {
        order: 2;
        position: relative;
        z-index: 2;
        max-width: none;
        display: flex !important;
        flex: 0 0 auto;
        gap: 0;
    }

    .homec-header__button .homec-btn {
        min-height: 40px;
        padding: 0 9px;
        font-size: 12px;
        white-space: nowrap;
    }

    .homec-header__group {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
    }

    .offcanvas-toggler {
        order: 3;
        position: relative;
        right: auto;
        flex: 0 0 40px;
        z-index: 3;
    }

    .offcanvas-toggler .line {
        background: #7166f0;
    }

    .homec-header__logo img {
        max-width: 110px;
    }

    .offcanvas-modal .modal-dialog {
        position: absolute;
        top: 0;
        left: 0;
        width: min(300px, 100%);
        max-width: 300px;
        height: 100%;
        margin: 0;
    }

    #offcanvas-modal .modal-content {
        position: relative;
        height: 100%;
        padding: 0 25px;
    }

    #offcanvas-modal .offcanvas-header {
        position: relative;
        z-index: 2;
        min-height: 75px;
        padding: 20px 0;
    }

    #offcanvas-modal .offcanvas-header .btn-close {
        position: absolute;
        top: 20px;
        right: 0;
        z-index: 3;
    }

    .offcanvas-menu .nav-menu li a {
        font-size: 16px;
        padding: 12px 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ==========================================================================
   Footer & Subscribe Form
   ========================================================================== */

@media only screen and (max-width: 991px) {
    .homec-form {
        flex-wrap: wrap !important;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 25px 20px;
    }

    .homec-form__content {
        max-width: 100% !important;
        margin-bottom: 15px;
    }

    .homec-form__form {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 10px;
    }

    .homec-form__form input {
        width: 100% !important;
    }

    .homec-form__form button {
        width: 100%;
    }

    .footer-top-inner .row > [class*="col-"] {
        margin-bottom: 25px;
    }

    .footer-pages {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        margin-top: 10px;
    }

    .copyright .row {
        text-align: center;
    }

    .copyright-text {
        margin-bottom: 10px;
    }
}

/* ==========================================================================
   Login / Register / Auth Forms (ecom-wc)
   ========================================================================== */

.ecom-wc__full {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

.ecom-wc__form-inner {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
    padding: 30px 20px;
}

.ecom-wc__inside--group {
    flex-wrap: wrap;
}

@media only screen and (max-width: 767px) {
    .ecom-wc__full {
        padding: 15px 10px;
    }

    .ecom-wc__form-inner {
        padding: 20px 15px;
    }

    .ecom-wc__form-title {
        font-size: 20px !important;
    }

    .ecom-wc__inner {
        padding: 30px 15px;
        height: auto;
        min-height: auto;
    }

    .ecom-wc__countdown--title {
        display: none;
    }

    .ecom-wc__logo {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 20px;
    }
}

/* ==========================================================================
   Post Property Page
   ========================================================================== */

.fixed-column {
    width: 100% !important;
    max-width: 100%;
}

@media only screen and (min-width: 992px) and (max-width: 1199px) {
    .fixed-column {
        position: static;
        height: auto;
        width: 100% !important;
        overflow: visible;
    }

    .scrollable-column {
        width: 100%;
    }
}

@media only screen and (max-width: 991px) {
    .fixed-column,
    .scrollable-column {
        width: 100% !important;
        position: static !important;
        height: auto !important;
        overflow: visible !important;
    }

    .full-height {
        min-height: auto !important;
    }

    .stat-card {
        margin-bottom: 15px;
    }

    .howtopost {
        margin-bottom: 25px;
        text-align: center;
    }

    .howtopost-head h3 {
        font-size: 18px !important;
    }

    .testimonial-item {
        padding-left: 15px !important;
        padding-right: 15px;
    }

    .carousel-indicators {
        transform: none;
        justify-content: center;
        margin-bottom: 15px;
    }

    .control-btn {
        position: relative;
        display: flex;
        justify-content: center;
        gap: 15px;
        margin-top: 15px;
    }
}

/* ==========================================================================
   Search & Filter Forms
   ========================================================================== */

.homec-search-form__form {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
}

@media only screen and (max-width: 991px) {
    .homec-search-form__form {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }

    .homec-search-form__group {
        width: 100%;
        flex-direction: column;
    }

    .homec-filter-group {
        flex-direction: column;
        width: 100%;
    }

    .homec-filter-group .form-group,
    .homec-filter-group .homec-btn {
        width: 100% !important;
        min-width: 0 !important;
    }

    .homec-filters {
        overflow-x: hidden;
    }
}

/* ==========================================================================
   Property Cards & Listings
   ========================================================================== */

.homec-property__head img {
    width: 100%;
    object-fit: cover;
}

.homec-property.homec-property__list-style {
    flex-wrap: wrap;
}

.homec-property.homec-property__list-style .homec-property__head {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
}

@media only screen and (max-width: 767px) {
    .homec-property.homec-property__list-style {
        flex-direction: column !important;
    }

    .homec-property-bar {
        flex-direction: column;
        gap: 10px;
    }

    .homec-property-bar__single {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Property Detail Page
   ========================================================================== */

.accordion-body.homec-accordion__body.homec-accordion__body--floor {
    flex-wrap: wrap;
}

.accordion-body.homec-accordion__body.homec-accordion__body--floor .floor-plan-img {
    min-width: 0 !important;
    width: 100%;
    max-width: 100%;
}

.homec-psingle__slider img,
.homec-property-gallery img {
    width: 100% !important;
    height: auto !important;
    max-height: 400px;
    object-fit: cover;
}

@media only screen and (max-width: 767px) {
    .homec-psingle__amount {
        font-size: 28px !important;
    }

    .homec-image-gallery > img {
        height: auto !important;
        min-height: 200px;
    }

    .download-app__img img {
        min-width: 0 !important;
        min-height: 0 !important;
        width: 100% !important;
        max-width: 280px !important;
        height: auto !important;
    }

    .homec-image-group__single img {
        width: 100% !important;
        height: auto !important;
    }

    .homec-slider-property-slider--v2 img {
        width: 100% !important;
        height: auto !important;
    }
}

/* ==========================================================================
   User Dashboard & Sidebar
   ========================================================================== */

.homec-dashboard__middle .row {
    align-items: flex-start;
}

.homec-dashboard__inner {
    overflow-x: hidden;
}

.homec-list-tabs .list-group-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 14px;
    word-break: break-word;
}

@media only screen and (max-width: 767px) {
    .homec-dashboard {
        padding-top: 60px !important;
    }

    .homec-dashboard__single {
        margin-bottom: 15px;
    }

    .homec-dashboard__heading {
        font-size: 20px;
    }

    .homec-list-tabs {
        margin-bottom: 20px;
    }
}

/* ==========================================================================
   Tables (frontend user area)
   ========================================================================== */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.homec-dashboard .table,
section .table {
    min-width: 0;
}

@media only screen and (max-width: 767px) {
    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        white-space: nowrap;
        padding: 8px 10px;
    }

    .table .btn-sm {
        padding: 4px 8px;
        margin-bottom: 4px;
    }
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-dialog {
    margin: 15px auto;
    max-width: calc(100% - 30px);
}

.homec-modal__width,
.homec-modal__width.homec-modal__width--profile {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.homec-modal__inner {
    padding: 20px 15px;
}

@media only screen and (min-width: 768px) {
    .modal-lg {
        max-width: 700px;
    }

    .homec-modal__width {
        min-width: 0 !important;
        max-width: 700px;
    }
}

@media only screen and (max-width: 767px) {
    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
        min-width: 120px;
    }
}

/* ==========================================================================
   Forms (property create/edit, contact, etc.)
   ========================================================================== */

.homec-form-input input,
.homec-form-input textarea,
.homec-form-input select,
.ecom-wc__form-input,
.form-control,
.homec-form-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.homec-form__form.homec-form__form--property {
    max-width: 100% !important;
}

.select2-container {
    max-width: 100% !important;
    width: 100% !important;
}

@media only screen and (max-width: 767px) {
    .form-group {
        margin-bottom: 15px;
    }

    .homec-upload-images {
        flex-wrap: wrap;
    }

    .homec-upload-images__single {
        width: calc(50% - 10px);
    }

    .plus_btn {
        float: none;
        margin-top: 10px;
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   Charts & Canvas
   ========================================================================== */

canvas {
    max-width: 100% !important;
    height: auto !important;
}

.chart-container,
.chartjs-size-monitor {
    max-width: 100%;
    overflow-x: auto;
}

/* ==========================================================================
   Auction & Business Pages
   ========================================================================== */

@media only screen and (max-width: 991px) {
    .auction-card,
    .property-card {
        margin-bottom: 20px;
    }
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.breadcrumbs__content {
    padding: 40px 0;
}

.breadcrumb__menu {
    flex-wrap: wrap;
    gap: 5px;
}

@media only screen and (max-width: 767px) {
    .breadcrumbs__content {
        padding: 30px 0;
    }

    .breadcrumb-content {
        text-align: center;
    }

    .user-dashboard-breadcrumb {
        box-sizing: border-box;
        height: 180px;
        min-height: 180px;
        margin-top: 55px;
        padding: 70px 0 25px;
    }
}

/* ==========================================================================
   Blog & Content Pages
   ========================================================================== */

.homec-blog-detail__content img,
.homec-blog__img img,
.custom-page-content img {
    max-width: 100%;
    height: auto;
}

.homec-image-gallery__content {
    max-width: 100% !important;
}

/* ==========================================================================
   Compare & Wishlist
   ========================================================================== */

@media only screen and (max-width: 991px) {
    .compare-table-wrapper,
    .homec-compare {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================================
   Swiper / Slider
   ========================================================================== */

.swiper-slide {
    height: auto;
}

.swiper-button-next,
.swiper-button-prev {
    display: none;
}

@media only screen and (min-width: 768px) {
    .swiper-button-next,
    .swiper-button-prev {
        display: flex;
    }
}

/* ==========================================================================
   Agent Cards & Testimonials
   ========================================================================== */

.homec-testimonial.homec-testimonial--v2 {
    flex-wrap: wrap;
}

.homec-testimonial.homec-testimonial--v2 .homec-testimonial__main,
.homec-testimonial.homec-testimonial--v2 .homec-testimonial__img {
    width: 100%;
    max-width: 100%;
}

.homec-agent .homec-agent__head img {
    width: 100%;
    min-height: auto !important;
    height: auto;
    max-height: 350px;
    object-fit: cover;
}

/* ==========================================================================
   Utility spacing for mobile
   ========================================================================== */

@media only screen and (max-width: 767px) {
    .pd-top-100 { padding-top: 60px !important; }
    .pd-top-120 { padding-top: 70px !important; }
    .pd-btm-100 { padding-bottom: 60px !important; }
    .pd-btm-120 { padding-bottom: 70px !important; }
    .mg-top-100 { margin-top: 60px !important; }
}

/* ==========================================================================
   Laptop-specific refinements (1024px - 1439px)
   ========================================================================== */

@media only screen and (min-width: 1024px) and (max-width: 1439px) {
    .container {
        max-width: 1140px;
    }

    .homec-search-form__form {
        min-width: 0;
        flex-wrap: wrap;
    }

    .homec-form__form {
        max-width: 450px;
        width: 100%;
    }
}

/* ==========================================================================
   Very small screens (320px - 374px)
   ========================================================================== */

@media only screen and (max-width: 374px) {
    .homec-header__logo img {
        max-width: 90px;
    }

    .homec-btn span {
        font-size: 12px;
        padding: 0 10px;
    }

    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
}
