/* ========================================
   Updated Responsive Optimizations
   Mobile-First Design Improvements
   ======================================== */

/* ========================================
   Global Overflow Fix - All screen sizes
   ======================================== */
* {
    max-width: 100%;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

.container,
.mobile-nav,
.site-header,
.site-main,
.site-footer {
    width: 100%;
    max-width: 100%;
}

/* Ensure images and embeds don't overflow */
img,
video,
iframe,
embed,
object {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Extra Small Phones (≤375px)
   ======================================== */
@media (max-width: 375px) {
    /* Root Font Size */
    html {
        font-size: 14px;
    }

    /* Container & Padding */
    .container {
        padding: 0 0.75rem;
    }

    /* Hide Top Bar */
    .top-bar {
        display: none;
    }

    /* Header & Navigation */
    .site-header {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .header-inner {
        padding: 0.6rem 0.75rem;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }

    .site-title {
        font-size: 1.1rem;
        gap: 0.15rem;
        color: #1a1a1a !important;
    }

    .logo-text {
        font-size: 0.95rem;
    }

    .site-description {
        font-size: 0.4rem;
        letter-spacing: 1px;
    }

    .main-nav {
        display: none !important;
    }

    .header-actions {
        gap: 0.3rem;
    }

    .header-action-btn {
        width: 32px;
        height: 32px;
    }

    .header-action-btn svg {
        width: 14px;
        height: 14px;
    }

    .mobile-menu-toggle {
        width: 40px !important;
        height: 40px !important;
    }

    /* Mobile Menu Drawer */
    .mobile-nav {
        width: 260px;
    }

    .mobile-menu a {
        padding: 14px 18px;
        font-size: 0.85rem;
    }

    /* Headings */
    h1 {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }

    h2 {
        font-size: clamp(1.25rem, 5vw, 2rem);
    }

    h3 {
        font-size: clamp(1.1rem, 4vw, 1.5rem);
    }

    /* Hero Section */
    .hero-section {
        min-height: 45vh;
        padding: 1.5rem 0.75rem;
    }

    .hero-content h1 {
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
    }

    .hero-content p {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    /* Buttons */
    .btn,
    button,
    input[type="submit"] {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .btn-large {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Cards */
    .lsc-property-card {
        border-radius: 8px;
    }

    /* Property Grid */
    .properties-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .lsc-property-card .lsc-card-image {
        height: 150px;
    }

    /* Spacing */
    .lsc-section {
        padding: 1.5rem 0.75rem;
    }

    .lsc-section.lsc-large {
        padding: 2rem 0.75rem;
    }

    /* Text Sizes */
    p,
    li,
    label {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    small,
    .text-small {
        font-size: 0.75rem;
    }

    /* Forms */
    input,
    textarea,
    select {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    /* Footer */
    .site-footer {
        padding: 2rem 0.75rem 1rem;
    }

    .footer-widgets {
        gap: 1.5rem;
    }

    .footer-widget-col h3 {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }

    .footer-widget-col a {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    /* Utilities */
    .ml-auto {
        margin-left: auto;
    }

    .gap-1 {
        gap: 0.5rem;
    }

    .gap-2 {
        gap: 1rem;
    }

    /* Hide less important elements */
    .breadcrumb {
        font-size: 0.7rem;
        gap: 0.3rem;
    }

    /* WhatsApp Button */
    .whatsapp-float {
        width: 50px !important;
        height: 50px !important;
        bottom: 15px !important;
        right: 15px !important;
    }

    .whatsapp-float svg {
        width: 24px !important;
        height: 24px !important;
    }

    /* Share Buttons */
    .lsc-share-buttons {
        gap: 8px;
    }

    .lsc-share-btn {
        width: 40px;
        height: 40px;
        padding: 6px;
    }

    .lsc-share-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Map Container */
    .lsc-map-container {
        height: 200px;
    }

    /* Location Map */
    .lsc-location-map {
        height: 200px;
    }

    .lsc-sidebar-card {
        padding: 15px;
    }
}

/* ========================================
   Small Phones (376px - 480px)
   ======================================== */
@media (min-width: 376px) and (max-width: 480px) {
    html {
        font-size: 14.5px;
    }

    .container {
        padding: 0 1rem;
    }

    .top-bar {
        display: none;
    }

    .header-inner {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .site-title {
        font-size: 1.35rem;
        color: #1a1a1a !important;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .site-description {
        font-size: 0.5rem;
    }

    .main-nav {
        display: none !important;
    }

    .header-action-btn {
        width: 36px;
        height: 36px;
    }

    .header-action-btn svg {
        width: 18px;
        height: 18px;
    }

    .mobile-menu-toggle {
        width: 44px !important;
        height: 44px !important;
    }

    .mobile-nav {
        width: 280px;
    }

    .mobile-menu a {
        padding: 16px 20px;
        font-size: 0.9rem;
    }

    h1 {
        font-size: clamp(1.6rem, 6vw, 2.5rem);
    }

    h2 {
        font-size: clamp(1.3rem, 5vw, 2rem);
    }

    .hero-section {
        min-height: 50vh;
        padding: 2rem 1rem;
    }

    .properties-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .lsc-property-card .lsc-card-image {
        height: 200px;
    }

    .lsc-section {
        padding: 2rem 1rem;
    }

    .site-footer {
        padding: 2.5rem 1rem 1.5rem;
    }

    .whatsapp-float {
        width: 54px !important;
        height: 54px !important;
        bottom: 18px !important;
        right: 18px !important;
    }

    .whatsapp-float svg {
        width: 26px !important;
        height: 26px !important;
    }

    /* Share Buttons */
    .lsc-share-buttons {
        gap: 10px;
    }

    .lsc-share-btn {
        width: 42px;
        height: 42px;
        padding: 7px;
    }

    .lsc-share-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Map Container */
    .lsc-map-container {
        height: 220px;
    }

    /* Location Map */
    .lsc-location-map {
        height: 220px;
    }

    .lsc-sidebar-card {
        padding: 18px;
    }
}

/* ========================================
   Medium Phones (481px - 600px)
   ======================================== */
@media (min-width: 481px) and (max-width: 600px) {
    .container {
        padding: 0 1.25rem;
    }

    .top-bar {
        display: none;
    }

    .header-inner {
        padding: 1rem 1.25rem;
    }

    .site-title {
        font-size: 1.5rem;
        color: #1a1a1a !important;
    }

    .main-nav {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .mobile-nav {
        width: 300px;
    }

    .mobile-menu a {
        padding: 16px 24px;
        font-size: 0.95rem;
    }

    .hero-section {
        min-height: 55vh;
        padding: 2.5rem 1.25rem;
    }

    .properties-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .lsc-property-card .lsc-card-image {
        height: 220px;
    }

    /* Share Buttons */
    .lsc-share-buttons {
        gap: 10px;
    }

    .lsc-share-btn {
        width: 44px;
        height: 44px;
        padding: 8px;
    }

    .lsc-share-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Map Container */
    .lsc-map-container {
        height: 250px;
    }

    /* Location Map */
    .lsc-location-map {
        height: 250px;
    }

    .lsc-sidebar-card {
        padding: 20px;
    }
}

/* ========================================
   Tablets Small (601px - 670px)
   ======================================== */
@media (min-width: 601px) and (max-width: 670px) {
    .container {
        padding: 0 1rem;
    }

    .top-bar {
        display: none;
    }

    .header-inner {
        padding: 1rem 1rem;
        gap: 0.5rem;
    }

    .site-title {
        font-size: 1.4rem;
        color: #fdfdfd !important;
    }

    .logo-text {
        font-size: 1rem;
    }

    .main-nav {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .header-action-btn {
        width: 38px;
        height: 38px;
    }

    .header-action-btn svg {
        width: 18px;
        height: 18px;
    }

    .mobile-nav {
        width: 290px;
    }

    .mobile-menu a {
        padding: 16px 20px;
        font-size: 0.9rem;
        color: white;
    }

    .hero-section {
        min-height: 55vh;
        padding: 2.5rem 1rem;
    }

    .properties-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .lsc-property-card .lsc-card-image {
        height: 220px;
    }

    .lsc-section {
        padding: 2rem 1rem;
    }

    /* Ensure no overflow on small elements */
    table {
        font-size: 0.9rem;
        width: 100%;
        overflow-x: auto;
    }

    input,
    textarea,
    select {
        max-width: 100%;
        width: 100%;
    }

    /* Share Buttons */
    .lsc-share-buttons {
        gap: 12px;
    }

    .lsc-share-btn {
        width: 44px;
        height: 44px;
        padding: 8px;
    }

    .lsc-share-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Map Container */
    .lsc-map-container {
        height: 280px;
    }

    /* Location Map */
    .lsc-location-map {
        height: 280px;
    }

    .lsc-sidebar-card {
        padding: 22px;
    }
}

/* ========================================
   Tablets (671px - 768px)
   ======================================== */
@media (max-width: 768px) and (min-width: 671px) {
    .container {
        padding: 0 1.5rem;
    }

    .top-bar {
        display: none;
    }

    .header-inner {
        padding: 1.25rem 1.5rem;
    }

    .site-title {
        font-size: 1.6rem;
        color: #1a1a1a !important;
    }

    .main-nav {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .mobile-nav {
        width: 320px;
    }

    .mobile-menu a {
        padding: 18px 24px;
        font-size: 1rem;
    }

    .hero-section {
        min-height: 60vh;
        padding: 3rem 1.5rem;
    }

    .properties-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .lsc-property-card .lsc-card-image {
        height: 250px;
    }

    /* Share Buttons */
    .lsc-share-buttons {
        gap: 12px;
    }

    .lsc-share-btn {
        width: 44px;
        height: 44px;
        padding: 8px;
    }

    .lsc-share-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Map Container */
    .lsc-map-container {
        height: 300px;
    }

    /* Location Map */
    .lsc-location-map {
        height: 300px;
    }

    .lsc-sidebar-card {
        padding: 25px;
    }
}

/* ========================================
   Tablets Landscape (769px - 1024px)
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-inner {
        padding: 1.25rem 2rem;
    }

    .main-nav .menu {
        gap: 2rem;
    }

    .properties-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .footer-widgets {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   Desktop (1025px+)
   ======================================== */
@media (min-width: 1025px) {
    .header-inner {
        padding: 1.5rem 2rem;
    }

    .header-actions {
        margin-left: auto;
    }

    .main-nav {
        flex: 1;
        display: flex;
        justify-content: flex-end;
    }

    .main-nav .menu {
        gap: 2.5rem;
    }

    .properties-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }

    .footer-widgets {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   Landscape Mode Optimizations
   ======================================== */
@media (max-height: 600px) and (orientation: landscape) {
    .site-header {
        position: sticky;
    }

    .header-inner {
        padding: 0.75rem 1.5rem;
        gap: 1.5rem;
    }

    .top-bar {
        padding: 0.35rem 0;
        font-size: 0.75rem;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .hero-section {
        min-height: auto;
        height: calc(100vh - 140px);
        padding: 1.5rem 2rem;
    }

    .hero-controls {
        padding: 0 1rem;
    }
}

/* ========================================
   Extra Large Desktops (1920px+)
   ======================================== */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }

    h1 {
        font-size: 4.5rem;
    }

    h2 {
        font-size: 3.5rem;
    }

    .hero-section {
        min-height: 85vh;
    }

    .properties-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   Accessibility & UX Improvements
   ======================================== */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .main-nav .menu a::after {
        transition: none;
    }

    .header-action-btn {
        transition: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root:not([data-color-scheme="light"]) {
        --bg: #1a1a1a;
        --bg-light: #2a2a2a;
        --text: #e0e0e0;
        --text-light: #b0b0b0;
        --border: #3a3a3a;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
    .header-action-btn {
        border: 2px solid currentColor;
        background: transparent;
    }

    .main-nav .menu a {
        text-decoration: underline;
    }
}

/* Touch Targets */
@media (hover: none) and (pointer: coarse) {
    .header-action-btn {
        width: 44px;
        height: 44px;
    }

    a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    button,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
}
