/* ============================================
   MOBILE FIX - Force Scrolling on All Devices
   ============================================ */

/* Hide hamburger menu completely */
.mobile-menu-toggle {
    display: none !important;
}

/* Ensure body and html allow scrolling on mobile */
@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        max-height: none !important;
        position: relative !important;
    }

    .site,
    #page,
    main,
    .main-content {
        overflow-y: auto !important;
        height: auto !important;
        min-height: auto !important;
    }

    /* FIX HERO SECTION & HEADER */
    .hero-section-new,
    .hero-section {
        height: auto !important;
        /* Remove full screen height */
        min-height: 0 !important;
        overflow: hidden !important;
        /* Prevent internal scroll */
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        padding-top: 80px !important;
        /* Space for fixed header + 20px */
        padding-bottom: 0 !important;
        /* Remove bottom space */
        margin-bottom: -5px !important;
        /* Force touch with next section */
    }

    .site-header {
        position: fixed !important;
        /* Fix header */
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 9999 !important;
        background: white !important;
        /* Ensure background is opaque */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
        height: 60px !important;
        /* Force explicit TOTAL height */
        display: flex !important;
        align-items: center !important;
    }

    /* Adjust main content padding to account for fixed header */
    .site-content {
        padding-top: 60px !important;
    }

    /* FIX GAP WITH NEXT SECTION */
    .features-section,
    .home-features {
        margin-top: 0 !important;
        padding-top: 10px !important;
        /* Minimal buffer */
        position: relative !important;
        z-index: 5 !important;
        background: white !important;
    }

    /* FIX ARCHIVE/LISTING PAGE OVERLAP */
    .archive-listings-page,
    .archive-header,
    .post-type-archive-emefa_listing main {
        padding-top: 40px !important;
        /* Adjusted space specifically for archive pages */
        margin-top: 0 !important;
        overflow-x: hidden !important;
        /* Prevent horizontal scroll on page container */
    }

    /* FIX HORIZONTAL OVERFLOW - Stack Grid */
    .archive-main-layout {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100vw !important;
        gap: 20px !important;
    }

    /* Constrain Sidebar Width */
    .filters-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        /* Allow shrinking */
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }
}

/* ============================================
   MOBILE HEADER - HAMBURGER STYLE
   ============================================ */
@media (max-width: 991px) {

    /* Header Layout: Logo left, Hamburger right */
    .header-container {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 15px !important;
        /* Zero vertical padding, let flex align */
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        /* Fill parent 60px */
    }

    /* Logo adjustments */
    .site-branding {
        display: flex !important;
        align-items: center !important;
        flex-shrink: 0;
        margin-right: auto !important;
        height: 100% !important;
    }

    .site-branding img {
        max-height: 32px !important;
        /* Reasonable logo size */
        width: auto !important;
        display: block !important;
    }

    /* Hamburger Menu Button - 3 bars style */
    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 5px !important;
        width: 40px !important;
        /* Slightly smaller */
        height: 40px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        padding: 5px !important;
        z-index: 1001 !important;
        order: 2 !important;
        margin-left: 0 !important;
        /* Reset margin */
    }

    .mobile-menu-toggle .hamburger-line {
        display: block !important;
        width: 24px !important;
        height: 2px !important;
        background-color: #1e293b !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
    }

    /* Hamburger to X animation when active */
    .mobile-menu-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px) !important;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0 !important;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px) !important;
    }

    /* Dropdown Menu Container */
    .header-right-group {
        display: none !important;
        position: fixed !important;
        top: 60px !important;
        /* Match new header height */
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
        padding: 0 20px 30px 20px !important;
        /* Top padding removed */
        z-index: 999 !important;
        flex-direction: column !important;
        gap: 20px !important;
        max-height: calc(100vh - 60px) !important;
        overflow-y: auto !important;
        align-items: flex-start !important;
        /* Left align items */
        text-align: left !important;
        /* Left align text */
    }

    /* Show nav when menu is active */
    .header-right-group.active {
        display: flex !important;
    }

    /* Navigation links - Full width, stacked, LEFT ALIGNED */
    .main-navigation {
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    .main-navigation ul {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        align-items: flex-start !important;
        /* Force left align */
    }

    .main-navigation li {
        width: 100% !important;
        border-bottom: 1px solid #f1f5f9 !important;
        text-align: left !important;
        /* Force left align */
    }

    .main-navigation li:last-child {
        border-bottom: none !important;
    }

    .main-navigation a {
        display: block !important;
        padding: 16px 0 !important;
        font-size: 1rem !important;
        font-weight: 500 !important;
        color: #1e293b !important;
        text-align: left !important;
        /* Force left align */
        width: 100% !important;
    }

    .main-navigation a:hover {
        color: #6366f1 !important;
        padding-left: 5px !important;
        /* Slight movement on hover */
    }

    /* Auth Buttons - Side by side */
    .header-actions {
        width: 100% !important;
        margin-top: 0 !important;
    }

    .auth-buttons {
        display: flex !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .auth-buttons .btn-auth-link {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 12px 20px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        background: white !important;
        color: #1e293b !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        font-size: 0.95rem !important;
    }

    .auth-buttons .btn-register-nav {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 12px 20px !important;
        border-radius: 8px !important;
        background: #4f46e5 !important;
        /* Match Nevoo blue */
        color: white !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        border: none !important;
        font-size: 0.95rem !important;
    }

    /* User profile link when logged in */
    .user-profile-link {
        width: 100% !important;
        justify-content: flex-start !important;
        padding: 15px !important;
        border-radius: 8px !important;
        background: #f8fafc !important;
        display: flex !important;
        align-items: center !important;
        gap: 15px !important;
    }

    /* Mobile menu overlay */
    .mobile-menu-overlay {
        display: none !important;
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.4) !important;
        z-index: 998 !important;
        backdrop-filter: blur(2px) !important;
    }

    .mobile-menu-overlay.active {
        display: block !important;
    }
}

