/* Mobile Layout Fixes - BALANCED VERSION */

/* Targeted mobile fixes that preserve card proportions */
@media screen and (max-width: 768px) {
  /* Remove left margins from main layout containers only */
  body {
    margin-left: 0 !important;
    padding-left: 0 !important;
    overflow-x: hidden !important;
  }
  
  /* Fix container margins while preserving spacing */
  .container,
  .main-content,
  .content-area,
  .shop-area,
  .product-area {
    margin-left: 0 !important;
    padding-left: 15px !important;
    margin-right: 0 !important;
    padding-right: 15px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Grid system - single column but with proper spacing */
  .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  [class*="col-"] {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    padding: 10px !important; /* Maintain card spacing */
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* Preserve card proportions - NO height squeezing */
  .card,
  .product-card,
  .product-item,
  .single-product,
  .product-wrapper,
  .product-box,
  .tpsidebar__product-item,
  .tpfeature__product-item {
    height: auto !important; /* Let cards maintain natural height */
    min-height: auto !important;
    max-height: none !important;
    margin: 10px 0 !important; /* Add vertical spacing */
    padding: 15px 20px !important; /* Add left/right padding for better appearance */
  }
  
  /* Ensure images maintain aspect ratio */
  .card img,
  .product-card img,
  .product-img,
  .product-image,
  .card-img-top,
  .product-thumb {
    height: auto !important;
    max-height: 200px !important; /* Reasonable max height */
    object-fit: contain !important; /* Maintain aspect ratio */
    width: 100% !important;
  }
  
  /* Card body content - preserve spacing */
  .card-body,
  .product-info,
  .product-content {
    padding: 15px !important; /* Keep comfortable padding */
    height: auto !important;
  }
  
  /* Product titles and text - maintain readability */
  .card-title,
  .product-title,
  .product-name {
    font-size: 16px !important; /* Readable size */
    line-height: 1.4 !important;
    margin-bottom: 10px !important;
  }
  
  /* Price and buttons - maintain proportions */
  .card-text,
  .product-price,
  .product-description {
    font-size: 14px !important;
    line-height: 1.5 !important;
    margin-bottom: 10px !important;
  }
  
  /* Force hide any left margins from main.css */
  * {
    margin-left: 0 !important;
    padding-left: 0 !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }
  
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  /* Reset container margins and padding */
  .container, 
  div.container,
  main .container,
  section .container,
  body .container,
  html .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Reset row margins */
  .row,
  div.row,
  .container .row,
  body .row,
  main .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    padding-left: 0 !important;
  }
  
  /* Reset column padding */
  [class*="col-"],
  div[class*="col-"],
  .row [class*="col-"],
  body [class*="col-"] {
    padding-left: 10px !important;
    padding-right: 10px !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
  }
  
  /* Ensure content doesn't overflow */
  body, 
  html,
  body > *,
  html > * {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Add consistent padding to sections */
  .section,
  section,
  div.section,
  body section {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Adjust category items */
  .category__item {
    margin: 5px !important;
  }

  /* Fix mobile navigation */
  .mean-container .mean-nav,
  nav,
  .nav-container,
  header nav {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    width: 100% !important;
  }

  /* Fix mobile menu */
  .mean-container .mean-nav ul li a {
    width: 90% !important;
    padding: 10px 5% !important;
  }
  
  /* Override any main.css margins */
  main, 
  .main-content,
  .main-container,
  #main,
  #content,
  body main,
  body .main-content {
    margin-left: 0 !important;
    padding-left: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
   
   /* Fix specific left margin issues from main.css */
   .row, 
   div.row,
   main .row,
   section .row,
   .container .row,
   body > div,
   body > main,
   body > section,
   div[class*="col-"],
   [class*="col-"],
   .shop-area-start {
     margin-left: 0 !important;
     padding-left: 0 !important;
   }
  
  /* Fix mobile search */
  .search-section {
    margin: 0 !important;
    padding: 10px !important;
  }

  /* Fix product grid */
  .product-grid {
    margin: 0 !important;
  }

  .product-item {
    margin: 5px !important;
  }
}

/* Add a higher specificity rule for smaller screens */
@media (max-width: 576px) {
  body, html, 
  .container,
  .row,
  main,
  section,
  div[class*="col-"],
  [class*="col-"],
  .shop-area-start {
    margin-left: 0 !important;
    padding-left: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
}