/* Mobile Optimizations CSS */

/* Mobile Search Modal - Updated to match template */
.mobile_search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
    padding-top: 6rem;
}

.mobile_search-modal.active {
    opacity: 1;
    visibility: visible;
}

.mobile_search-modal > div {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

.dark .mobile_search-modal > div {
    background: #374151;
}

/* Mobile Menu Sidebar */
.mobile-menu {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 9999;
    padding: 1rem;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.dark .mobile-menu {
    background: #374151;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.mobile-menu-item:hover {
    background: var(--primary-500);
    color: white;
}

.mobile-menu-item a {
    color: inherit;
    text-decoration: none;
}

/* Mobile Cart Sidebar */
.mobile-cart {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 320px;
    background: white;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 9999;
    padding: 1rem;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.dark .mobile-cart {
    background: #374151;
}

.mobile-cart.active {
    transform: translateX(0);
}

/* Overlay - Behind menus */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    /* z-index: 9995; */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
    /* Hide desktop elements on mobile */
    .lg\:flex {
        display: none !important;
    }
    
    /* Ensure mobile elements are visible */
    .lg\:hidden {
        display: flex !important;
    }
    
    /* Bottom navbar adjustments */
    .bottom-navbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 40;
        display: flex;
        height: 4.5rem;
        align-items: center;
        justify-content: space-around;
        background: white;
        padding: 1rem 1rem 0.75rem 1rem;
        color: #6b7280;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #e5e7eb;
    }
    
    .dark .bottom-navbar {
        background: #1f2937;
        color: #d1d5db;
        border-top-color: #374151;
    }
    
    .bottom-navbar.hidden {
        transform: translateY(100%);
    }
    
    .bottom-navbar li {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        font-size: 0.75rem;
        transition: all 0.2s ease;
        padding: 0.5rem;
        border-radius: 0.5rem;
        min-width: 60px;
        cursor: pointer;
    }
    
    .bottom-navbar li.open-menu-mobile {
        cursor: pointer;
    }
    
    .bottom-navbar li a {
        color: inherit;
        text-decoration: none;
    }
    
    .bottom-navbar li:hover {
        color: var(--primary-500);
        background: #f3f4f6;
    }
    
    .dark .bottom-navbar li:hover {
        background: #374151;
    }
    
    /* Home button center circle */
    .bottom-navbar .home-center {
        position: relative;
        margin-top: -1rem;
    }
    
    .home-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 56px;
        height: 56px;
        background: linear-gradient(135deg, var(--primary-500), #1d4ed8);
        border-radius: 50%;
        color: white !important;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        transition: all 0.3s ease;
        text-decoration: none;
    }
    
    .home-btn svg {
        color: white !important;
        fill: white !important;
    }
    
    .home-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
        color: white !important;
    }
    
    .home-btn:hover svg {
        color: white !important;
        fill: white !important;
    }
    
    .home-center span {
        display: none;
    }
    
    /* Mobile search bar positioning */
    .open-mobile_search-modal {
        position: fixed;
        top: 4rem;
        left: 1rem;
        right: 1rem;
        z-index: 30;
        background: #f9fafb;
        border: 1px solid #e5e7eb;
        border-radius: 2rem;
        padding: 0.75rem 1rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
        margin: 0;
        width: auto;
    }
    
    .dark .open-mobile_search-modal {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .open-mobile_search-modal:hover {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
        transform: translateY(-1px);
    }
    
    .open-mobile_search-modal svg {
        flex-shrink: 0;
        color: #6b7280;
    }
    
    .dark .open-mobile_search-modal svg {
        color: #9ca3af;
    }
    
    .open-mobile_search-modal p {
        color: #6b7280;
        font-size: 0.875rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .dark .open-mobile_search-modal p {
        color: #9ca3af;
    }
    
    /* Content padding for mobile */
    main {
        /* padding-top: 7rem !important; */
        /* padding-bottom: 6rem; */
    }
    
    /* Mobile cart and menu width adjustments for smaller screens */
    @media (max-width: 480px) {
        .mobile-menu {
            width: 90vw;
        }
        
        .mobile-cart {
            width: 90vw;
        }
    }
}

/* Category slide for mobile menu */
.category-slide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 10000;
    padding: 1rem;
    overflow-y: auto;
}

.dark .category-slide {
    background: #374151;
}

.category-slide.active {
    transform: translateX(0);
}

/* Search modal list items */
.search-modal-list-item a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border-radius: 1rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.dark .search-modal-list-item a {
    background: #4b5563;
    color: #d1d5db;
}

.search-modal-list-item a:hover {
    background: var(--primary-500);
    color: white;
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Improve touch targets */
    button, .mobile-menu-item, .bottom-navbar li {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing for mobile */
    .mobile-menu-item {
        padding: 1rem 0.75rem;
    }
    
    /* Responsive text sizes */
    .mobile-menu-item {
        font-size: 1rem;
    }
    
    /* Cart item improvements */
    .cart-item {
        padding: 1rem 0.5rem;
    }
    
    /* Search modal improvements */
    .mobile-search-modal .bg-white {
        margin: 1rem;
        margin-top: 5rem;
        max-height: calc(100vh - 6rem);
          overflow-y: auto;
      }

      /* Shop page mobile optimizations */
      @media (max-width: 1024px) {
          /* Container padding */
          .container {
              padding-left: 1rem;
              padding-right: 1rem;
          }

          /* Remove extra top space in shop page */
          .products-page {
              padding-top: 0 !important;
          }

          /* Mobile breadcrumb improvements */
          nav[aria-label="Breadcrumb"] {
              margin: 0.75rem 0;
              padding: 0.5rem 0;
              font-size: 0.75rem;
              overflow-x: auto;
              white-space: nowrap;
              scrollbar-width: none; /* Firefox */
              -ms-overflow-style: none; /* IE and Edge */
          }

          nav[aria-label="Breadcrumb"]::-webkit-scrollbar {
              display: none; /* Chrome, Safari, Opera */
          }

          nav[aria-label="Breadcrumb"] svg {
              width: 0.875rem;
              height: 0.875rem;
          }

          nav[aria-label="Breadcrumb"] a {
              color: #6B7280;
              transition: color 0.2s ease;
          }

          nav[aria-label="Breadcrumb"] a:hover {
              color: var(--primary-500);
          }

          .dark nav[aria-label="Breadcrumb"] a {
              color: #9CA3AF;
          }

          .dark nav[aria-label="Breadcrumb"] a:hover {
              color: var(--primary-400);
          }

          /* Mobile filter buttons container */
          .mobile-filters-container {
              margin-bottom: 1.5rem;
              display: flex;
              flex-direction: column;
              gap: 0.75rem;
          }

          /* Filter buttons row */
          .filter-buttons-row {
              display: flex;
              gap: 0.75rem;
              width: 100%;
          }

          /* Sort and filter buttons */
          .sort-modal-open,
          .filter-modal-open {
              display: flex;
              align-items: center;
              justify-content: center;
              gap: 0.5rem;
              padding: 0.75rem 1rem;
              font-size: 0.875rem;
              color: #4B5563;
              background: white;
              border-radius: 0.75rem;
              box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
              transition: all 0.2s ease;
              white-space: nowrap;
              flex: 1;
              border: 1px solid #E5E7EB;
          }

          .dark .sort-modal-open,
          .dark .filter-modal-open {
              color: #E5E7EB;
              background: #1F2937;
              border-color: #374151;
              box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
          }

          .filter-icon {
              width: 1.25rem;
              height: 1.25rem;
              color: var(--primary-500);
              flex-shrink: 0;
          }

          .dark .filter-icon {
              color: var(--primary-400);
          }

          .sort-modal-open:active,
          .filter-modal-open:active {
              transform: scale(0.98);
              box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
          }

          /* Products count badge */
          .products-count-badge {
              display: flex;
              align-items: center;
              justify-content: center;
              gap: 0.25rem;
              padding: 0.5rem 1rem;
              background: white;
              border: 1px solid var(--primary-100);
              border-radius: 0.75rem;
              text-align: center;
              font-size: 0.875rem;
              color: var(--primary-800);
          }

          .dark .products-count-badge {
              background: var(--primary-900);
              border-color: var(--primary-800);
              color: var(--primary-300);
          }

          .count-number {
              font-weight: 700;
              font-size: 1rem;
          }

          .count-label {
              color: var(--primary-500);
          }

          .dark .count-label {
              color: var(--primary-400);
          }
          
          /* Mobile-specific styles for active filters */
          .active-filters-container {
              margin-top: 0.75rem;
          }
      }
  }
  
/* Active filters tags - Global styles for both mobile and desktop */
.active-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: white;
    border: 1px solid var(--primary-100);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--primary-800);
    transition: all 0.2s ease;
}

