/* ==========================================================================
   RESPONSIVE BREAKPOINTS & MOBILE-FIRST MEDIA QUERIES
   ========================================================================== */

/* Universal Overflow Prevention */
html, body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

*, *::before, *::after {
  max-width: 100%;
}

.mobile-only-drawer-actions {
  display: none !important;
}

/* Ensure CSS Grid items shrink properly without pushing viewport width */
.hero-wrapper > *,
.calculator-card > *,
.grid-2 > *,
.grid-3 > *,
.grid-4 > *,
.service-card,
.step-card,
.testimonial-card,
.usp-card,
.counter-card {
  min-width: 0 !important;
}

/* 1. Large Laptops & Desktops (max-width: 1200px) */
@media screen and (max-width: 1200px) {
  .nav-container {
    padding: 0 var(--space-md) !important;
  }
  
  .hero-title {
    font-size: 2.85rem !important;
  }

  .footer-grid {
    grid-template-columns: 1.2fr 1fr 1fr 1.1fr !important;
    gap: 2rem !important;
  }
}

/* 2. Tablets & Small Laptops (max-width: 992px) */
@media screen and (max-width: 992px) {
  .section-padding {
    padding: 3.5rem 0 !important;
  }

  .section-title {
    font-size: 2rem !important;
  }

  .hero-wrapper {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
    text-align: center !important;
  }

  .hero-badge-group {
    justify-content: center !important;
  }

  .hero-cta-group {
    justify-content: center !important;
  }

  .hero-features-list {
    max-width: 500px !important;
    margin: 0 auto !important;
    text-align: left !important;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .calculator-card {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    padding: 1.75rem !important;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2.5rem !important;
  }
}

/* 3. Mobile Devices & Small Tablets (max-width: 768px) */
@media screen and (max-width: 768px) {
  html {
    font-size: 15px !important;
  }

  .container {
    padding: 0 1rem !important;
    width: 100% !important;
  }

  .mobile-only-drawer-actions {
    display: flex !important;
  }

  /* Header Mobile Optimization - FIX OVERFLOW */
  .navbar {
    padding: 0.6rem 0 !important;
  }

  .nav-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .logo-svg {
    height: 38px !important;
    width: auto !important;
    max-width: 200px !important;
  }

  /* Hide desktop header buttons on mobile so header NEVER overflows */
  .nav-actions .btn-gold-outline,
  .nav-actions .btn-primary {
    display: none !important;
  }

  .nav-actions {
    gap: 0 !important;
  }

  .mobile-menu-btn {
    display: flex !important;
    padding: 0.5rem;
  }

  /* Mobile Slide-Down Navigation Drawer */
  .nav-menu {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 56px) !important;
    background: #081226 !important;
    border-bottom: 2px solid #DFAC42 !important;
    flex-direction: column !important;
    padding: 1.5rem !important;
    gap: 1.25rem !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8) !important;
    display: none !important;
    z-index: 9999 !important;
    overflow-y: auto !important;
  }

  .nav-menu.active {
    display: flex !important;
  }

  .nav-link {
    font-size: 1.15rem !important;
    width: 100% !important;
    text-align: center !important;
    padding: 0.75rem 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  .mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px) !important;
  }

  .mobile-menu-btn.active span:nth-child(2) {
    opacity: 0 !important;
  }

  .mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px) !important;
  }

  /* Hero Adjustments */
  .hero-section {
    padding: 2.5rem 0 3.5rem 0 !important;
  }

  .hero-title {
    font-size: 1.95rem !important;
    line-height: 1.25 !important;
    letter-spacing: normal !important;
  }

  .hero-subtitle {
    font-size: 1rem !important;
    line-height: 1.55 !important;
  }

  .hero-cta-group {
    flex-direction: column !important;
    width: 100% !important;
  }

  .hero-cta-group .btn {
    width: 100% !important;
  }

  .hero-features-list {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  .hero-visual-card {
    border-width: 2px !important;
  }

  .floating-savings-pill {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    margin-top: 1rem !important;
    width: 100% !important;
    justify-content: center !important;
  }

  /* Grids & Cards */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* Subsidy Table Mobile Scroll */
  .subsidy-table-wrapper {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .subsidy-table {
    min-width: 580px !important;
  }

  /* Stats Grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
  }

  /* Floating Bottom Call/WhatsApp Bar */
  .floating-bottom-bar {
    display: flex !important;
  }

  body {
    padding-bottom: 74px !important;
  }

  /* Footer Mobile Layout */
  footer.slick-footer {
    padding: 3rem 0 2rem 0 !important;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    text-align: center !important;
  }

  .footer-motto {
    font-size: 0.7rem !important;
  }

  .footer-badges-row {
    justify-content: center !important;
  }

  .footer-heading::after {
    left: 50% !important;
    transform: translateX(-50%) !important;
  }

  .footer-bottom-bar {
    flex-direction: column !important;
    text-align: center !important;
    gap: 0.85rem !important;
  }

  .footer-legal-links {
    justify-content: center !important;
  }
}

/* 4. Small Mobile & Foldables (max-width: 480px) */
@media screen and (max-width: 480px) {
  html {
    font-size: 14px !important;
  }

  .logo-svg {
    height: 34px !important;
    max-width: 170px !important;
  }

  .section-title {
    font-size: 1.5rem !important;
  }

  .hero-title {
    font-size: 1.75rem !important;
  }

  .calc-result-box {
    padding: 1.25rem !important;
  }

  .result-stat-val {
    font-size: 1.2rem !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .modal-container {
    padding: 1.35rem 1rem !important;
    width: 95% !important;
  }

  .rating-badge {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.65rem !important;
  }
}
