/*
Theme Name: MediGlobe Healthcare
Theme URI: https://mediglobehealthcare.com/
Author: MediGlobe Healthcare Team
Author URI: https://mediglobehealthcare.com/
Description: A premium, modern, fast, responsive WordPress & WooCommerce theme engineered for MediGlobe Healthcare LLP. Features high-converting product showcases, single product templates, customizer settings, and WhatsApp integration.
Version: 1.0.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: mediglobe-healthcare
*/

:root {
  --mg-primary: #0d5c3a;
  --mg-primary-dark: #083c26;
  --mg-primary-light: #167a4e;
  --mg-accent: #d4a359;
  --mg-accent-hover: #b88842;
  --mg-bg-light: #f8faf9;
  --mg-bg-mint: #f0f7f4;
  --mg-card-bg: #ffffff;
  --mg-text-main: #1e293b;
  --mg-text-muted: #64748b;
  --mg-border: #e2e8f0;
  --mg-shadow: 0 10px 25px -5px rgba(13, 92, 58, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --mg-shadow-lg: 0 20px 35px -10px rgba(13, 92, 58, 0.15), 0 10px 15px -5px rgba(0, 0, 0, 0.08);
  --mg-radius: 12px;
  --mg-radius-sm: 8px;
  --mg-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--mg-text-main);
  background-color: var(--mg-bg-light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--mg-primary);
  text-decoration: none;
  transition: var(--mg-transition);
}

a:hover {
  color: var(--mg-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   HEADER & NAVBAR STRICT FIX
   ========================================================================== */

.mg-topbar {
  background-color: #083c26 !important;
  color: #ffffff !important;
  font-size: 0.88rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 500;
}

.mg-topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mg-topbar-left, .mg-topbar-right {
  display: flex;
  gap: 1.8rem;
  align-items: center;
}

.mg-phone-badge, .mg-tagline-badge, .mg-topbar-link {
  color: #ffffff !important;
  font-weight: 600;
}

.mg-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #ffffff !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  width: 100%;
}

.mg-header-inner {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 0.75rem 1.5rem !important;
  gap: 2rem !important;
  max-width: 1280px;
  margin: 0 auto;
}

/* LOGO STRICT SIZE FIX */
.mg-logo, a.custom-logo-link {
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  max-width: 220px !important;
  height: 52px !important;
}

.mg-logo-img, .mg-logo img, a.custom-logo-link img, img.custom-logo {
  height: 52px !important;
  max-height: 52px !important;
  width: auto !important;
  max-width: 220px !important;
  object-fit: contain !important;
  display: block !important;
}

/* NAV LINKS */
.mg-nav {
  display: flex !important;
  align-items: center !important;
  flex-grow: 1 !important;
  justify-content: center !important;
}

.mg-nav-list, ul.mg-nav-list, .mg-nav ul {
  display: flex !important;
  list-style: none !important;
  gap: 2.2rem !important;
  margin: 0 !important;
  padding: 0 !important;
  align-items: center !important;
}

.mg-nav-list li, .mg-nav ul li {
  margin: 0 !important;
  padding: 0 !important;
}

.mg-nav-list a, .mg-nav ul li a {
  font-weight: 600 !important;
  color: #1e293b !important;
  font-size: 1.02rem !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  transition: all 0.25s ease !important;
}

.mg-nav-list a:hover, .mg-nav ul li a:hover {
  color: #0d5c3a !important;
}

.mg-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 1.2rem !important;
  flex-shrink: 0 !important;
}

.mg-search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.mg-search-input {
  padding: 0.5rem 2.2rem 0.5rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  width: 190px;
}

.mg-search-input:focus {
  border-color: #0d5c3a;
  width: 230px;
}

.mg-search-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
}

@media (max-width: 1024px) {
  .mg-nav-list { gap: 1.2rem !important; }
  .mg-search-input { width: 140px; }
}

