/* ==========================================================================
   ESTATE MANTRAA - MASTER RESPONSIVE STYLESHEET
   Comprehensive Layout Adaptation across Mobile, Tablet, Laptop & Desktop screens
   ========================================================================== */

/* Universal Box-Sizing & Overflow Safety */
*, *::before, *::after {
  box-sizing: border-box;
}

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

/* ==========================================================================
   1. TABLETS & SMALL LAPTOPS (max-width: 1199px)
   ========================================================================== */
@media (max-width: 1199px) {
  .navbar-container {
    height: 70px;
  }

  .brand-logo {
    width: auto;
    height: 54px;
    min-width: auto;
  }

  .brand-logo-img {
    width: auto;
    height: 50px;
    max-height: 50px;
    max-width: 165px;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  /* Hamburger Navigation for all screens under 1200px (Tablets & Mobile) */
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    color: var(--brand-navy);
    border: 1px solid var(--border-light);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .mobile-toggle:hover {
    background: #ffffff;
    color: var(--brand-cyan-dark);
    box-shadow: var(--shadow-sm);
  }

  /* Slide-out Navigation Drawer */
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 340px;
    max-width: 85vw;
    height: 100vh;
    background: #ffffff;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 20px 40px;
    box-shadow: -10px 0 35px rgba(7, 21, 47, 0.25);
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10500;
    overflow-y: auto;
    gap: 6px;
  }

  .nav-menu.active {
    right: 0;
  }

  .mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
  }

  .mobile-nav-logo {
    width: auto;
    height: 62px;
    max-height: 62px;
    max-width: 160px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    padding: 0;
    display: block;
    box-shadow: none;
  }

  .nav-menu-close {
    font-size: 1.2rem;
    color: var(--brand-navy);
    cursor: pointer;
    border: none;
    background: var(--bg-subtle);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
  }

  .nav-menu-close:hover {
    background: #fee2e2;
    color: #dc2626;
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--brand-navy);
    border-radius: var(--radius-md);
    background: transparent;
    transition: all var(--transition-fast);
  }

  .nav-link:hover, .nav-item.active > .nav-link {
    background: var(--bg-subtle);
    color: var(--brand-cyan-dark);
  }

  .nav-link i.fa-chevron-down {
    font-size: 0.8rem;
    transition: transform var(--transition-fast);
  }

  /* Accordion Dropdowns on Mobile/Tablet */
  .dropdown-menu {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
    padding: 8px 10px !important;
    background: #f8fafc !important;
    border-radius: var(--radius-md) !important;
    margin-top: 4px !important;
    margin-bottom: 8px !important;
    display: none !important;
    pointer-events: auto !important;
  }

  .nav-item.dropdown-open > .dropdown-menu {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }

  .nav-item.dropdown-open > .nav-link i.fa-chevron-down {
    transform: rotate(180deg);
    color: var(--brand-cyan-dark);
  }

  .dropdown-menu.mega-menu-buy {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    padding: 0 !important;
  }

  .mega-menu-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 12px !important;
    background: #f8fafc !important;
  }

  .mega-menu-header {
    padding: 12px 14px !important;
    background: #f1f5f9 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  .mega-menu-tag {
    font-size: 0.88rem !important;
    white-space: nowrap !important;
  }

  .mega-menu-view-all {
    font-size: 0.82rem !important;
    white-space: nowrap !important;
  }

  /* Tablet Grids */
  .properties-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

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

  .why-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .stat-item:nth-child(2)::after {
    display: none;
  }

  .search-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .search-form-grid .btn {
    grid-column: span 2;
    height: 48px;
  }

  .filter-layout {
    grid-template-columns: 1fr;
  }

  .filter-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    z-index: 10400;
    overflow-y: auto;
    background: #ffffff;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-2xl);
    padding: 24px;
  }

  .filter-sidebar.active {
    left: 0;
  }

  .property-detail-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .contact-agent-sidebar {
    position: static;
  }
}

/* ==========================================================================
   2. TABLET PORTRAIT & MEDIUM SCREENS (max-width: 992px)
   ========================================================================== */
@media (max-width: 992px) {
  .hero-section {
    padding: 40px 0 60px;
  }

  .hero-title {
    font-size: clamp(2rem, 4.5vw, 3rem);
  }

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

  .detail-gallery-grid {
    grid-template-columns: 1fr;
    height: auto;
    gap: 12px;
  }

  .gallery-main {
    height: 360px;
  }

  .gallery-sub-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr;
    height: 90px;
    gap: 10px;
  }

  .detail-specs-bar {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .detail-header-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .emi-calc-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .nri-banner-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .cta-banner-box {
    padding: 38px 28px;
  }

  /* About Page Tablet */
  .about-hero-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  /* Contact Page Tablet */
  .contact-main-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .contact-form-card {
    padding: 32px 24px;
  }

  /* Social Media Feed Tablet */
  #socialMediaSection .social-feed-grid,
  .social-feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 20px !important;
  }
  
  #socialMediaSection .social-feed-grid > .social-post-card:last-child,
  .social-feed-grid > .social-post-card:last-child {
    grid-column: 1 / -1 !important;
    max-width: 600px !important;
    margin: 0 auto !important;
    width: 100% !important;
  }

  #socialMediaSection,
  .section-social-media {
    padding: 60px 0 68px !important;
  }
}