/* ============================================
   MOBILE FEATURE: Horizontal Scrolling Listings
   ============================================ */
@media (max-width: 768px) {

    /* 1. Differentiate the section (Darker background) */
    .listings-section {
        background-color: #f1f5f9 !important;
        /* Light gray background */
        padding: 40px 0 !important;
        border-top: 1px solid #e2e8f0;
        border-bottom: 1px solid #e2e8f0;
    }

    .listings-section .container {
        padding-right: 0 !important;
        /* Remove right padding to allow scroll to edge */
    }

    /* 2. Horizontal Scroll Container */
    .listings-grid-new {
        display: flex !important;
        grid-template-columns: none !important;
        /* Override grid */
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 16px !important;
        padding: 10px 20px 30px 0 !important;
        /* Right padding in scroll area */
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    /* Hide scrollbar but keep functionality */
    .listings-grid-new::-webkit-scrollbar {
        height: 6px;
    }

    .listings-grid-new::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }

    .listings-grid-new::-webkit-scrollbar-track {
        background: transparent;
    }

    /* 3. Card Styling for Scroll */
    .listing-card-new {
        flex: 0 0 85vw !important;
        /* 85% of screen width */
        width: 85vw !important;
        min-width: 280px !important;
        max-width: 320px !important;
        scroll-snap-align: center;
        margin-right: 0 !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
        background: white !important;
    }

    /* Ensure image height is consistent */
    .listing-img-wrapper-new {
        height: 200px !important;
    }

    /* Header adjustments */
    .listings-header-flex {
        padding-right: 20px;
        /* Restore padding for header text */
    }

    .section-title {
        font-size: 1.5rem !important;
    }
}

/* ============================================
   MOBILE FIX: ABOUT PAGE RESPONSIVENESS
   ============================================ */