@media (max-width: 850px) {
  .mg-nav, .mg-search-form { display: none !important; }
  .mg-mobile-toggle { display: flex !important; }
}

/* ==========================================================================
   GLOBAL HEADER FIX FOR ALL PAGES (HOMEPAGE, SINGLE PRODUCTS, SHOP ARCHIVES)
   ========================================================================== */

header, .mg-header, #mg-site-header, .site-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 10000 !important;
  background-color: #ffffff !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06) !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

header .container, .mg-header-inner, .mg-header .container, header .mg-header-inner {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 0.75rem 1.5rem !important;
  gap: 2rem !important;
  max-width: 1280px !important;
  margin: 0 auto !important;
  width: 100% !important;
}

.mg-logo, a.custom-logo-link, header a.logo, header .logo, header .mg-logo {
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  max-width: 220px !important;
  height: 52px !important;
  max-height: 52px !important;
  margin: 0 !important;
}

.mg-logo-img, .mg-logo img, a.custom-logo-link img, img.custom-logo, header img, .mg-header img, header .logo img {
  height: 52px !important;
  max-height: 52px !important;
  width: auto !important;
  max-width: 220px !important;
  object-fit: contain !important;
  display: block !important;
}

.mg-nav, header nav, .mg-header nav {
  display: flex !important;
  align-items: center !important;
  flex-grow: 1 !important;
  justify-content: center !important;
}

.mg-nav-list, ul.mg-nav-list, .mg-nav ul, header nav ul {
  display: flex !important;
  list-style: none !important;
  gap: 2.2rem !important;
  margin: 0 !important;
  padding: 0 !important;
  align-items: center !important;
}

.mg-nav-list li, header nav ul li {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.mg-nav-list a, header nav ul li a {
  font-weight: 600 !important;
  color: #1e293b !important;
  font-size: 1.02rem !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  transition: all 0.25s ease !important;
}

.mg-nav-list a:hover, header nav ul li a:hover {
  color: #0d5c3a !important;
}

.mg-header-actions, header .mg-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 1.2rem !important;
  flex-shrink: 0 !important;
}

@media (max-width: 1024px) {
  .mg-nav-list, header nav ul { gap: 1.2rem !important; }
}

@media (max-width: 850px) {
  .mg-nav, header nav { display: none !important; }
  .mg-mobile-toggle { display: flex !important; }
}

/* ==========================================================================
   ULTRA MOBILE RESPONSIVE DESIGN SYSTEM (320px - 768px Mobile Perfection)
   ========================================================================== */

/* Universal Viewport Boundary Guard */
html, body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

.container, .mg-header-inner, .mg-topbar-inner, .mg-footer-grid {
  box-sizing: border-box !important;
  max-width: 100% !important;
}

/* Mobile Header & Topbar */
@media (max-width: 768px) {
  .mg-topbar {
    padding: 0.4rem 0 !important;
    font-size: 0.8rem !important;
  }

  .mg-topbar-left {
    gap: 0.5rem !important;
  }

  .mg-tagline-badge, .mg-topbar-right .mg-topbar-link:not(:first-child) {
    display: none !important;
  }

  .mg-header-inner {
    padding: 0.5rem 1rem !important;
    gap: 0.8rem !important;
  }

  .mg-logo, a.custom-logo-link, header a.logo {
    max-width: 150px !important;
    height: 40px !important;
    max-height: 40px !important;
  }

  .mg-logo-img, .mg-logo img, a.custom-logo-link img, img.custom-logo, header img {
    height: 40px !important;
    max-height: 40px !important;
    max-width: 150px !important;
  }

  /* Hide Desktop Nav & Search on Mobile */
  .mg-nav, header nav, .mg-search-form {
    display: none !important;
  }

  /* Show Hamburger & Shop Now on Mobile */
  .mg-mobile-toggle {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 4px !important;
    background: transparent !important;
    border: none !important;
    padding: 8px !important;
    cursor: pointer !important;
    z-index: 10001 !important;
  }

  .mg-mobile-toggle span {
    width: 22px !important;
    height: 2.5px !important;
    background-color: #1e293b !important;
    border-radius: 2px !important;
  }

  .mg-header-actions {
    gap: 0.6rem !important;
  }

  .mg-header-actions .mg-btn {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.82rem !important;
  }
}

