/* Global fixes for horizontal overflow */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
}

/* Ensure all images and videos are responsive */
img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Fix for elements that might cause overflow */
.w-full {
  width: 100% !important;
  max-width: 100% !important;
}

/* Marquee container overflow fixes */
.marquee-container {
  overflow: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
}

.marquee-track {
  width: max-content !important;
  max-width: none !important;
}

/* General container padding for small screens */
@media (max-width: 640px) {
  .max-w-7xl,
  .container,
  .mx-auto,
  .px-6,
  .lg\:px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* Headings and text scaling - EXCLUDE property cards */
@media (max-width: 640px) {
  /* Main page headings only */
  section > div > h1, 
  section > div > h2:not(.property-card h2),
  .text-4xl:not(.property-card *), 
  .text-6xl:not(.property-card *) {
    font-size: 2rem !important;
    line-height: 2.5rem !important;
  }
  
  section > div > h2:not(.property-card h2), 
  .text-3xl:not(.property-card *), 
  .text-5xl:not(.property-card *) {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
  }
  
  /* Property card headings keep their original size */
  .property-card h3,
  .property-card .text-xl {
    font-size: 1.25rem !important;
    line-height: 1.75rem !important;
  }
  
  /* Property card text keeps proper sizing */
  .property-card .text-sm {
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
  }
  
  .property-card .text-xs {
    font-size: 0.75rem !important;
    line-height: 1rem !important;
  }
}

/* Navbar adjustments */
@media (max-width: 768px) {
  nav .h-16, nav .md\\:h-20 {
    height: 56px !important;
  }
  nav .px-6 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  nav .text-xl {
    font-size: 1.25rem !important;
  }
}

/* Swiper spacing adjustments only */
@media (max-width: 640px) {
  .swiper-wrapper {
    gap: 1rem !important;
  }
}

/* Mobile swiper behavior improvements - NO width overrides */
@media (max-width: 640px) {
  .swiper-container, .mySwiper {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .swiper-wrapper {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 1rem !important;
    padding-bottom: 1rem !important;
  }
  .swiper-slide {
    scroll-snap-align: start !important;
    margin-right: 0 !important;
    transition: transform 0.3s;
    flex-shrink: 0 !important;
  }
  .swiper-scrollbar {
    display: none !important;
  }
  /* Property card image aspect ratio fix for mobile */
  .property-card .aspect-\[5\/7\] {
    aspect-ratio: 5/7 !important;
    height: auto !important;
    min-height: 200px !important;
  }
}

/* Footer stacking and padding */
@media (max-width: 768px) {
  footer .flex {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 2rem !important;
  }
  footer .px-6 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  footer .py-8 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
}

/* Footer mobile responsiveness */
@media (max-width: 640px) {
  footer .flex {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
    text-align: left !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  footer .flex > div {
    width: 100% !important;
    margin-bottom: 0.75rem !important;
    text-align: left !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  /* Logo/brand section left-aligned */
  footer .flex > div:first-child {
    align-items: flex-start !important;
    display: flex !important;
    flex-direction: column !important;
    text-align: left !important;
    padding-left: 0 !important;
  }
  /* Social icons right-aligned */
  footer .flex > div:last-child {
    align-items: flex-end !important;
    display: flex !important;
    flex-direction: column !important;
    text-align: right !important;
    padding-right: 0 !important;
  }
  /* Middle sections (contact, branches) left-aligned */
  footer .flex > div:nth-child(2),
  footer .flex > div:nth-child(3) {
    align-items: flex-start !important;
    display: flex !important;
    flex-direction: column !important;
    text-align: left !important;
    padding-left: 0 !important;
  }
  /* Font and icon size tweaks remain as before */
  footer .text-2xl,
  footer .font-serif.font-bold {
    font-size: 1.25rem !important;
  }
  footer .text-sm,
  footer span,
  footer a {
    font-size: 0.85rem !important;
  }
  footer .w-20,
  footer .h-20 {
    width: 60px !important;
    height: 60px !important;
  }
  footer .w-6,
  footer .h-6 {
    width: 22px !important;
    height: 22px !important;
  }
  footer .py-12 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  footer .gap-8 {
    gap: 0.75rem !important;
  }
  footer .font-semibold {
    font-size: 1rem !important;
  }
  footer .max-w-xs {
    max-width: 100% !important;
  }
  footer .border-t {
    margin-top: 0 !important;
  }
  /* Left-align 'Follow Us' text and icons */
  footer .flex > div:last-child {
    align-items: flex-start !important;
    text-align: left !important;
    padding-right: 0 !important;
  }
  footer .flex > div:last-child span {
    text-align: left !important;
    display: block !important;
  }
  footer .flex > div:last-child .flex {
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 0.7rem !important;
    margin-top: 0.2rem !important;
  }
}

/* Form input full width on mobile */
@media (max-width: 640px) {
  form input,
  form button {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  form .flex-col,
  form .md\\:flex-row {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
}

/* Hide desktop menu on mobile, show mobile menu */
@media (max-width: 768px) {
  #nav-menu-desktop {
    display: none !important;
  }
  #mobile-menu {
    display: block !important;
  }
}

/* Hide mobile menu on desktop */
@media (min-width: 769px) {
  #mobile-menu {
    display: none !important;
  }
}

/* Additional mobile overflow fixes */
@media (max-width: 768px) {
  /* Ensure navigation doesn't cause overflow */
  nav {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  /* Fix navbar content */
  nav .mx-2 {
    margin-left: 0.5rem !important;
    margin-right: 0.5rem !important;
  }
  
  /* Ensure sections don't overflow */
  section {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  /* Fix any potential text overflow */
  * {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* Fix for large images that might cause overflow */
  img[class*="w-["], 
  .w-\[770px\],
  .w-\[990px\] {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Utility: fix for rounded corners on mobile */
.rounded-2xl, .rounded-xl, .rounded-lg, .rounded-full {
  border-radius: 1rem !important;
}

/* Utility: fix for box-shadow on mobile */
.shadow-lg, .shadow-2xl {
  box-shadow: 0 2px 16px 0 rgba(29,52,84,0.06) !important;
}

/* Utility: fix for border on mobile */
.border, .border-2 {
  border-width: 1px !important;
}

/* Utility: fix for font smoothing */
body, html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Property card consistency - Force exact height */
.property-card {
  display: flex !important;
  flex-direction: column !important;
  height: 520px !important;
  min-height: 520px !important;
  max-height: 520px !important;
}

/* Homepage property cards - Very specific targeting */
#properties .grid > div,
#properties .bg-white.rounded-2xl,
section#properties .bg-white {
  height: 520px !important;
  min-height: 520px !important;
  max-height: 520px !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Content area styling */
.property-card .p-4,
#properties .bg-white .p-4 {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  height: auto !important;
}

.property-card .p-4 p.flex-1,
#properties .bg-white .p-4 p.flex-1 {
  flex: 1 !important;
  overflow-wrap: break-word !important;
}

/* Ensure buttons stay at bottom */
.property-card .p-4 a.mt-auto,
#properties .bg-white .p-4 a.mt-auto {
  margin-top: auto !important;
}

/* Ensure grid items stretch to same height */
.grid.items-stretch {
  align-items: stretch;
}

.grid.items-stretch > * {
  height: 100%;
}

/* Mobile adjustments for property cards - maintain consistent dimensions */
@media (max-width: 640px) {
  .property-card {
    /* Use fixed pixel width that fits comfortably */
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    flex-shrink: 0 !important;
  }
  
  .property-card .p-4 {
    padding: 0.875rem !important;
  }
}

@media (max-width: 400px) {
  .property-card {
    /* Smaller screens get smaller cards */
    width: calc(100vw - 4rem) !important;
    min-width: calc(100vw - 4rem) !important;
    max-width: calc(100vw - 4rem) !important;
    max-width: 300px !important;
  }
}

/* Fade-in on scroll */
.fade-in-init {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.4,0,0.2,1), transform 0.8s cubic-bezier(0.4,0,0.2,1);
}
.fade-in-visible {
  opacity: 1;
  transform: none;
}

/* Slide-up on scroll */
.slide-up-init {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.4,0,0.2,1), transform 0.8s cubic-bezier(0.4,0,0.2,1);
}
.slide-up-visible {
  opacity: 1;
  transform: none;
}

/* Scale-in on scroll */
.scale-in-init {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1), transform 0.7s cubic-bezier(0.4,0,0.2,1);
}
.scale-in-visible {
  opacity: 1;
  transform: scale(1);
}

/* Page load fade-in */
body.page-fade-in-init {
  opacity: 0;
  transition: opacity 1s ease;
}

body.page-fade-in-visible {
  opacity: 1;
}

.logo {
  opacity: 0;
  transform: translateY(-30px);
  transition: opacity 1s 0.3s, transform 1s 0.3s;
}

body.page-fade-in-visible .logo {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  footer .flex {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    gap: 0.75rem !important;
  }
  footer .flex > div {
    margin-bottom: 0.5rem !important;
  }
  footer .py-12 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  footer .gap-8 {
    gap: 0.5rem !important;
  }
}

@media (max-width: 640px) {
  .swiper {
    width: 100% !important;
    max-width: calc(100% - 2rem) !important;
    overflow-x: auto !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  .swiper-wrapper {
    width: auto !important;
    min-width: min-content !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 1rem !important;
    padding-bottom: 1rem !important;
  }
  .swiper-slide,
  .property-card {
    min-width: 280px !important;
    max-width: 280px !important;
    width: 280px !important;
    scroll-snap-align: start !important;
    margin-right: 0 !important;
    background: white !important;
    z-index: 1 !important;
    flex-shrink: 0 !important;
  }
  /* Ensure containers don't cause overflow */
  .max-w-7xl,
  .container,
  .mx-auto {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  .px-6,
  .lg\\:px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* Mobile font size adjustments - tablets */
@media (max-width: 768px) {
  /* Large headings */
  .text-8xl {
    font-size: 3rem !important;
    line-height: 3.5rem !important;
  }
  .text-6xl {
    font-size: 2.5rem !important;
    line-height: 3rem !important;
  }
  .text-5xl {
    font-size: 2rem !important;
    line-height: 2.5rem !important;
  }
  .text-4xl {
    font-size: 1.75rem !important;
    line-height: 2.25rem !important;
  }
  .text-3xl {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
  }
  .text-2xl {
    font-size: 1.25rem !important;
    line-height: 1.75rem !important;
  }
  .text-xl {
    font-size: 1.125rem !important;
    line-height: 1.625rem !important;
  }
  .text-lg {
    font-size: 1rem !important;
    line-height: 1.5rem !important;
  }
  /* General text elements */
  p, span {
    font-size: 0.95rem !important;
    line-height: 1.5rem !important;
  }
}

/* Mobile font size adjustments - small phones */
@media (max-width: 480px) {
  /* Extra aggressive font size reduction for small screens */
  .text-8xl {
    font-size: 2rem !important;
    line-height: 2.5rem !important;
  }
  .text-6xl {
    font-size: 1.75rem !important;
    line-height: 2.25rem !important;
  }
  .text-5xl {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
  }
  .text-4xl {
    font-size: 1.25rem !important;
    line-height: 1.75rem !important;
  }
  .text-3xl {
    font-size: 1.125rem !important;
    line-height: 1.625rem !important;
  }
  .text-2xl {
    font-size: 1rem !important;
    line-height: 1.5rem !important;
  }
  .text-xl {
    font-size: 0.9rem !important;
    line-height: 1.375rem !important;
  }
  .text-lg {
    font-size: 0.85rem !important;
    line-height: 1.25rem !important;
  }
  .text-sm {
    font-size: 0.75rem !important;
    line-height: 1.125rem !important;
  }
  .text-xs {
    font-size: 0.65rem !important;
    line-height: 0.9rem !important;
  }
  /* General text elements */
  p, span {
    font-size: 0.8rem !important;
    line-height: 1.25rem !important;
  }
  /* Button text */
  button {
    font-size: 0.8rem !important;
    padding: 0.5rem 0.75rem !important;
  }
  /* Navigation text */
  nav a {
    font-size: 0.85rem !important;
  }
  /* Form inputs */
  input, textarea {
    font-size: 0.875rem !important;
    padding: 0.5rem !important;
  }
}

/* Additional mobile size adjustments for all screens <= 640px */
@media (max-width: 640px) {
  /* Reduce padding and margins */
  .py-12 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
  .py-8 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  .py-6 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  .py-4 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
  .px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .px-6 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  .px-4 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  .mb-8 {
    margin-bottom: 1rem !important;
  }
  .mb-6 {
    margin-bottom: 0.75rem !important;
  }
  .mb-4 {
    margin-bottom: 0.5rem !important;
  }
  .mt-8 {
    margin-top: 1rem !important;
  }
  .mt-6 {
    margin-top: 0.75rem !important;
  }
  .mt-4 {
    margin-top: 0.5rem !important;
  }
  .gap-8 {
    gap: 1rem !important;
  }
  .gap-6 {
    gap: 0.75rem !important;
  }
  .gap-4 {
    gap: 0.5rem !important;
  }
  .gap-16 {
    gap: 1.5rem !important;
  }
  .gap-12 {
    gap: 1rem !important;
  }
  
  /* Reduce text sizes more aggressively */
  h1 {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
  }
  h2 {
    font-size: 1.25rem !important;
    line-height: 1.75rem !important;
  }
  h3 {
    font-size: 1.125rem !important;
    line-height: 1.5rem !important;
  }
  h4 {
    font-size: 1rem !important;
    line-height: 1.375rem !important;
  }
  h5 {
    font-size: 0.9rem !important;
    line-height: 1.25rem !important;
  }
  h6 {
    font-size: 0.85rem !important;
    line-height: 1.125rem !important;
  }
  
  /* Reduce container sizes */
  .max-w-7xl {
    max-width: 100% !important;
  }
  .max-w-6xl {
    max-width: 100% !important;
  }
  .max-w-5xl {
    max-width: 100% !important;
  }
  .max-w-4xl {
    max-width: 100% !important;
  }
  .max-w-3xl {
    max-width: 100% !important;
  }
  .max-w-2xl {
    max-width: 100% !important;
  }
  .max-w-xl {
    max-width: 100% !important;
  }
  .max-w-lg {
    max-width: 100% !important;
  }
  .max-w-md {
    max-width: 100% !important;
  }
  .max-w-sm {
    max-width: 100% !important;
  }
  .max-w-xs {
    max-width: 100% !important;
  }
  
  /* Reduce image sizes */
  img.w-64 {
    width: 8rem !important;
    height: 8rem !important;
  }
  img.w-48 {
    width: 6rem !important;
    height: 6rem !important;
  }
  img.w-32 {
    width: 4rem !important;
    height: 4rem !important;
  }
  img.w-24 {
    width: 3rem !important;
    height: 3rem !important;
  }
  img.w-20 {
    width: 2.5rem !important;
    height: 2.5rem !important;
  }
  img.w-16 {
    width: 2rem !important;
    height: 2rem !important;
  }
  
  /* Reduce button sizes */
  .px-10 {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
  .px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .px-6 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  .px-5 {
    padding-left: 0.625rem !important;
    padding-right: 0.625rem !important;
  }
  .py-4 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
  .py-3 {
    padding-top: 0.375rem !important;
    padding-bottom: 0.375rem !important;
  }
  .py-2 {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
  }
  
  /* Reduce section spacing */
  section {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  
  /* Reduce grid gaps */
  .grid {
    gap: 0.75rem !important;
  }
  
  /* Reduce flex gaps */
  .flex {
    gap: 0.5rem !important;
  }
  
  /* Make card padding smaller */
  .p-6 {
    padding: 0.75rem !important;
  }
  .p-4 {
    padding: 0.5rem !important;
  }
  .p-3 {
    padding: 0.375rem !important;
  }
  .p-2 {
    padding: 0.25rem !important;
  }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 375px) {
  /* Even more aggressive reductions */
  .text-8xl {
    font-size: 1.75rem !important;
    line-height: 2.25rem !important;
  }
  .text-6xl {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
  }
  .text-4xl {
    font-size: 1.125rem !important;
    line-height: 1.5rem !important;
  }
  .text-3xl {
    font-size: 1rem !important;
    line-height: 1.375rem !important;
  }
  .text-2xl {
    font-size: 0.9rem !important;
    line-height: 1.25rem !important;
  }
  .text-xl {
    font-size: 0.8rem !important;
    line-height: 1.125rem !important;
  }
  .text-lg {
    font-size: 0.75rem !important;
    line-height: 1rem !important;
  }
  
  /* Very small padding */
  .py-12 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  .py-8 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  .px-6 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  .px-4 {
    padding-left: 0.375rem !important;
    padding-right: 0.375rem !important;
  }
  
  /* Smaller margins */
  .mb-8 {
    margin-bottom: 0.75rem !important;
  }
  .mb-6 {
    margin-bottom: 0.5rem !important;
  }
  .mb-4 {
    margin-bottom: 0.375rem !important;
  }
  .mt-8 {
    margin-top: 0.75rem !important;
  }
  .mt-6 {
    margin-top: 0.5rem !important;
  }
  .mt-4 {
    margin-top: 0.375rem !important;
  }
  
  /* Smaller buttons */
  button {
    font-size: 0.75rem !important;
    padding: 0.375rem 0.5rem !important;
  }
  
  /* Smaller images */
  img.w-64 {
    width: 6rem !important;
    height: 6rem !important;
  }
  img.w-48 {
    width: 4rem !important;
    height: 4rem !important;
  }
  img.w-32 {
    width: 3rem !important;
    height: 3rem !important;
  }
  img.w-24 {
    width: 2rem !important;
    height: 2rem !important;
  }
  img.w-20 {
    width: 1.5rem !important;
    height: 1.5rem !important;
  }
  img.w-16 {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }
}