@media (max-width: 768px) {

    /* Hero Typography */
    .about-hero h1 {
        font-size: 2rem !important;
        /* Reduced from 3.5rem */
    }

    .about-hero p {
        font-size: 1rem !important;
    }

    /* Mission Grid: Stack Vertically */
    .mission-grid {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
    }

    /* Mockup adjustments to fit screen */
    .mockup-wrapper {
        height: auto !important;
        /* Allow auto height */
        min-height: 350px !important;
    }

    .mockup-hero {
        flex-direction: column !important;
        text-align: center !important;
    }

    .mock-hero-content {
        text-align: center !important;
    }

    .mock-hero-image {
        display: none !important;
        /* Hide image inside mockup on small screens to save space */
    }

    .mockup-content {
        height: auto !important;
    }

    .mock-cta-group {
        justify-content: center !important;
    }

    /* Values Grid: Single Column */
    .values-grid {
        grid-template-columns: 1fr !important;
        /* Stack values vertically */
    }

    .value-card {
        padding: 30px 20px !important;
    }

    /* CTA Section Typography */
    .api-cta h2,
    .about-cta h2,
    .cta-box h2 {
        font-size: 1.8rem !important;
    }

    .cta-box {
        padding: 40px 20px !important;
    }

    .cta-buttons {
        flex-direction: column !important;
        width: 100% !important;
    }

    .cta-buttons .btn {
        width: 100% !important;
        text-align: center !important;
    }
}

/* ============================================
   MOBILE FIX: CONTACT PAGE RESPONSIVENESS
   ============================================ */