/* Mobile Slide-out Drawer Menu */
.mg-mobile-menu {
  position: fixed !important;
  top: 0 !important;
  right: -100% !important;
  width: 85% !important;
  max-width: 320px !important;
  height: 100vh !important;
  background: #ffffff !important;
  z-index: 99999 !important;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2) !important;
  transition: right 0.35s ease-in-out !important;
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
}

.mg-mobile-menu.active {
  right: 0 !important;
}

.mg-mobile-menu-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding-bottom: 1rem !important;
  margin-bottom: 1.5rem !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.mg-mobile-title {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  color: #0d5c3a !important;
}

.mg-mobile-close {
  background: #f1f5f9 !important;
  border: none !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  font-size: 1.2rem !important;
  cursor: pointer !important;
  color: #334155 !important;
}

.mg-mobile-nav-list {
  list-style: none !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  padding: 0 !important;
  margin: 0 !important;
}

.mg-mobile-nav-list a {
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  text-decoration: none !important;
  display: block !important;
  padding: 0.6rem 0 !important;
  border-bottom: 1px solid #f8faf9 !important;
}

.mg-mobile-nav-list a:hover {
  color: #0d5c3a !important;
}

/* Mobile Hero Section */
@media (max-width: 768px) {
  .mg-hero {
    padding: 2.5rem 0 3rem !important;
  }

  .mg-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    text-align: center !important;
  }

  .mg-hero-title {
    font-size: 2rem !important;
    line-height: 1.2 !important;
  }

  .mg-hero-subtitle {
    font-size: 0.95rem !important;
    margin-bottom: 1.5rem !important;
  }

  .mg-hero-actions {
    flex-direction: column !important;
    gap: 0.8rem !important;
    width: 100% !important;
  }

  .mg-hero-actions .mg-btn {
    width: 100% !important;
  }

  .mg-hero-stats {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
    justify-items: center !important;
  }

  .mg-stat-divider {
    display: none !important;
  }

  .mg-hero-img {
    max-height: 240px !important;
  }
}

/* Mobile Category Grid */
@media (max-width: 768px) {
  .mg-category-grid {
    grid-template-columns: 1fr !important;
    gap: 1.2rem !important;
  }

  .mg-category-card {
    padding: 1.5rem !important;
  }
}

/* Mobile Filter Buttons & Products Grid */
@media (max-width: 768px) {
  .mg-section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    margin-bottom: 1.8rem !important;
  }

  .mg-filter-buttons {
    width: 100% !important;
    overflow-x: auto !important;
    padding-bottom: 0.5rem !important;
    white-space: nowrap !important;

  }

  .mg-filter-btn {
    padding: 0.4rem 1rem !important;
    font-size: 0.85rem !important;

  }

  .mg-products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.8rem !important;
  }

  .mg-product-card {
    border-radius: 8px !important;
  }

  .mg-product-img-wrap {
    height: 150px !important;
    padding: 0.8rem !important;
  }

  .mg-product-img {
    max-height: 130px !important;
  }

  .mg-product-body {
    padding: 0.8rem !important;
  }

  .mg-product-cat {
    font-size: 0.68rem !important;
  }

  .mg-product-title {
    font-size: 0.88rem !important;
    height: 2.6em !important;
    margin: 0.2rem 0 0.4rem !important;
  }

  .mg-product-short-desc {
    display: none !important;
  }

  .mg-price-row {
    margin-bottom: 0.6rem !important;
    padding-top: 0.5rem !important;
  }

  .mg-price {
    font-size: 1.1rem !important;
  }

  .mg-regular-price {
    font-size: 0.8rem !important;
  }

  .mg-weight-tag {
    font-size: 0.7rem !important;
    padding: 0.15rem 0.35rem !important;
  }

  .mg-btn {
    min-height: 42px !important;
    font-size: 0.85rem !important;
  }
}

