/* Mobile-specific spacing fixes scoped to footer */
@media (max-width: 768px) {
  /* Reduce Bootstrap utility spacing applied on footer */
  footer.bg-light.mt-5.pt-5.pb-3.border-top {
    margin-top: 8px !important;
    padding-top: 16px !important;
    padding-bottom: 12px !important;
  }

  /* Ensure container is full-width with tight side padding */
  footer .container-80 {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 10px !important;
  }

  /* Reduce gutters and eliminate row side offsets */
  footer .row {
    --bs-gutter-x: 0.75rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  footer [class*="col-"] {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* Trim section headings and lists */
  footer h6 {
    margin-top: 18px !important;
    margin-bottom: 14px !important;
  }
  .footer-links {
    margin-bottom: 12px !important;
  }

  /* Subscribe block spacing */
  .footer-subscribe .form-control {
    padding: 10px 16px !important;
    margin-bottom: 12px !important;
    min-height: 48px;
  }
  .footer-subscribe .btn {
    width: 100%;
    min-height: 44px;
    padding: 10px 16px !important;
  }
  .footer-subscribe .input-group {
    flex-direction: column;
    gap: 12px;
  }

  /* Footer copyright section */
  .footer-copyright {
    margin-top: 18px !important;
    padding: 14px 10px !important;
    font-size: 0.9rem;
  }
}

/* Mobile header-specific fixes */
@media (max-width: 768px) {
  /* Ensure the rounded corners are visible on both sides by clipping children */
  .navbar {
    /* Allow dropdowns to escape and increase rounding */
    overflow: visible !important;
    border-radius: 24px !important; /* even more rounded corners */
    /* Force actual floating width so right rounded corner is visible even if a global rule sets width:100% */
    width: calc(100% - 8px) !important; /* wider floating header */
    margin: 0 4px !important; /* smaller symmetric margins to accentuate rounding */
    z-index: 5000 !important; /* ensure header stack is above content */
  }

  /* Remove inner side paddings inside navbar's container only on mobile */
  .navbar .container-80 {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Tighten left/right menu button areas */
  .mobile-menu-container {
    padding: 0 !important;
    margin: 0 -25px !important; /* 2x the previous adjustment for maximum edge positioning */
    grid-template-columns: 30px 1fr 30px !important; /* even narrower side columns for maximum edge positioning */
    z-index: 3065 !important; /* above navbar background */
    width: calc(100% + 50px) !important; /* compensate for negative margin */
    position: relative !important;
  }
  .mobile-menu-left {
    width: 30px !important;
    gap: 0 !important; /* no inner gap */
    padding-left: 0 !important; /* no padding - at edge */
    position: relative !important; /* create stacking context */
    z-index: 3060 !important; /* above center and navbar background */
  }
  .mobile-menu-right {
    gap: 0 !important; /* no inner gap */
    right: 0 !important; /* ensure pinned to the edge of container */
    padding-right: 0 !important; /* no padding - at edge */
    z-index: 3060 !important;
  }

  /* Icon buttons positioned at edges */
  .mobile-profile-btn,
  .mobile-hamburger-btn {
    width: 48px !important;  /* original size */
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    margin: 0 !important; /* baseline */
    padding: 0 !important; /* no padding */
    position: relative !important;
    z-index: 3070 !important; /* ensure above header background/center */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Remove previous margin-based insets */
  .mobile-hamburger-btn { margin-left: 0 !important; }
  .mobile-profile-btn { margin-right: 0 !important; }

  /* Keep centered logo within tighter side columns */
  .mobile-menu-center {
    max-width: calc(100% - 60px) !important; /* 30px + 30px */
  }

  /* Ensure dropdown overlays above page content */
  .mobile-profile-dropdown { z-index: 9999 !important; }

  /* Ensure left off-canvas menu overlays header and page */
  .mobile-nav-menu { z-index: 10000 !important; }
  .mobile-menu-overlay { z-index: 9000 !important; }
}
