/* ===== MOBILE-FIRST OPTIMIZATION ===== */

/* Mobile Menu Toggle (Hidden on Desktop) */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.hamburger-line {
  width: 25px;
  height: 3px;
  background: var(--dark);
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Mobile Menu (Hidden on Desktop) */
.mobile-menu {
  display: none;
}

  /* ===== MOBILE HEADER OPTIMIZATIONS ===== */

@media (max-width: 992px) {
  /* Adjust header container for tablets */
  .header-container {
    grid-template-columns: 150px 1fr auto;
    gap: 15px;
  }
  
  .logo img {
    width: 120px;
  }
  
  .search-container {
    max-width: 400px;
  }
  
  .icon-label {
    display: none;
  }
  
  .icon-btn {
    padding: 8px;
  }
}
 
@media (max-width: 768px) {
  /* Hide desktop elements on mobile */
  .header-container {
    grid-template-columns: 1fr auto;
    gap: 15px;
    padding: 0 15px;
  }
  
  .search-container {
    display: none; /* Hide desktop search */
  }
  
  .main-nav {
    display: none; /* Hide desktop nav */
  }
  
  .header-top {
    padding: 10px 0;
  }
  
  .logo img {
    width: 100px;
  }
  
  .user-btn {
    display: none; /* Hide user button, show in mobile menu */
  }
  
  /* Show mobile menu toggle */
  .mobile-nav-toggle {
    display: flex;
  }
  
  /* Mobile Menu */
  .mobile-menu {
    display: block;
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    background: var(--white);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
    overflow-y: auto;
  }
  
  .mobile-menu.active {
    left: 0;
  }
  
  /* Mobile Menu Header */
  .mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
  }
  
  .mobile-logo img {
    width: 100px;
  }
  
  .mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--dark);
  }
  
  /* Mobile Search */
  .mobile-search {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
  }
  
  .mobile-search-input {
    flex: 1;
    height: 42px;
    padding: 0 15px;
    border: 2px solid #e9ecef;
    border-radius: 21px;
    font-size: 0.9rem;
    background: #f8f9fa;
    outline: none;
  }
  
  .mobile-search-input:focus {
    border-color: var(--primary);
    background: white;
  }
  
  .mobile-search-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Mobile Nav Links */
  .mobile-nav-links {
    list-style: none;
    padding: 10px 0;
  }
  
  .mobile-nav-links li a {
    display: block;
    padding: 15px 20px;
    color: var(--dark);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
  }
  
  .mobile-nav-links li a:hover,
  .mobile-nav-links li a:active {
    background: #f8f9fa;
    border-left-color: var(--primary);
    color: var(--primary);
  }
  
  .mobile-nav-divider {
    height: 1px;
    background: #e9ecef;
    margin: 10px 0;
  }

  .mobile-nav-special {
    background: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
    color: white !important;
    font-weight: 600;
  }

  /* Mobile User Section */
  .mobile-user-section {
    padding: 20px;
    background: #f8f9fa;
    margin-top: 20px;
  }

  .mobile-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 15px;
  }

  .mobile-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-user-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--dark);
  }

  .mobile-user-info p {
    font-size: 0.8rem;
    color: #6c757d;
  }

  .mobile-user-menu {
    list-style: none;
    padding: 0;
  }

  .mobile-user-menu li a {
    display: block;
    padding: 12px 0;
    color: var(--dark);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid #e9ecef;
  }

  .mobile-user-menu li:last-child a {
    border-bottom: none;
  }
  
  /* Mobile Menu Overlay */
  body.mobile-menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease;
  }

  body.mobile-menu-open {
   overflow: hidden;
  }

  /* Announcement bar mobile */
  .announcement-bar p {
    font-size: 0.75rem;
    flex-wrap: wrap;
  }
}

/* Extra Small Devices */
@media (max-width: 480px) {
  .header-container {
    padding: 0 10px;
  }
  .logo img {
    width: 85px;
  }
  .icon-btn {
  padding: 6px;
  }
  .cart-quantity {
  min-width: 18px;
  height: 18px;
  font-size: 0.65rem;
  }
  .mobile-menu {
  width: 90%;
  }
  .announcement-bar {
  padding: 8px 0;
  }
  .announcement-bar p {
  font-size: 0.7rem;
  padding: 0 10px;
  }
}

/* Responsive Adjustments - Product pages */
@media (max-width: 1200px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .products-page {
    grid-template-columns: 1fr;
  }
            
  .product-filters {
    position: static;
    margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: 1fr 1fr;
   }
}

@media (max-width: 576px) {
  .products-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-float a {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ===== MOBILE CART OPTIMIZATIONS ===== */

@media (max-width: 768px) {
  /* Full-width cart on mobile */
  .cartTab {
    width: 100%;
    max-width: 100%;
    inset: 0 -100% 0 auto;
  }
  
  body.showCart .cartTab {
    inset: 0 0 0 0;
  }

  /* Adjust header padding */
  .cartTab h3 {
    padding: 15px;
    font-size: 1.1rem;
  }

  .cartTab h3 .cart-quantity {
    min-width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  /* Larger touch targets for mobile */
  .listCart .quantity span {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .listCart .quantity span.number {
    min-width: 40px;
    font-size: 1rem;
  }

  .listCart .quantity .trash-cart {
    width: 36px;
    height: 36px;
  }

  .listCart .quantity .trash-cart img {
    width: 18px;
    height: 18px;
  }

  /* Adjust cart item layout */
  .cartTab .listCart .item {
    grid-template-columns: 70px 1fr auto;
    gap: 10px;
    padding: 10px;
  }

  .cartTab .listCart .item .image {
    width: 70px;
    height: 70px;
  }

  .listCart .name {
    font-size: 0.85rem;
  }

  .listCart .name .unitprice {
    font-size: 0.7rem;
  }

  .listCart .totalPrice {
    font-size: 0.95rem;
  }

  /* Button adjustments */
  .cartTab .btn {
    padding: 12px;
  }

  .cartTab .btn button {
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  /* Adjust scrolling area */
  .listCart {
    padding: 12px;
  }

  /* Empty cart state */
  .listCart .empty-cart-message {
    min-height: 250px;
    padding: 30px 20px;
  }

  .listCart .empty-cart-message img {
    width: 100px;
  }

  .listCart .empty-cart-message p {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  /* Extra small devices */
  .cartTab h3 {
    font-size: 1rem;
    padding: 12px;
  }

  .cartTab .listCart .item {
    grid-template-columns: 60px 1fr auto;
    gap: 8px;
    padding: 8px;
  }

  .cartTab .listCart .item .image {
    width: 60px;
    height: 60px;
  }

  .listCart .name {
    font-size: 0.8rem;
  }

  .listCart .totalPrice {
    font-size: 0.9rem;
  }

  .listCart .quantity span {
    width: 28px;
    height: 28px;
    gap: 4;
    font-size: 16px;
  }
}