@media (max-width: 420px) {
  .mg-products-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Mobile Single Product Page */
@media (max-width: 768px) {
  .mg-single-product-wrap {
    padding: 1.5rem 0 2.5rem !important;
  }

  .mg-sp-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    margin-bottom: 2rem !important;
  }

  .mg-sp-main-img-wrap {
    padding: 1.5rem !important;
  }

  .mg-sp-main-img {
    max-height: 260px !important;
  }

  .mg-sp-title {
    font-size: 1.5rem !important;
  }

  .mg-sp-current-price {
    font-size: 1.8rem !important;
  }

  .mg-sp-benefits-grid {
    grid-template-columns: 1fr !important;
  }

  .mg-sp-actions {
    flex-direction: column !important;
  }

  .mg-sp-tab-headers {
    overflow-x: auto !important;
    white-space: nowrap !important;

  }

  .mg-sp-tab-btn {
    padding: 0.8rem 1.2rem !important;
    font-size: 0.88rem !important;

  }

  .mg-sp-tab-content {
    padding: 1.5rem 1rem !important;
  }
}

/* Mobile Footer & About / Contact */
@media (max-width: 768px) {
  .mg-about-grid, .mg-contact-grid, .mg-footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  .mg-footer {
    padding-top: 2.5rem !important;
  }

  .mg-footer-bottom-inner {
    flex-direction: column !important;
    gap: 0.8rem !important;
    text-align: center !important;
  }

  .mg-contact-form-wrap {
    padding: 1.5rem !important;
  }

  .mg-input {
    font-size: 1rem !important; /* Prevents iOS auto-zoom on input focus */
  }
}

/* ==========================================================================
   COMPLETE MOBILE-FIRST & FLUID RESPONSIVE DESIGN SYSTEM
   ========================================================================== */

/* Prevent horizontal page overflow on all mobile viewports */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

.container {
  width: 100% !important;
  max-width: 1280px !important;
  margin: 0 auto !important;
  padding: 0 1.25rem !important;
  box-sizing: border-box !important;
}

/* Touch-friendly base sizing */
a, button, input, select, textarea {
  touch-action: manipulation;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* TABLET (<= 1024px) */
@media (max-width: 1024px) {
  .mg-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }
  
  .mg-about-grid, .mg-contact-grid, .mg-sp-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }

  .mg-category-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.2rem !important;
  }

  .mg-products-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.2rem !important;
  }

  .mg-features-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.2rem !important;
  }

  .mg-footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
  }
}

