/* Toscanini Mobile Optimization - FIXED */

@media (max-width: 992px) {

    /* 1. Header Top Bar - HIDDEN ON MOBILE */
    .header-top {
        display: none !important;
    }

    /* 2. Main Header - CLEANUP */
    .header-main .container {
        padding: 10px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
        height: 80px;
    }

    .logo-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        max-width: 70%;
        /* Prevent logo overlapping menu */
    }

    .logo-brand img {
        height: 35px;
        /* Slightly smaller logo */
        width: auto;
    }

    .brand-text h1 {
        font-size: 1.1rem !important;
        /* Smaller text */
        margin-bottom: 0;
        line-height: 1;
    }

    /* Hide subtitle on mobile to save space */
    .brand-text p {
        display: none;
    }

    .header-cta {
        display: none;
    }

    /* Hamburger Menu adjustment */
    .mobile-menu-toggle {
        font-size: 1.5rem;
        color: var(--navy);
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(5px);
        border: none;
        cursor: pointer;
        padding: 5px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 50px;
        height: 50px;
        z-index: 99999 !important;
        position: relative;
        flex-shrink: 0;
        margin-left: 10px;
        border-radius: 5px;
    }

    /* Hide Main Nav by default on mobile */
    #mainNav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        height: 100vh;
        background: var(--navy);
        z-index: 10000;
        transition: right 0.4s ease;
        padding-top: 80px;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.2);
        display: block !important;
        /* Ensure it's not display:none from desktop */
    }

    #mainNav.mobile-nav-open {
        right: 0;
    }

    #mainNav ul {
        flex-direction: column;
        align-items: center;
        gap: 30px;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    #mainNav a {
        color: white;
        font-size: 1.2rem;
        text-decoration: none;
        display: block;
        padding: 10px;
    }

    .mobile-close {
        position: absolute;
        top: 20px;
        right: 20px;
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }

    /* 3. Hero Section - COMPLETELY HIDDEN ON MOBILE */
    .hero {
        display: none !important;
    }

    /* 4. Search Form - HIDDEN ON MOBILE */
    .search-bar-container {
        display: none !important;
    }

    /* SPACER FIXES for Content */
    .intro-section {
        padding-top: 150px !important;
    }

    .property-header {
        padding-top: 140px !important;
    }

    .page-header {
        padding-top: 140px !important;
    }

    /* GLOBAL MOBILE FIXES */
    html,
    body {
        overflow-x: hidden !important;
        /* Nuclear fix for right-side whitespace */
        width: 100% !important;
        position: relative;
    }

    img,
    iframe,
    video {
        max-width: 100% !important;
        height: auto !important;
    }

    .container {
        padding-left: max(20px, env(safe-area-inset-left)) !important;
        padding-right: max(20px, env(safe-area-inset-right)) !important;
        width: 100% !important;
    }

    /* PROPERTY LISTING FIXES */
    .property-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }

    .property-image,
    .card-img {
        height: auto !important;
        max-height: none !important;
    }

    .property-image img,
    .card-img img {
        height: auto !important;
        object-fit: contain !important;
        aspect-ratio: auto !important;
    }

    /* PROPERTY DETAILS (property.php) FIXES */
    .property-header .container>div {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    .property-header h1 {
        text-align: center !important;
    }

    .property-header div[style*="text-align: right"] {
        text-align: center !important;
        margin-top: 20px;
    }

    .gallery-grid {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }

    /* Fix Gallery Image Spacing */
    .gallery-item {
        margin-bottom: 20px !important;
    }

    .gallery-item:last-child {
        margin-bottom: 0 !important;
    }

    /* Fix Amenities Row */
    .amenities-row {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 20px !important;
        padding: 15px !important;
    }

    .detail-icon {
        flex: 1 1 45% !important;
        justify-content: center !important;
        white-space: nowrap;
    }

    /* Center Align Property Details Content */
    .property-main h2,
    .property-main p,
    .property-main .detail-icon {
        text-align: center !important;
    }

    .info-sidebar {
        text-align: center !important;
    }

    .info-sidebar h3 {
        text-align: center !important;
    }

    .gallery-main,
    .gallery-sub {
        height: 300px !important;
        grid-row: auto !important;
    }

    .property-main>div {
        flex-direction: column !important;
    }

    .property-main>div>div {
        min-width: 100% !important;
    }

    /* FIX SPECIFIC PROPERTY PAGE OVERFLOW */
    .gallery-grid,
    .video-container,
    .info-sidebar {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    /* CONTACT & ABOUT FIXES */
    .contact-grid,
    .about-grid {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }

    .values-grid {
        grid-template-columns: 1fr !important;
    }

    /* TYPOGRAPHY & FORMS */
    p {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    h1 {
        font-size: clamp(2rem, 5vw, 2.5rem) !important;
        line-height: 1.2 !important;
    }

    h2 {
        font-size: clamp(1.5rem, 4vw, 2rem) !important;
    }

    .form-group,
    .search-group {
        margin-bottom: 20px !important;
    }

    label {
        margin-bottom: 8px !important;
        display: block;
        font-size: 14px;
        font-weight: 600;
    }

    input,
    select,
    textarea,
    button,
    .btn-gold {
        min-height: 48px !important;
        font-size: 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Footer Widget Mobile */
    .whatsapp-widget {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 24px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    }
}

/* Desktop Widget Adjustment */
@media (min-width: 993px) {
    .whatsapp-widget {
        bottom: 40px;
        right: 40px;
        z-index: 10000;
    }
}