@media (max-width: 768px) {

    /* Contact Cards Grid - Stack vertically */
    .contact-cards-grid {
        grid-template-columns: 1fr !important;
        /* Force single column */
        gap: 15px !important;
    }

    /* Typography adjustments */
    .contact-title {
        font-size: 2rem !important;
    }

    .contact-hero {
        padding: 3rem 1.5rem 2rem !important;
    }

    /* Contact Form Layout */
    .contact-form-col {
        padding: 1.5rem !important;
    }

    .contact-form-grid {
        gap: 30px !important;
    }

    /* Social Links */
    .social-links {
        flex-wrap: wrap !important;
    }

    /* FIX FILTERS HEADER SIZE on MOBILE */
    .filters-header h3 {
        font-size: 1rem !important;
        /* Significantly reduced */
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .filters-header h3 svg {
        width: 18px !important;
        /* Smaller icon */
        height: 18px !important;
    }

    /* ========================================
       LEAFLET MAP - CRITICAL MOBILE FIXES
       ======================================== */

    /* Override global * { max-width: 100% } from mobile.css */
    .leaflet-container,
    .leaflet-container * {
        max-width: none !important;
        max-height: none !important;
    }

    /* Map Container - Ensure proper height */
    #listings-map,
    .emefa-map-container,
    #listing-map {
        height: 400px !important;
        min-height: 400px !important;
        width: 100% !important;
        background: #f8f9fa !important;
        position: relative !important;
    }

    /* Tiles - Override mobile.css img rules to fix white map */
    .leaflet-tile-pane,
    .leaflet-tile {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .leaflet-tile {
        width: 256px !important;
        height: 256px !important;
        max-width: 256px !important;
        max-height: 256px !important;
        object-fit: none !important;
    }

    /* All map images - prevent mobile.css from breaking them */
    .leaflet-pane img,
    .leaflet-tile-pane img,
    .leaflet-layer img {
        max-width: none !important;
        max-height: none !important;
        width: auto !important;
        height: auto !important;
        object-fit: none !important;
    }

    /* ============================================
       SINGLE LISTING MOBILE FIXES - "PC Syle"
       ============================================ */

    /* Wrapper */
    .single-listing-modern {
        padding: 15px 0 !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* 1. Header: Stacked but clean */
    .sl-header {
        flex-direction: column !important;
        gap: 15px !important;
        margin-bottom: 20px !important;
    }

    .sl-header-right {
        align-items: flex-start !important;
        width: 100% !important;
        flex-direction: column-reverse !important;
        /* Actions below price */
        gap: 15px !important;
    }

    .sl-header-actions {
        width: 100% !important;
        justify-content: flex-start !important;
    }

    .sl-title {
        font-size: 1.6rem !important;
        line-height: 1.3 !important;
    }

    .sl-price-main {
        font-size: 1.5rem !important;
        /* Reduced from 1.8rem */
        width: 100% !important;
    }

    /* Force price items to align left, overriding inline style */
    .sl-price-item {
        justify-content: flex-start !important;
        width: 100% !important;
    }

    /* Fix long text overflow in description */
    .sl-card-content,
    .sl-card-content p {
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }

    /* 2. Gallery: Main Image + Row of 4 Thumbs (Like PC) */
    .sl-gallery-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        height: auto !important;
        margin-bottom: 30px !important;
    }

    .sl-gallery-main {
        width: 100% !important;
        height: 250px !important;
        /* Fixed height for main mobile image */
        grid-column: auto !important;
        grid-row: auto !important;
    }

    /* Wrapper for thumbnails to force them into a row */
    /* Note: Since we can't easily add a wrapper div via CSS, we'll grid the parent */
    /* Actually sl-gallery-grid contains 5 divs directly: main, item, item, item, item */
    /* This is tricky without HTML change. */
    /* Let's try Grid Area approach strictly for mobile */
    .sl-gallery-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        grid-template-rows: 250px 80px !important;
        /* Main row + thumb row */
        gap: 8px !important;
    }

    .sl-gallery-main {
        grid-column: 1 / -1 !important;
        /* Span all 4 */
        grid-row: 1 !important;
    }

    .sl-gallery-item {
        height: 100% !important;
        /* Fill the 80px row */
        aspect-ratio: 1/1 !important;
        /* Square thumbs */
    }

    /* 3. Content Grid - Stacked Vertically */
    .sl-content-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 30px !important;
    }

    .sl-main-content,
    .sl-sidebar {
        width: 100% !important;
        min-width: 0 !important;
        /* Prevent flex shrink issues */
    }

    /* Characteristics: 2 cols on mobile */
    .sl-characteristics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Cards */
    .sl-card,
    .sl-seller-card,
    .sl-map-card {
        padding: 20px !important;
        border-radius: 16px !important;
    }

    /* CTA Banner Spacing & ALignment */
    .sl-cta-banner {
        margin-top: 40px !important;
        /* "Eloigne ces deux sections" */
        padding: 30px 20px !important;
        text-align: center !important;
    }

    .sl-cta-content {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        /* "Centre mieux celle du bas" */
        width: 100% !important;
    }

    .sl-cta-buttons {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        align-items: center !important;
    }

    /* SIMILAR LISTINGS SLIDER (Horizontal Scroll) */
    .sl-similar-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        gap: 15px !important;
        padding-bottom: 20px !important;
        /* Space for scrollbar if visible */
        -webkit-overflow-scrolling: touch !important;
        /* Smooth scroll iOS */
        scrollbar-width: none !important;
        /* Firefox hide scrollbar */
    }

    .sl-similar-grid::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari hide scrollbar */
    }

    .sl-similar-card {
        flex: 0 0 85% !important;
        /* Show part of next card to hint scroll */
        width: 85% !important;
        scroll-snap-align: center !important;
        margin-bottom: 0 !important;
        /* Remove vertical spacing */
    }

    /* FIX MAP ICONS ON MOBILE - Essential Reset */
    .leaflet-marker-icon,
    .leaflet-marker-shadow,
    .custom-map-marker {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        max-width: none !important;
        max-height: none !important;
        pointer-events: auto !important;
        /* ENABLE CLICKS */
        cursor: pointer !important;
    }

    .custom-map-marker>div {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
        /* Ensure background color from inline style is respected */
        background-color: inherit;
        box-sizing: border-box !important;
        /* Ensure rotation is kept but clean */
        border: 2px solid white !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
        pointer-events: auto !important;
        /* ENABLE CLICKS */
    }

    .custom-map-marker i {
        display: block !important;
        visibility: visible !important;
        color: white !important;
        opacity: 1 !important;
        line-height: 1 !important;
        font-size: 14px !important;
        transform: rotate(45deg) !important;
        /* Counteract parent rotation */
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    }

    /* Ensure Popups are Visible and On Top */
    .leaflet-popup {
        z-index: 10000 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .leaflet-popup-content-wrapper {
        background: white !important;
        border-radius: 12px !important;
        padding: 0 !important;
        overflow: hidden !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
    }

    /* Zoom Controls - Ensure visibility */
    .leaflet-control-zoom {
        visibility: visible !important;
        display: block !important;
    }

    /* RESTORE DESKTOP PADDING (Removed from inline style) */
    @media (min-width: 768px) {
        .dashboard-content-inner {
            padding: 2.5rem !important;
        }

        .desktop-form-padding {
            padding: 0 1.5rem 4rem 1.5rem !important;
        }
    }

    /* ========================================
       CREATE LISTING FORM - MOBILE FIXES
       ======================================== */

    /* CRITICAL: NUCLEAR OPTION - Force full width on EVERYTHING */
    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Force all dashboard wrappers to be full width */
    .emefa-dashboard-new,
    .emefa-dashboard-new .dashboard-main,
    .emefa-dashboard-new .dashboard-content-inner,
    .emefa-create-listing-container {
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        left: 0 !important;
        right: 0 !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* CRITICAL: Add top padding to prevent header from hiding content */
    .emefa-dashboard-new {
        padding-top: 80px !important;
        /* Height of sticky header + buffer */
    }

    /* Ensure no parent has padding */
    body .site-content,
    body .entry-content,
    body .page-content,
    body #page,
    body #content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    /* Header - Add padding back since container is 0 */
    .create-listing-header {
        padding: 1.5rem 1rem 0 1rem !important;
        margin-bottom: 1rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .create-listing-header h1 {
        font-size: 1.4rem !important;
        line-height: 1.3 !important;
    }

    .create-listing-header p {
        font-size: 0.9rem !important;
        padding-bottom: 1rem !important;
    }

    /* Cards - No padding, no radius, no shadow (seamless) */
    .emefa-create-listing-container .dashboard-card {
        padding: 1.25rem !important;
        /* Restored some padding for look */
        border-radius: 1.5rem !important;
        /* Rounded corners as requested */
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        border: none !important;
        box-shadow: none !important;
        border-bottom: 1px solid #e2e8f0 !important;
        background: white !important;
        margin-bottom: 0.5rem !important;
        /* Tiny gap between cards */
    }

    /* Form Grid - Single column */
    .emefa-create-listing-container .form-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    .emefa-create-listing-container .full-width,
    .emefa-create-listing-container .half-width {
        grid-column: span 1 !important;
    }

    /* Radio Cards (À Louer / À Vendre) - Side by side but smaller */
    .emefa-create-listing-container .radio-cards-wrapper {
        flex-direction: row !important;
        gap: 0.75rem !important;
    }

    .emefa-create-listing-container .radio-card {
        padding: 0.75rem !important;
        flex: 1 !important;
        flex-direction: column !important;
        text-align: center !important;
        gap: 0.5rem !important;
    }

    .emefa-create-listing-container .radio-card span.material-symbols-outlined {
        font-size: 1.25rem !important;
    }

    /* Price Grid - Stack on mobile */
    .emefa-create-listing-container .price-item {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .emefa-create-listing-container .price-item>div:last-child {
        display: flex !important;
        justify-content: flex-end !important;
    }

    /* Location Actions - Stack buttons */
    .emefa-create-listing-container .location-actions-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .emefa-create-listing-container .location-actions-grid .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Features Counter Grid - 2 columns on mobile with overflow fix */
    .emefa-create-listing-container .features-counter-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    .emefa-create-listing-container .feature-counter-card {
        padding: 0.75rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .emefa-create-listing-container .feature-counter-card label {
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .emefa-create-listing-container .counter-control {
        transform: scale(0.85) !important;
        width: 100% !important;
        max-width: 120px !important;
    }

    .emefa-create-listing-container .surface-input-wrapper input {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Amenities Grid - 2 columns with overflow fix */
    .emefa-create-listing-container .amenities-grid-pills {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        width: 100% !important;
        overflow: hidden !important;
    }

    .emefa-create-listing-container .amenity-pill-label {
        padding: 0.5rem 0.6rem !important;
        font-size: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .emefa-create-listing-container .amenity-pill-text {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        display: block !important;
    }

    /* Vehicle Features Grid - 2 columns */
    .emefa-create-listing-container .vehicle-features-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    /* Pill Selector - Wrap on mobile */
    .emefa-create-listing-container .pill-selector {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    .emefa-create-listing-container .pill-option {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    /* Step Actions - Stack buttons */
    .emefa-create-listing-container .step-actions {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .emefa-create-listing-container .step-actions .btn {
        width: 100% !important;
        margin: 0 !important;
    }

    .emefa-create-listing-container .next-step {
        margin-left: 0 !important;
    }

    /* Media Section - Smaller gallery grid */
    .emefa-create-listing-container .gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }

    .emefa-create-listing-container .image-preview-box {
        min-height: 180px !important;
    }

    /* Video buttons - Stack */
    .emefa-create-listing-container .btn-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    /* Stepper - Compact on mobile */
    .emefa-create-listing-container .listing-stepper {
        padding: 0 !important;
        margin-bottom: 1.5rem !important;
    }

    .emefa-create-listing-container .step-circle {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1rem !important;
    }

    /* Card Section Header - Smaller */
    .emefa-create-listing-container .card-section-header {
        gap: 0.75rem !important;
        padding-bottom: 0.75rem !important;
        margin-bottom: 1.25rem !important;
    }

    .emefa-create-listing-container .card-section-header h2 {
        font-size: 1.1rem !important;
    }

    .emefa-create-listing-container .header-icon {
        width: 2rem !important;
        height: 2rem !important;
        font-size: 1.1rem !important;
    }

    /* Form Actions at Step 3 */
    .emefa-create-listing-container .form-actions {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .emefa-create-listing-container .form-actions .btn {
        width: 100% !important;
    }

    /* Negotiable Price Card */
    .emefa-create-listing-container .negotiable-price-card {
        padding: 1rem !important;
    }

    /* ========================================
       DASHBOARD STATS - HORIZONTAL LAYOUT
       ======================================== */

    .dashboard-stats-grid-new {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem !important;
        width: 100% !important;
        overflow-x: auto !important;
    }

    .dashboard-stat-card-new {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 1rem 0.5rem !important;
    }

    .dashboard-stat-card-new .stat-value {
        font-size: 1.5rem !important;
    }

    .dashboard-stat-card-new .stat-label {
        font-size: 0.7rem !important;
    }

    .dashboard-stat-card-new .stat-icon-wrapper {
        width: 2.5rem !important;
        height: 2.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .dashboard-stat-card-new .stat-icon-wrapper .material-symbols-outlined {
        font-size: 1.25rem !important;
    }

    /* ========================================
       MESSAGES PAGE - MOBILE FIXES
       ======================================== */

    /* Show messages container properly */
    .emefa-messages-modern {
        height: calc(100vh - 200px) !important;
        min-height: 500px !important;
        margin-bottom: 0 !important;
    }

    /* On mobile, always show sidebar initially */
    .messages-sidebar {
        display: flex !important;
        width: 100% !important;
    }

    /* Hide chat area when no conversation selected on mobile */
    .messages-chat-area {
        display: none !important;
    }

    /* When a conversation is selected, hide sidebar and show chat */
    body.has-active-conversation .messages-sidebar {
        display: none !important;
    }

    body.has-active-conversation .messages-chat-area {
        display: flex !important;
    }

    /* Adjust message input for mobile bottom nav */
    .message-input-area {
        padding-bottom: 90px !important;
        /* Account for bottom nav */
    }

    /* Make conversation items more touchable */
    .conversation-item-modern {
        padding: 20px 16px !important;
        min-height: 80px !important;
        display: flex !important;
        align-items: flex-start !important;
        gap: 12px !important;
        text-decoration: none !important;
        color: inherit !important;
    }

    /* Larger touch targets */
    .conversation-avatar {
        width: 54px !important;
        height: 54px !important;
    }

    /* Mobile back button - hidden on desktop */
    .mobile-back-btn {
        display: flex !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important;
        background: #f3f4f6 !important;
        border: 1px solid #e5e7eb !important;
        align-items: center !important;
        justify-content: center !important;
        margin-right: 8px !important;
    }

    /* Add body class when conversation is active */
    body.has-conversation-selected .messages-sidebar {
        display: none !important;
    }

    body.has-conversation-selected .messages-chat-area {
        display: flex !important;
    }

    /* Dashboard header actions - horizontal layout on mobile */
    .dashboard-header-actions-group {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }

    .dashboard-header-actions-group .btn-dashboard-action {
        flex: 1 !important;
        white-space: nowrap !important;
    }

    .dashboard-header-actions-group .btn-dashboard-action.icon-only {
        flex: 0 0 auto !important;
        min-width: 48px !important;
    }
}