.dark .filter-tag {
    background-color: var(--primary-900);
    border-color: var(--primary-800);
    color: var(--primary-300);
}

.filter-tag-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Filter tag icon */
.filter-tag-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

/* Desktop specific styles for filter tags */
@media (min-width: 1024px) {
    .filter-tag {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
        border-radius: 0.625rem;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
    
    .filter-tag-label {
        max-width: 200px;
    }
    
    .filter-tag-remove {
        width: 1.5rem;
        height: 1.5rem;
    }
    
    .clear-all-filters {
        margin-left: 0.5rem;
        font-weight: 500;
    }
}

.filter-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background-color: #BFDBFE;
    color: var(--primary-800);
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .filter-tag-remove {
    background-color: var(--primary-600);
    color: var(--primary-100);
}

.filter-tag-remove:hover {
    background-color: var(--primary-500);
    color: white;
}

.dark .filter-tag-remove:hover {
    background-color: var(--primary-400);
    color: var(--primary-900);
}

/* Clear all filters button */
.clear-all-filters {
    background-color: #FEE2E2;
    border-color: #FECACA;
    color: #B91C1C;
    cursor: pointer;
}

.dark .clear-all-filters {
    background-color: #7F1D1D;
    border-color: #B91C1C;
    color: #FECACA;
}

.clear-all-filters:hover {
    background-color: #FCA5A5;
    border-color: #F87171;
    color: #7F1D1D;
}

.dark .clear-all-filters:hover {
    background-color: #B91C1C;
    border-color: #EF4444;
    color: #FEF2F2;
}

/* Prevent body scroll when modals are open */
body.modal-open {
    overflow: hidden;
}

/* Smooth transitions for all interactive elements */
.mobile-menu, .mobile-cart, .mobile-search-modal, .overlay {
    will-change: transform, opacity;
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .mobile-menu, .mobile-cart {
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix button interactions on mobile */
@media (max-width: 1024px) {
    button,
    .btn,
    .add-to-cart-btn,
    .add-to-cart-ajax,
    [role="button"] {
        position: relative;
        z-index: 1;
        pointer-events: auto !important;
        touch-action: manipulation;
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Ensure product cards and buttons work properly */
    .product-card,
    .product-item {
        position: relative;
        z-index: 1;
    }
    
    .product-card button,
    .product-item button,
    .product-card .btn,
    .product-item .btn {
        position: relative;
        z-index: 2;
        pointer-events: auto !important;
    }
    
    /* Fix form submissions on mobile */
    form {
        position: relative;
        z-index: 1;
    }
    
    form button,
    form input[type="submit"] {
        position: relative;
        z-index: 2;
        pointer-events: auto !important;
    }
    
    /* Ensure all interactive elements work */
    a,
    input,
    select,
    textarea {
        pointer-events: auto !important;
        touch-action: manipulation;
    }
    
    /* Fix overlay interference */
    .overlay:not(.active) {
        pointer-events: none !important;
        z-index: -1;
    }
    
    /* Touch active state for better mobile feedback */
    .touch-active {
        opacity: 0.7;
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    /* Ensure buttons have proper hover/active states on mobile */
    button:active,
    .btn:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
}