/* MOBILE MEDIUM / SMALL TABLET (<= 850px) */
@media (max-width: 850px) {
  /* Topbar Mobile Alignment */
  .mg-topbar {
    padding: 0.5rem 0 !important;
  }

  .mg-topbar-inner {
    flex-direction: column !important;
    gap: 0.35rem !important;
    text-align: center !important;
  }

  .mg-topbar-left, .mg-topbar-right {
    justify-content: center !important;
    gap: 0.8rem !important;
    flex-wrap: wrap !important;
  }

  .mg-tagline-badge {
    display: none !important; /* Hide long text on mobile to conserve space */
  }

  /* Header Navigation */
  .mg-header-inner {
    padding: 0.6rem 1rem !important;
  }

  .mg-logo-img, .mg-logo img, a.custom-logo-link img, img.custom-logo, header img {
    height: 42px !important;
    max-height: 42px !important;
    max-width: 170px !important;
  }

  .mg-nav {
    display: none !important;
  }

  .mg-search-form {
    display: none !important;
  }

  .mg-mobile-toggle {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    width: 44px !important;
    height: 44px !important;
  }

  .mg-mobile-toggle span {
    width: 22px !important;
    height: 2.5px !important;
    background-color: #1e293b !important;
    border-radius: 2px !important;
  }

  /* Mobile Drawer Overlay Menu */
  .mg-mobile-menu {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    width: 85% !important;
    max-width: 320px !important;
    height: 100vh !important;
    background-color: #ffffff !important;
    z-index: 99999 !important;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15) !important;
    transition: right 0.35s ease !important;
    padding: 1.5rem !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
  }

  .mg-mobile-menu.active {
    right: 0 !important;
  }

  .mg-mobile-menu-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 1rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 1.5rem !important;
  }

  .mg-mobile-title {
    font-weight: 800 !important;
    font-size: 1.1rem !important;
    color: #0d5c3a !important;
  }

  .mg-mobile-close {
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    color: #64748b !important;
    padding: 0.2rem 0.5rem !important;
  }

  .mg-mobile-nav-list {
    list-style: none !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .mg-mobile-nav-list li a {
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    display: block !important;
    padding: 0.6rem 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    text-decoration: none !important;
  }

  /* Hero Mobile */
  .mg-hero {
    padding: 2.5rem 0 3.5rem !important;
  }

  .mg-hero-title {
    font-size: 2.1rem !important;
    line-height: 1.2 !important;
  }

  .mg-hero-subtitle {
    font-size: 0.98rem !important;
    margin-bottom: 1.5rem !important;
  }

  .mg-hero-actions {
    flex-direction: column !important;
    gap: 0.8rem !important;
    width: 100% !important;
  }

  .mg-hero-actions .mg-btn {
    width: 100% !important;
  }

  .mg-hero-stats {
    flex-wrap: wrap !important;
    gap: 1rem !important;
    justify-content: space-between !important;
  }

  .mg-stat-divider {
    display: none !important;
  }

  .mg-category-grid {
    grid-template-columns: 1fr !important;
  }

  .mg-products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.9rem !important;
  }

  .mg-product-card {
    border-radius: 10px !important;
  }

  .mg-product-img-wrap {
    height: 160px !important;
    padding: 0.8rem !important;
  }

  .mg-product-img {
    max-height: 140px !important;
  }

  .mg-product-body {
    padding: 0.85rem !important;
  }

  .mg-product-title {
    font-size: 0.92rem !important;
    height: 2.6em !important;
  }

  .mg-price {
    font-size: 1.1rem !important;
  }

  .mg-filter-buttons {
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding-bottom: 0.5rem !important;
    width: 100% !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

/* SMARTPHONE SMALL / NARROW (<= 480px / 414px / 390px / 375px / 320px) */
@media (max-width: 480px) {
  .container {
    padding: 0 1rem !important;
  }

  .mg-hero-title {
    font-size: 1.75rem !important;
  }

  .mg-section-title {
    font-size: 1.6rem !important;
  }

  .mg-products-grid {
    grid-template-columns: 1fr !important; /* Single column on phones for full readability */
    gap: 1.2rem !important;
  }

  .mg-product-img-wrap {
    height: 200px !important;
  }

  .mg-product-img {
    max-height: 170px !important;
  }

  .mg-product-title {
    font-size: 1rem !important;
    height: auto !important;
  }

  .mg-price-row {
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }

  /* Single Product View Mobile */
  .mg-sp-title {
    font-size: 1.5rem !important;
  }

  .mg-sp-current-price {
    font-size: 1.8rem !important;
  }

  .mg-sp-actions {
    flex-direction: column !important;
    gap: 0.8rem !important;
  }

  .mg-sp-tab-headers {
    overflow-x: auto !important;
    white-space: nowrap !important;
  }

  .mg-sp-tab-btn {
    padding: 0.8rem 1.1rem !important;
    font-size: 0.88rem !important;
  }

  .mg-sp-tab-content {
    padding: 1.25rem !important;
  }

  /* Footer Mobile */
  .mg-footer-grid {
    grid-template-columns: 1fr !important;
    gap: 1.8rem !important;
    text-align: center !important;
  }

  .mg-footer-logo img {
    margin: 0 auto 1rem !important;
  }

  .mg-footer-bottom-inner {
    flex-direction: column !important;
    gap: 0.8rem !important;
    text-align: center !important;
  }

  .mg-footer-legal {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
  }
}


/* ==========================================================================
   COMPREHENSIVE MOBILE RESPONSIVE FIX
   ========================================================================== */
@media (max-width: 1024px) {
  .mg-products-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .mg-category-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .mg-hero-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
  }
  .mg-hero-title {
    font-size: 2.2rem !important;
  }
  .mg-about-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 850px) {
  /* Header Adjustments */
  .mg-nav, .mg-search-form, header nav {
    display: none !important;
  }
  .mg-mobile-toggle {
    display: flex !important;
    background: #0d5c3a;
    padding: 8px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
  }
  .mg-mobile-toggle span {
    background-color: #fff;
    height: 2px;
    width: 20px;
    display: block;
  }
  .mg-header-actions, header .mg-header-actions {
    gap: 0.8rem !important;
  }
  .mg-btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  /* Grid Adjustments */
  .mg-products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
  }
  .mg-category-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Hero Section */
  .mg-hero-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
  }
  .mg-hero-actions {
    justify-content: center;
  }
  .mg-hero-stats {
    justify-content: center;
  }
  
  /* Features */
  .mg-features-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  /* Contact */
  .mg-contact-grid {
    grid-template-columns: 1fr !important;
  }

  /* Footer */
  .mg-footer-grid {
    grid-template-columns: 1fr !important;
    text-align: center !important;
  }
  .mg-footer-legal {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
  .mg-contact-row {
    justify-content: center !important;
  }
}

