/* ============================================
   Mobile-First Responsive CSS
   ONLY fixes mobile responsiveness
   Desktop styles remain completely untouched
   ============================================ */

/* ============================================
   MOBILE ONLY FIXES (max-width: 767px)
   ============================================ */

@media (max-width: 767px) {
    
    /* Typography - Mobile adjustments for readability */
    html {
        font-size: 14px;
    }
    
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* Header - Mobile fixes */
    header.header-2 {
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
    }
    
    /* Mobile Top Bar - Better spacing */
    .mobile-topbar {
        padding: 0.75rem 1rem !important;
        gap: 0.75rem !important;
    }
    
    /* Mobile Logo - Proper sizing */
    .mobile-logo img.cst-logo {
        height: 42px !important;
        max-width: 140px !important;
    }
    
    /* Menu Toggle - Touch-friendly */
    .mobile-menu .menu-toggle {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem !important;
    }
    
    /* Map Chip - Better mobile appearance */
    .map-chip-wrapper .btn {
        height: 36px !important;
        padding: 0 0.75rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Hero Section - Mobile optimization */
    .banner-section .video-bg.cst-slider {
        min-height: 45vh !important;
        height: 45vh !important;
        background-position: center !important;
        background-size: cover !important;
    }
    
    .home-main.feature-section.new-property.hero-main {
        min-height: 45vh !important;
        height: 45vh !important;
    }
    
    .hero-search-container {
        width: 100% !important;
        padding: 0 1rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 100% !important;
    }
    
    .hero-search-floating {
        position: static !important;
        width: 100% !important;
    }
    
    /* Mobile Search Card - centered overlay */
    .mobile-search-wrapper {
        padding: 0 !important;
        width: min(360px, 90%) !important;
        margin: 0 auto !important;
    }
    
    .mobile-search-card {
        position: relative !important;
        padding: 0.7rem 0.7rem 3.35rem 0.7rem !important;
        border-radius: 18px !important;
        box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08) !important;
        border: 1px solid rgba(15, 23, 42, 0.03) !important;
        background-color: #ffffff !important;
    }
    
    /* STEP 1: Stack the dropdowns vertically - Hide labels, show placeholders */
    .mobile-search-card .row.g-2.align-items-center:first-child {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.4rem !important;
        margin-bottom: 0.35rem !important;
    }
    
    /* Hide labels on mobile */
    .mobile-search-card .mobile-field .form-label,
    .mobile-search-card .mobile-field label {
        display: none !important;
    }
    
    /* Make dropdowns full width and stacked */
    .mobile-search-card .ms-col-neighborhood,
    .mobile-search-card .ms-col-type {
        width: 100% !important;
        flex: 1 1 100% !important;
        max-width: 100% !important;
        border: none !important;
        padding: 0 !important;
    }
    
    /* Remove divider between stacked fields */
    .mobile-divider {
        border: none !important;
        padding: 0 !important;
    }
    
    /* Style select fields with visible borders and compact sizing */
    .mobile-field .form-select {
        font-size: 13.5px !important;
        padding: 0.45rem 0.7rem !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 8px !important;
        height: 38px !important;
        line-height: 1.5 !important;
        background-color: #ffffff !important;
        width: 100% !important;
    }
    
    /* STEP 2: Price slider row with search button inline */
    .mobile-search-card .row.g-2.mt-2 {
        margin-top: 0 !important;
        padding: 0 !important;
    }

    .mobile-search-card .row.g-2.mt-2 .col-12 {
        width: 100% !important;
        padding: 0 !important;
        position: relative !important;
    }
    
    /* Price slider section */
    #heroPriceSliderMobile {
        width: 100% !important;
        padding: 0.7rem 1rem !important;
        padding-right: 4.25rem !important;
        box-sizing: border-box !important;
        border-radius: 16px !important;
        border: 1px solid rgba(148, 163, 184, 0.35) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 18px rgba(15, 23, 42, 0.08) !important;
        background: linear-gradient(180deg, #ffffff, #f8fafc) !important;
        backdrop-filter: blur(4px) !important;
    }
    
    /* RTL support for mobile price slider */
    [dir="rtl"] #heroPriceSliderMobile {
        padding-right: 1rem !important;
        padding-left: 4.25rem !important;
    }

    /* Move button to overlap slider row */
    .mobile-search-card {
        position: relative !important;
    }

    .mobile-search-card .ms-col-btn {
        display: flex !important;
        position: absolute !important;
        bottom: 0.85rem !important;
        right: 0.85rem !important;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 2 !important;
    }

    [dir="rtl"] .mobile-search-card .ms-col-btn {
        right: auto !important;
        left: 0.85rem !important;
    }
    
    .mobile-search-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 14px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: radial-gradient(circle at 25% 25%, #4dabff, #0d6efd) !important;
        color: #ffffff !important;
        border: none !important;
        box-shadow: 0 12px 25px rgba(13, 110, 253, 0.35) !important;
    }
    
    .mobile-search-btn i {
        font-size: 18px !important;
        color: #ffffff !important;
    }
    
    /* Price Range Slider - compact aesthetic */
    .price-range-slider {
        padding: 0.5rem 0.6rem !important;
        border-radius: 0.75rem !important;
        border-width: 1px !important;
        width: 100% !important;
    }
    
    .price-range-slider-sm {
        padding: 0.5rem 0.55rem !important;
    }
    
    .price-range-values {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 0.78rem !important;
        font-weight: 600 !important;
        color: #0f172a !important;
        margin-bottom: 0.35rem !important;
    }
    
    .price-range-track {
        height: 1.2rem !important;
        margin-top: 0.2rem !important;
    }
    
    /* Price range row label - hidden */
    .mobile-search-card .row.g-2 label.form-label {
        display: none !important;
    }
    
    .mobile-search-card .row.g-2.mt-2 .col-12 {
        display: block !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .mobile-search-card {
        position: relative !important;
    }
    
    .mobile-search-card .ms-col-btn {
        position: absolute !important;
        bottom: 0.85rem !important;
        right: 0.85rem !important;
    }
    
    [dir="rtl"] .mobile-search-card .ms-col-btn {
        right: auto !important;
        left: 0.85rem !important;
    }
    
    /* Hero Search Buffer */
    .hero-search-buffer {
        height: 0.75rem !important;
    }
    
    /* Property Section - Mobile optimization */
    .property-section {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .property-shell {
        padding: 1rem !important;
    }
    
    /* Property Grid - Single column on mobile */
    .property-2.row {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }
    
    .property-2 > div[class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Property Card - Mobile optimization */
    .property-box {
        border-radius: 16px !important;
        margin-bottom: 0 !important;
    }
    
    .property-image {
        border-radius: 16px 16px 0 0 !important;
    }
    
    .property-image img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
        object-fit: cover !important;
    }
    
    /* Property Details - Mobile spacing */
    .property-details.property-home-list {
        padding: 1rem !important;
    }
    
    .property-details h6 {
        font-size: 1rem !important;
        margin-bottom: 0.75rem !important;
        line-height: 1.4 !important;
    }
    
    .property-details .font-16 {
        font-size: 14px !important;
    }
    
    .property-details .font-19 {
        font-size: 15px !important;
    }
    
    .property-details .prop-text {
        font-size: 14px !important;
        padding-bottom: 0.5rem !important;
    }
    
    /* Amenities Icons - Better spacing on mobile */
    .property-details i.fas {
        font-size: 16px !important;
        margin-right: 0.5rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    [dir="rtl"] .property-details i.fas {
        margin-right: 0 !important;
        margin-left: 0.5rem !important;
    }
    
    /* Property Button - Modern Mobile Design */
    .property-btn {
        position: relative !important;
        margin-top: 0.75rem !important;
        justify-content: flex-end !important;
        display: flex !important;
    }
    
    .property-btn .btn {
        min-height: 48px !important;
        padding: 0.75rem 1.5rem !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        border-radius: 12px !important;
        background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%) !important;
        color: #ffffff !important;
        border: none !important;
        box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25) !important;
        transition: all 0.3s ease !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: auto !important;
        max-width: 50% !important;
        white-space: nowrap !important;
    }
    
    .property-btn .btn::after {
        content: '→';
        font-size: 18px;
        transition: transform 0.3s ease;
        display: inline-block;
    }
    
    .property-btn .btn:hover,
    .property-btn .btn:active {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 16px rgba(13, 110, 253, 0.35) !important;
    }
    
    .property-btn .btn:hover::after {
        transform: translateX(4px);
    }
    
    .property-btn .btn:active {
        transform: translateY(0) !important;
    }
    
    /* RTL Support - Button stays on right, arrow flips */
    [dir="rtl"] .property-btn,
    [dir="rtl"] .property-btn.d-flex,
    [dir="rtl"] .property-btn.justify-content-end {
        justify-content: flex-end !important;
    }
    
    [dir="rtl"] .property-btn .btn::after {
        content: '←';
    }
    
    [dir="rtl"] .property-btn .btn:hover::after {
        transform: translateX(-4px);
    }
    
    /* Feature Section - Mobile optimization */
    .service-highlight {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .feature-shell {
        padding: 1.5rem 1rem !important;
    }
    
    .feature-visual {
        width: 100% !important;
        max-width: 300px !important;
        margin: 0 auto 2rem !important;
    }
    
    .feature-card-grid .row {
        gap: 1rem !important;
    }
    
    .feature-card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Advisor CTA - Mobile optimization */
    .advisor-cta__card {
        flex-direction: column !important;
    }
    
    .advisor-cta__image {
        min-height: 200px !important;
    }
    
    .advisor-cta__content {
        padding: 1.5rem 1rem !important;
    }
    
    /* Slide Menu - Full screen on mobile - Don't override position */
    .slide-menu {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
    }
    
    /* Footer - Mobile optimization */
    .mobile-footer {
        padding: 1.5rem 1rem !important;
    }
    
    .footer-logo-img {
        max-width: 150px !important;
        height: auto !important;
    }
    
    /* Ensure proper touch targets */
    a, button, .btn, input[type="button"], input[type="submit"] {
        min-height: 44px !important;
    }
    
    /* Better form control sizing */
    .form-control, .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.625rem 0.75rem !important;
    }
    
    /* Container padding on mobile */
    .container, .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Better table responsiveness */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Image responsiveness */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* ============================================
   SMALL MOBILE DEVICES (max-width: 575px)
   ============================================ */

@media (max-width: 575px) {
    
    /* Even more compact on small screens */
    .mobile-topbar {
        padding: 0.5rem 0.75rem !important;
    }
    
    .mobile-logo img.cst-logo {
        height: 38px !important;
    }
    
    .map-chip-wrapper .btn span {
        font-size: 0.813rem !important;
    }
    
    /* Hero Section - Smaller on tiny screens */
    .banner-section .video-bg.cst-slider,
    .home-main.feature-section.new-property.hero-main {
        min-height: 40vh !important;
        height: 40vh !important;
    }
    
    /* Mobile Search Card - Adjust for smaller screens */
    .mobile-search-card {
        padding: 0.75rem !important;
    }
    
    .mobile-search-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
    }
    
    .mobile-search-btn i {
        font-size: 16px !important;
    }
    
    .mobile-field .form-select {
        font-size: 13px !important;
        padding: 0.5rem 0.65rem !important;
        height: 40px !important;
    }
    
    .price-range-slider {
        padding: 0.4rem 0.5rem !important;
    }
    
    .price-range-values {
        font-size: 0.688rem !important;
    }
    
    .mobile-search-card .row.g-2 label.form-label {
        font-size: 10px !important;
    }
    
    /* Property Details - Tighter spacing */
    .property-details.property-home-list {
        padding: 0.875rem !important;
    }
    
    .property-details h6 {
        font-size: 0.938rem !important;
    }
    
    /* Feature Cards - Stack properly */
    .feature-card {
        padding: 0.875rem !important;
    }
    
    .feature-card h5 {
        font-size: 0.938rem !important;
    }
}

/* ============================================
   RTL SUPPORT - Mobile Only
   ============================================ */

@media (max-width: 767px) {
    [dir="rtl"] .mobile-topbar {
        flex-direction: row-reverse !important;
    }
    
    [dir="rtl"] .mobile-divider {
        border-inline-end: none !important;
        border-inline-start: 1px solid #e5e7eb !important;
    }
}

/* ============================================
   ACCESSIBILITY - Mobile Only
   ============================================ */

@media (max-width: 767px) {
    /* Focus states for touch devices */
    .mobile-search-btn:focus,
    .menu-toggle:focus,
    .property-box:focus-within {
        outline: 2px solid #0d6efd !important;
        outline-offset: 2px !important;
    }
    
    /* Better tap highlights */
    a, button, .btn {
        -webkit-tap-highlight-color: rgba(13, 110, 253, 0.1) !important;
    }
}

/* ============================================
   REDUCED MOTION - All devices
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
