/* =========================================================
   RESPONSIVE BREAKPOINTS
   Desktop large: default (>1200px)
   Desktop:        1024px - 1200px
   Tablet:         768px - 1024px
   Mobile large:   576px - 768px
   Mobile small:   < 576px
   ========================================================= */

/* ---------- 1200px and below ---------- */
@media (max-width: 1200px) {
  .container {
    padding: 0 20px;
  }

  .hero-inner {
    grid-template-columns: 1.3fr 1fr;
    gap: 30px;
  }

  .why-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- 1024px and below (Tablet) ---------- */
@media (max-width: 1024px) {
  .main-nav {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .main-nav.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 16px 24px;
    box-shadow: var(--shadow-md);
    gap: 14px;
    border-top: 1px solid var(--border);
  }

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-side {
    max-width: 460px;
    margin: 40px auto 0;
  }

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

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

  .subsidy-side {
    order: -1;
  }

  .about-strip-inner {
    grid-template-columns: 1fr;
  }

  .about-strip-img {
    order: -1;
  }

  .final-cta-inner {
    grid-template-columns: 1fr;
  }

  .video-card {
    flex: 0 0 calc(33.333% - 15px);
  }

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

/* ---------- 768px and below (Mobile large / small tablet) ---------- */
@media (max-width: 768px) {
  .header-phone {
    display: none;
  }

  .header-inner {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .hero {
    padding: 36px 0 56px;
  }

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

  .hero-cta-row {
    flex-direction: column;
  }

  .hero-cta-row .btn {
    width: 100%;
  }

  .video-card {
    flex: 0 0 calc(50% - 11px);
  }

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

  .steps-row {
    justify-content: center;
    max-width: 100%;
  }

  .step-arrow {
    display: none;
  }

  .step-item {
    width: 130px;
    max-width: 100%;
  }

  .lead-form.grid-2 {
    grid-template-columns: 1fr;
  }

  .lead-form.grid-2 .span-2 {
    grid-column: span 1;
  }

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

  .testimonial-card {
    padding: 28px 22px;
  }

  .popup-card {
    max-width: 90%;
  }

  /* Video modal on tablet */
  .video-modal {
    padding: 16px;
  }

  .video-modal-inner video {
    max-height: 60vh;
  }

  .video-modal-close {
    top: -38px;
    font-size: 22px;
  }
}

/* ---------- 576px and below (Mobile) ---------- */
@media (max-width: 576px) {
  .container {
    padding: 0 16px;
  }

  .badge-iso {
    font-size: 11px;
    padding: 6px 12px;
  }

  .hero-content h1 {
    font-size: 26px;
  }

  .hero-desc {
    font-size: 14px;
  }

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

  .stat-card {
    padding: 14px 10px;
  }

  .stat-card h4 {
    font-size: 12.5px;
  }

  .stat-card p {
    font-size: 11px;
  }

  .subsidy-medal {
    width: 150px;
    height: 150px;
  }

  .medal-amount {
    font-size: 22px;
  }

  .video-card {
    flex: 0 0 calc(100% - 0px);
  }

  .video-carousel-wrap {
    gap: 8px;
  }

  .carousel-arrow {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

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

  .step-item {
    width: 100%;
    max-width: 220px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: left;
  }

  .final-cta-form-card {
    padding: 22px;
  }

  .whatsapp-float {
    width: 50px;
    height: 50px;
    font-size: 24px;
    bottom: 18px;
    right: 18px;
  }

  /* ==================================================
     SUBSIDY TABLES - MOBILE RESPONSIVE
     Each table gets its own horizontal scroll container
     so content is never cropped and a scrollbar appears.
     ================================================== */
  .subsidy-table-card {
    padding: 16px;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
  }

  .subsidy-table-card h3 {
    font-size: 16px;
    margin-bottom: 14px;
    line-height: 1.4;
  }

  /* Horizontal scroll wrapper for each table */
  .table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
  }

  /* Visible scrollbar styling */
  .table-scroll::-webkit-scrollbar {
    height: 6px;
  }

  .table-scroll::-webkit-scrollbar-thumb {
    background: #cfcfcf;
    border-radius: 20px;
  }

  /* Tables keep their natural width so they scroll instead of squishing */
  .table-scroll table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    max-width: none;
    white-space: nowrap;
  }

  /* "Example For Customers" (4 columns) */
  .subsidy-table-card table {
    min-width: 600px;
  }

  /* "Central Subsidy Structure" (2 columns) */
  .subsidy-table-card:first-child table {
    min-width: 420px;
  }

  .table-scroll th,
  .table-scroll td {
    padding: 12px 14px;
    font-size: 13px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
  }

  .max-tag {
    display: block;
    margin-top: 4px;
    font-size: 10px;
  }

  /* ---- Responsive popup (mobile) ---- */
  .popup-card {
    width: 94%;
    max-width: 96%;
  }

  .popup-banner {
    height: 96px;
  }

  .popup-banner-overlay {
    padding: 10px 16px;
  }

  .popup-banner-overlay span {
    font-size: 12px;
  }

  .popup-body {
    padding: 20px 18px 24px;
  }

  .popup-body h3 {
    font-size: 17px;
  }

  .popup-body p {
    font-size: 13px;
    margin-bottom: 14px;
  }

  .popup-icon-badge {
    width: 46px;
    height: 46px;
    font-size: 20px;
    margin-bottom: 12px;
  }

  .popup-countdown {
    gap: 8px;
    margin-bottom: 16px;
  }

  .popup-countdown strong {
    font-size: 17px;
  }

  .popup-countdown div {
    padding: 8px 4px;
  }

  .popup-actions .btn {
    font-size: 13px;
    padding: 12px 20px;
  }

  .popup-form-success i {
    font-size: 38px;
  }

  .popup-form-success p {
    font-size: 13px;
  }

  /* ---- Responsive video modal (mobile) ---- */
  .video-modal {
    padding: 12px;
  }

  .video-modal-close {
    top: -32px;
    font-size: 20px;
  }

  .video-modal-inner video {
    max-height: 50vh;
    border-radius: 8px;
  }

  .video-modal-caption {
    font-size: 13px;
    margin-top: 10px;
  }
}

/* ---------- 380px and below (Small mobile) ---------- */
@media (max-width: 380px) {
  .logo-tagline {
    display: none;
  }

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

  /* Video carousel: arrows are hidden, so keep the wrap in row layout.
     Using column direction here (with .video-carousel{flex:1} = flex-basis:0%)
     can collapse the carousel height and create a vertical gap on small screens. */
  .video-carousel {
    flex: 0 0 auto;
    width: 100%;
  }

  .video-carousel-wrap {
    flex-direction: row;
    align-items: stretch;
    gap: 0;
  }

  .carousel-arrow {
    display: none;
  }

  /* Compact subsidy tables on very small screens */
  .table-scroll table {
    min-width: 620px;
  }

  .subsidy-table-card:first-child table {
    min-width: 430px;
  }

  .table-scroll th,
  .table-scroll td {
    padding: 10px 12px;
    font-size: 12px;
  }

  /* ---- Responsive popup (small mobile) ---- */
  .popup-banner {
    height: 80px;
  }

  .popup-banner-overlay {
    padding: 8px 12px;
  }

  .popup-banner-overlay span {
    font-size: 11px;
  }

  .popup-body {
    padding: 16px 14px 20px;
  }

  .popup-body h3 {
    font-size: 16px;
  }

  .popup-body p {
    font-size: 12.5px;
  }

  .popup-icon-badge {
    width: 40px;
    height: 40px;
    font-size: 18px;
    margin-bottom: 10px;
  }

  .popup-countdown {
    gap: 6px;
  }

  .popup-countdown div {
    padding: 6px 2px;
  }

  .popup-countdown strong {
    font-size: 15px;
  }

  .popup-countdown span {
    font-size: 9px;
  }

  .popup-close {
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .popup-form-success i {
    font-size: 32px;
  }

  /* ---- Responsive video modal (small mobile) ---- */
  .video-modal {
    padding: 8px;
  }

  .video-modal-close {
    top: -28px;
    font-size: 18px;
    right: 4px;
  }

  .video-modal-inner video {
    max-height: 40vh;
  }
}

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

  html {
    scroll-behavior: auto;
  }
}

/* ---------- GLOBAL HORIZONTAL OVERFLOW GUARD ----------
   Prevents any wide flex/grid container (video track, steps row,
   hero, etc.) from extending the page beyond the viewport, which
   would otherwise show a blank gap on the right side of the page.
   Uses overflow-x:hidden (not clip) for maximum browser support. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.video-carousel-wrap,
.video-carousel,
.steps-row,
.hero-inner,
.hero,
.footer-grid {
  max-width: 100%;
  overflow-x: hidden;
}