/* ==========================================================================
   3. MOBILE DEVICES (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .section {
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .section-subtitle {
    font-size: 0.95rem;
    margin-bottom: 32px;
  }

  .top-bar {
    display: none;
  }

  .navbar-container {
    height: 66px;
    padding: 0 16px;
  }

  .brand-logo {
    width: auto;
    height: 50px;
    min-width: auto;
  }

  .brand-logo-img {
    width: auto;
    height: 46px;
    max-height: 46px;
    max-width: 150px;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .mobile-nav-logo {
    width: auto;
    height: 48px;
    max-height: 48px;
    max-width: 150px;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
  }

  .footer-logo {
    width: 96px;
    height: 96px;
    max-height: 96px;
    max-width: 96px;
    margin-bottom: 14px;
  }

  .navbar-actions {
    gap: 10px;
  }

  .nav-action-btn {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }

  /* About Page Mobile Layout: Stack Mission & Vision vertically */
  .about-hero-grid {
    grid-template-columns: 1fr;
    gap: 30px;
    width: 100%;
  }

  .mission-vision-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
  }

  .mission-card,
  .vision-card {
    width: 100% !important;
    padding: 20px 18px;
    box-sizing: border-box;
  }

  /* Contact Page Mobile Layout: Stack all major sections & 2-col form inputs */
  .contact-main-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    width: 100% !important;
  }

  .contact-form-card {
    padding: 26px 20px;
    width: 100%;
  }

  .contact-form-row {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
  }

  .contact-assistance-card {
    padding: 26px 20px;
    margin-bottom: 24px;
    width: 100%;
  }

  .contact-office-card {
    padding: 16px 16px;
    width: 100%;
  }

  /* Brand Video Container Mobile Safety */
  .brand-video-card {
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
  }

  .brand-video-fallback {
    padding: 24px 16px;
  }

  .video-play-trigger-btn {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
    margin-bottom: 14px;
  }

  .video-fallback-title {
    font-size: 1.15rem;
  }

  .video-fallback-desc {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  /* Hero Section */
  .hero-section {
    min-height: auto;
    padding: 30px 0 50px;
  }

  .hero-search-panel {
    padding: 16px 14px;
    border-radius: var(--radius-lg);
  }

  .search-tabs {
    overflow-x: auto;
    padding-bottom: 8px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }

  .tab-btn {
    padding: 8px 16px;
    font-size: 0.88rem;
  }

  .search-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .search-form-grid .btn {
    grid-column: span 1;
  }

  /* Properties Grid & Card Layout on Mobile */
  .properties-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .property-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .property-img-wrapper {
    height: 220px;
    width: 100%;
    position: relative;
    overflow: hidden;
  }

  .property-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .property-card-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }

  .property-price-wrap {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
  }

  .property-price {
    font-size: 1.3rem;
  }

  .property-card-title {
    font-size: 1.08rem;
    line-height: 1.35;
    margin-bottom: 6px;
  }

  .property-location {
    font-size: 0.85rem;
    margin-bottom: 12px;
  }

  .property-specs-grid {
    grid-template-columns: repeat(3, 1fr);
    font-size: 0.8rem;
    gap: 6px;
    padding: 10px 0;
    margin-bottom: 12px;
  }

  .spec-item {
    gap: 5px;
    min-width: 0;
  }

  .spec-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .spec-item i {
    font-size: 0.85rem;
    flex-shrink: 0;
  }

  .property-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
  }

  /* Property Detail Page Mobile Styling */
  .detail-gallery-grid {
    grid-template-columns: 1fr;
    height: auto;
    gap: 10px;
  }

  .gallery-main {
    height: 260px;
  }

  .gallery-sub-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr;
    height: 75px;
    gap: 8px;
  }

  .detail-specs-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .spec-highlight-card {
    padding: 12px 14px;
    gap: 10px;
  }

  .spec-highlight-card .spec-icon-box {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .detail-section-card {
    padding: 20px 18px;
  }

  .specs-table th, .specs-table td {
    padding: 10px 6px;
    font-size: 0.88rem;
  }

  /* Categories & Why Choose Us */
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .category-card {
    height: 170px;
  }

  .why-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 24px 16px;
  }

  .stat-number {
    font-size: 1.85rem;
  }

  .stat-label {
    font-size: 0.82rem;
  }

  .amenities-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Lightbox Mobile Adjustments */
  .lightbox-close-btn, #lightboxClose {
    top: 16px !important;
    right: 16px !important;
    width: 40px !important;
    height: 40px !important;
  }

  .lightbox-nav-btn.prev, #lightboxPrev {
    left: 12px !important;
    width: 42px !important;
    height: 42px !important;
  }

  .lightbox-nav-btn.next, #lightboxNext {
    right: 12px !important;
    width: 42px !important;
    height: 42px !important;
  }

  /* Modals */
  .modal-dialog {
    max-width: calc(100vw - 24px);
    margin: 0 auto;
    padding: 0;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .modal-header {
    padding: 16px 18px 12px;
  }

  .modal-header h3 {
    font-size: 1.15rem;
  }

  .modal-body {
    padding: 16px 18px 20px;
    max-height: calc(90vh - 65px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .new-project-popup {
    bottom: 85px;
    right: 16px;
    left: auto;
    max-width: min(320px, calc(100vw - 32px));
  }

  /* Lower Sections Responsive Fixes */
  .calculator-card {
    padding: 24px 18px !important;
  }

  .emi-calc-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .calc-result-box {
    margin-top: 8px;
    padding: 22px 18px !important;
  }

  .nri-banner-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .nri-banner-grid img {
    height: 240px !important;
    object-fit: cover !important;
  }

  .cta-banner-box {
    padding: 32px 20px;
    text-align: center;
    flex-direction: column;
    align-items: stretch;
  }

  .cta-banner-box .btn {
    width: 100%;
  }

  /* Preloader Mobile Adjustments */
  .preloader-logo {
    width: min(190px, 54vw);
    max-width: 210px;
  }

  /* WhatsApp & AI Buttons on Mobile */
  .whatsapp-floating-btn {
    bottom: 20px;
    right: 20px;
    width: 52px;
    height: 52px;
    font-size: 1.55rem;
  }

  .whatsapp-tooltip {
    display: none !important;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .footer-bottom-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  /* Social Media Feed Mobile */
  #socialMediaSection .social-feed-grid,
  .social-feed-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  #socialMediaSection .social-feed-grid > .social-post-card:last-child,
  .social-feed-grid > .social-post-card:last-child {
    grid-column: auto !important;
    max-width: 100% !important;
  }

  #socialMediaSection .social-post-card,
  .social-post-card {
    padding: 20px 16px !important;
  }

  #socialMediaSection .secondary-socials-row,
  .secondary-socials-row {
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
  }

  #socialMediaSection .secondary-social-btn,
  .secondary-social-btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px 16px !important;
  }
}

/* ==========================================================================
   4. SMALL MOBILE SCREENS (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .navbar-container {
    height: 62px;
    padding: 0 12px;
  }

  .brand-logo {
    width: auto;
    height: 44px;
    min-width: auto;
  }

  .brand-logo-img {
    width: auto;
    height: 40px;
    max-height: 40px;
    max-width: 130px;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .mobile-nav-logo {
    width: auto;
    height: 42px;
    max-height: 42px;
    max-width: 130px;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
  }

  .footer-logo {
    width: 88px;
    height: 88px;
    max-height: 88px;
    max-width: 88px;
    margin-bottom: 12px;
  }

  .navbar-actions .btn-primary.btn-sm {
    padding: 7px 10px;
    font-size: 0.8rem;
  }

  .navbar-actions .btn-primary.btn-sm span {
    display: none;
  }

  .nav-action-btn {
    width: 38px;
    height: 38px;
    font-size: 0.88rem;
  }

  /* About Page Mobile */
  .mission-vision-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
  }

  .mission-card,
  .vision-card {
    padding: 18px 16px;
    width: 100% !important;
  }

  .mission-card h4,
  .vision-card h4 {
    font-size: 1.02rem;
  }

  .mission-card p,
  .vision-card p {
    font-size: 0.85rem;
    line-height: 1.55;
  }

  /* Contact Page Mobile */
  .contact-form-card {
    padding: 22px 16px;
    border-radius: var(--radius-lg);
  }

  .contact-assistance-card {
    padding: 22px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
  }

  .contact-office-card {
    padding: 14px 14px;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .category-card {
    height: 150px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .stat-item:not(:last-child)::after {
    display: none;
  }

  .property-card-actions {
    flex-direction: column;
    gap: 8px;
  }

  .property-card-actions .btn {
    width: 100%;
  }

  .amenities-grid {
    grid-template-columns: 1fr;
  }

  .filter-results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .detail-specs-bar {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   5. ULTRA-COMPACT MOBILE SCREENS (max-width: 360px)
   ========================================================================== */
@media (max-width: 360px) {
  .navbar-container {
    height: 58px;
    padding: 0 8px;
  }

  .brand-logo {
    width: auto;
    height: 40px;
    min-width: auto;
  }

  .brand-logo-img {
    width: auto;
    height: 36px;
    max-height: 36px;
    max-width: 115px;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .mobile-nav-logo {
    width: auto;
    height: 38px;
    max-height: 38px;
    max-width: 115px;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
  }

  /* About Page Ultra-Compact */
  .mission-card,
  .vision-card {
    padding: 16px 14px;
  }

  /* Contact Page Ultra-Compact */
  .contact-form-card {
    padding: 18px 12px;
  }

  .contact-assistance-card {
    padding: 18px 12px;
  }

  .navbar-actions {
    gap: 6px;
  }

  .nav-action-btn {
    width: 34px;
    height: 34px;
    font-size: 0.82rem;
  }

  .mobile-toggle {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .hero-title {
    font-size: 1.6rem;
  }
}