@media (max-width: 576px) {
  .mg-products-grid {
    grid-template-columns: 1fr !important;
  }
  .mg-features-grid {
    grid-template-columns: 1fr !important;
  }
  .mg-hero-title {
    font-size: 1.8rem !important;
  }
  .mg-section-title {
    font-size: 1.5rem !important;
  }
  .mg-topbar-inner {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  .mg-topbar-left, .mg-topbar-right {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
  }
  .mg-header-inner {
    padding: 0.6rem 1rem !important;
  }
  .mg-logo-img, .mg-logo img, a.custom-logo-link img {
    height: 40px !important;
    max-height: 40px !important;
    max-width: 150px !important;
  }
}


/* ==========================================================================
   FORCE MOBILE HEADER OVERRIDES (FIX FOR SPECIFICITY & OVERFLOW)
   ========================================================================== */
@media (max-width: 850px) {
  /* Aggressive hide of desktop nav items */
  .mg-nav, header nav, .mg-header nav, .mg-header .mg-nav, .mg-search-form {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
  }
  
  /* Ensure header container is flexible but doesn't stretch */
  .mg-header-inner, header .container {
    padding: 0.5rem 1rem !important;
    flex-wrap: nowrap !important;
    gap: 1rem !important;
  }
  
  .mg-header-actions {
    gap: 0.5rem !important;
  }
  
  .mg-mobile-toggle {
    display: flex !important;
    background: #0d5c3a !important;
  }
}

@media (max-width: 576px) {
  /* Hide the long tagline on very small screens to prevent topbar squishing */
  .mg-tagline-badge {
    display: none !important;
  }
  
  .mg-topbar-left, .mg-topbar-right {
    gap: 0.5rem !important;
    font-size: 0.75rem !important;
  }
  
  .mg-btn-sm {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.75rem !important;
  }
}
