/* ===================================
   SHOP BY CATALOGUE - MOBILE STYLES WITH ALL CATALOGUES VISIBLE
   Updated to show all catalogue cards on mobile
   =================================== */

/* ===================================
   1. BASE MOBILE STYLES (max-width: 768px)
   =================================== */
@media (max-width: 768px) {
  /* Section Container */
  .shop-by-catalogue {
    padding: 30px 0;
    background: #ffffff;
  }
  
  .shop-by-catalogue .container {
    padding: 0 12px;
    max-width: 100%;
    margin-bottom: 0;
    box-sizing: border-box;
  }
  
  /* Section Title */
  .catalogue-main-title {
    font-size: 1.5rem;
    font-weight: 600;
    font-family: var(--font-secondary);
    color: #1a8917;
    margin-bottom: 20px;
    text-align: center;
    padding: 0 10px;
    position: relative;
    animation: fadeInDown 0.6s ease-out;
  }
  
  @keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* ===================================
     2. CATALOGUE GRID LAYOUT - SHOW ALL
     =================================== */
  .catalogue-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 30px;
    padding: 0;
  }
  
  /* Make sure all catalogue cards are visible */
  .catalogue-card {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  /* Remove any hidden state classes */
  .catalogue-card.hidden,
  .catalogue-card.collapsed,
  .catalogue-card[style*="display: none"] {
    display: grid !important;
  }
  
  /* Hide any "show more categories" button */
  .show-more-categories,
  .load-more-categories,
  .expand-categories,
  [class*="more-categories"] {
    display: none !important;
  }
  
  /* ===================================
     3. FEATURED CATALOGUE CARD
     =================================== */
  .featured-catalogue-card {
    grid-column: 1;
    background: linear-gradient(135deg, #9cc39b 0%, #fdecd9 100%);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    min-height: auto;
    margin-bottom: 4px;
  }
  
  .featured-catalogue-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  }
  
  /* Featured Content */
  .featured-content {
    position: relative;
    z-index: 2;
    margin-bottom: 16px;
    text-align: center;
  }
  
  .featured-brand {
    font-size: 2rem;
    font-weight: 700;
    color: #1a8917;
    margin: 0 0 6px 0;
    font-style: italic;
    letter-spacing: -0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  
  .featured-tagline {
    font-size: 0.95rem;
    color: #444444;
    margin: 0 0 16px 0;
    font-weight: 500;
  }
  
  .featured-cta {
    background: #188140;
    color: #ffffff;
    border: none;
    padding: 12px 28px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: capitalize;
    box-shadow: 0 4px 15px rgba(24, 129, 64, 0.3);
    min-width: 140px;
    -webkit-tap-highlight-color: transparent;
  }
  
  .featured-cta:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(24, 129, 64, 0.3);
  }
  
  /* Featured Image */
  .featured-image {
    position: relative;
    right: auto;
    top: auto;
    width: 100%;
    height: 180px;
    margin: 16px 0;
    opacity: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  }
  
  .featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
  }
  
  /* Featured Products Scroll */
  .featured-products {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding: 4px 4px 8px;
    margin-left: -4px;
    margin-right: -4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    position: relative;
    z-index: 2;
    
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .featured-products::-webkit-scrollbar {
    display: none;
  }
  
  /* Scroll hint */
  .featured-catalogue-card::after {
    content: 'Swipe for more →';
    position: absolute;
    bottom: 8px;
    right: 20px;
    font-size: 0.75rem;
    color: #666;
    opacity: 0.7;
    animation: swipeHint 2s ease-in-out infinite;
  }
  
  .featured-catalogue-card.scrolled::after {
    display: none;
  }
  
  @keyframes swipeHint {
    0%, 100% { transform: translateX(0); opacity: 0.7; }
    50% { transform: translateX(5px); opacity: 1; }
  }
  
  .featured-product-card {
    flex: 0 0 110px;
    scroll-snap-align: start;
    background: #ffffff;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  
  .featured-product-card:active {
    transform: scale(0.95);
  }
  
  .featured-product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
  }
  
  .product-info {
    padding: 0 4px;
  }
  
  .product-price {
    font-size: 0.875rem;
    font-weight: 700;
    color: #6cab84;
    margin-right: 4px;
  }
  
  .product-original {
    font-size: 0.75rem;
    color: #999999;
    text-decoration: line-through;
  }
  
  .product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 0.7rem;
    flex-wrap: wrap;
  }
  
  .stars {
    color: #ff9500;
    font-weight: 600;
    font-size: 0.7rem;
  }
  
  .sold {
    color: #666666;
    font-size: 0.65rem;
  }
  
  /* ===================================
     4. REGULAR CATALOGUE CARDS - ALL VISIBLE
     =================================== */
  .catalogue-card {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    padding: 0;
    background: #f8f8f8;
    border-radius: 12px;
    gap: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    -webkit-tap-highlight-color: transparent;
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    min-height: 90px;
    position: relative;
    /* Animation for all cards to appear smoothly */
    animation: fadeInUp 0.4s ease-out backwards;
  }
  
  /* Stagger animation for each card */
  .catalogue-card:nth-child(2) { animation-delay: 0.05s; }
  .catalogue-card:nth-child(3) { animation-delay: 0.1s; }
  .catalogue-card:nth-child(4) { animation-delay: 0.15s; }
  .catalogue-card:nth-child(5) { animation-delay: 0.2s; }
  .catalogue-card:nth-child(6) { animation-delay: 0.25s; }
  .catalogue-card:nth-child(7) { animation-delay: 0.3s; }
  .catalogue-card:nth-child(8) { animation-delay: 0.35s; }
  
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .catalogue-card:active {
    transform: scale(0.98);
    background: #f0f0f0;
  }
  
  .catalogue-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #1a8917;
    transform: scaleX(0);
    transition: transform 0.3s ease;
  }
  
  .catalogue-card:hover::after {
    transform: scaleX(1);
  }
  
  .catalogue-image {
    width: 100px;
    height: 90px;
    flex-shrink: 0;
    overflow: hidden;
    background: #fff;
  }
  
  .catalogue-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
  }
  
  .catalogue-card:hover .catalogue-image img {
    transform: scale(1.08);
  }
  
  .catalogue-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #222222;
    padding: 16px;
    margin: 0;
    text-align: left;
    line-height: 1.3;
    display: flex;
    align-items: center;
    position: relative;
  }
  
  /* Category Icons */
  .catalogue-card[data-catalogue="products"] .catalogue-title::before {
    content: "🛍️";
    margin-right: 8px;
    font-size: 1.1rem;
  }
  
  .catalogue-card[data-catalogue="pharmacy"] .catalogue-title::before {
    content: "💊";
    margin-right: 8px;
    font-size: 1.1rem;
  }
  
  .catalogue-card[data-catalogue="services"] .catalogue-title::before {
    content: "🔧";
    margin-right: 8px;
    font-size: 1.1rem;
  }
  
  .catalogue-card[data-catalogue="rental"] .catalogue-title::before {
    content: "🏠";
    margin-right: 8px;
    font-size: 1.1rem;
  }
  
  .catalogue-card[data-catalogue="jobs"] .catalogue-title::before {
    content: "💼";
    margin-right: 8px;
    font-size: 1.1rem;
  }
  
  .catalogue-card[data-catalogue="lost"] .catalogue-title::before {
    content: "🔍";
    margin-right: 8px;
    font-size: 1.1rem;
  }
  
  .catalogue-card[data-catalogue="bus"] .catalogue-title::before {
    content: "🚌";
    margin-right: 8px;
    font-size: 1.1rem;
  }
  
  /* Arrow indicator */
  .catalogue-title::after {
    content: "›";
    margin-left: auto;
    font-size: 1.2rem;
    color: #999;
    transition: all 0.3s ease;
  }
  
  .catalogue-card:active .catalogue-title::after {
    transform: translateX(3px);
    color: #1a8917;
  }
  
  /* Special card styling */
  .catalogue-card[data-catalogue="pharmacy"],
  .catalogue-card[data-catalogue="bus"] {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border-color: rgba(26, 137, 23, 0.15);
  }
  
  .catalogue-card[data-catalogue="lost"] {
    background: linear-gradient(135deg, #fef3c7 0%, #ffffff 100%);
    border-color: rgba(245, 158, 11, 0.15);
  }
  
  /* NEW Badge */
  .catalogue-card[data-catalogue="bus"] {
    position: relative;
  }
  
  .catalogue-card[data-catalogue="bus"]::before {
    content: "NEW";
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
  }
  
  /* ===================================
     5. POPULAR NOW SECTION
     =================================== */
  .popular-now {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
  }
  
  /* ===================================
     6. MORE TO LOVE SECTION
     =================================== */
  .more-section {
    padding-top: 40px;
    margin-top: 0;
  }
  
  .more-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #078b31;
    font-family: var(--font-secondary);
    margin: 0 0 24px 0;
    text-align: center;
    letter-spacing: -0.3px;
  }
  
  /* More Products Grid */
  .more-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0;
    margin-bottom: 40px;
    contain: layout;
  }
  
  .more-product-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  
  .more-product-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .more-product-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f8f8f8;
  }
  
  .more-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    loading: lazy;
  }
  
  .more-product-card:hover .more-product-image img {
    transform: scale(1.05);
  }
  
  .more-product-info {
    padding: 10px;
  }
  
  .more-product-title {
    font-size: 0.8rem;
    color: #222222;
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 2.6em;
  }
  
  .more-product-price {
    font-size: 1rem;
    font-weight: 700;
    color: #222222;
    margin: 0 0 4px 0;
  }
  
  .more-product-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.7rem;
    color: #666666;
    flex-wrap: wrap;
  }
  
  .more-product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  
  .rating-star {
    color: #ff9500;
    font-size: 0.65rem;
  }
  
  /* ===================================
     7. LOAD MORE BUTTON (For products, not categories)
     =================================== */
  .load-more-container {
    text-align: center;
    margin-top: 32px;
    opacity: 1;
    transition: opacity 0.3s ease;
  }
  
  .load-more-btn {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    color: #222222;
    padding: 14px 36px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    -webkit-tap-highlight-color: transparent;
    min-width: 160px;
  }
  
  .load-more-btn:hover:not(:disabled) {
    background: #1a8917;
    color: #ffffff;
    border-color: #1a8917;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 137, 23, 0.2);
  }
  
  .load-more-btn:active {
    transform: scale(0.97);
    background: #f5f5f5;
  }
  
  .load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
  
  .load-more-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
  }
  
  .load-more-btn:hover:not(:disabled) i {
    transform: translateY(2px);
  }
  
  /* Loading spinner */
  .fa-spinner.fa-spin {
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* ===================================
     8. PERFORMANCE OPTIMIZATIONS
     =================================== */
  
  /* GPU acceleration */
  .catalogue-card,
  .featured-product-card,
  .more-product-card {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  
  /* Remove hover effects on touch */
  @media (hover: none) and (pointer: coarse) {
    .catalogue-card:hover,
    .featured-product-card:hover,
    .more-product-card:hover {
      transform: none;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }
    
    .catalogue-card:active,
    .featured-product-card:active,
    .more-product-card:active {
      transform: scale(0.98);
      transition-duration: 0.1s;
    }
  }
  
  /* Optimize during scroll */
  body.is-scrolling .product-card,
  body.is-scrolling .more-product-card,
  body.is-scrolling .featured-product-card {
    box-shadow: none !important;
  }
  
  /* Contain layout calculations */
  .more-products-grid {
    contain: layout;
  }
  
  .featured-products {
    contain: layout style;
  }
  
  /* Touch feedback */
  .touching {
    transform: scale(0.98) !important;
    opacity: 0.9 !important;
    transition: transform 0.1s ease-out !important;
  }
  
  /* Loading states */
  .catalogue-card.loading {
    pointer-events: none;
    opacity: 0.6;
  }
  
  .catalogue-card.loading .catalogue-title::after {
    content: "⟳";
    animation: rotate 1s linear infinite;
  }
  
  @keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }
}

/* ===================================
   9. SMALL PHONE STYLES (max-width: 375px)
   =================================== */
@media (max-width: 375px) {
  .shop-by-catalogue {
    padding: 25px 0;
  }
  
  .shop-by-catalogue .container {
    padding: 0 10px;
  }
  
  .catalogue-main-title {
    font-size: 1.3rem;
    margin-bottom: 16px;
  }
  
  .catalogue-grid {
    gap: 8px;
  }
  
  .featured-catalogue-card {
    padding: 16px;
  }
  
  .featured-brand {
    font-size: 1.75rem;
  }
  
  .featured-tagline {
    font-size: 0.875rem;
  }
  
  .featured-cta {
    padding: 10px 24px;
    font-size: 0.8rem;
  }
  
  .featured-image {
    height: 150px;
  }
  
  .featured-products {
    gap: 8px;
  }
  
  .featured-product-card {
    flex: 0 0 95px;
    padding: 5px;
  }
  
  .product-price {
    font-size: 0.8rem;
  }
  
  .product-original {
    font-size: 0.7rem;
  }
  
  /* Regular cards */
  .catalogue-card {
    grid-template-columns: 80px 1fr;
    min-height: 80px;
  }
  
  .catalogue-image {
    width: 80px;
    height: 80px;
  }
  
  .catalogue-title {
    font-size: 0.85rem;
    padding: 12px;
  }
  
  .catalogue-title::before {
    font-size: 1rem;
    margin-right: 6px;
  }
  
  /* More products */
  .more-title {
    font-size: 1.1rem;
    margin-bottom: 20px;
  }
  
  .more-products-grid {
    gap: 10px;
  }
  
  .more-product-info {
    padding: 8px;
  }
  
  .more-product-title {
    font-size: 0.75rem;
  }
  
  .more-product-price {
    font-size: 0.9rem;
  }
  
  .load-more-btn {
    padding: 12px 30px;
    font-size: 0.8rem;
  }
}

/* ===================================
   10. VERY SMALL PHONES (max-width: 360px)
   =================================== */
@media (max-width: 360px) {
  .featured-products {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 8px;
    grid-template-columns: unset;
  }
  
  .featured-product-card {
    flex: 0 0 90px;
  }
  
  .more-products-grid {
    gap: 8px;
  }
}

/* ===================================
   11. LANDSCAPE ORIENTATION
   =================================== */
@media (max-width: 768px) and (orientation: landscape) {
  .shop-by-catalogue {
    padding: 25px 0;
  }
  
  .catalogue-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .featured-catalogue-card {
    grid-column: span 2;
    padding: 20px;
  }
  
  .featured-brand {
    font-size: 1.5rem;
  }
  
  .featured-image {
    height: 120px;
  }
  
  .featured-products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow-x: visible;
  }
  
  .catalogue-card {
    min-height: 80px;
  }
  
  .more-products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===================================
   12. ACCESSIBILITY
   =================================== */
@media (max-width: 768px) {
  /* Focus states */
  .catalogue-card:focus,
  .featured-product-card:focus,
  .more-product-card:focus,
  .featured-cta:focus,
  .load-more-btn:focus {
    outline: 2px solid #1a8917;
    outline-offset: 2px;
  }
  
  /* High contrast mode */
  @media (prefers-contrast: high) {
    .catalogue-card,
    .featured-product-card,
    .more-product-card {
      border: 2px solid currentColor;
    }
    
    .catalogue-title::after {
      font-weight: bold;
    }
  }
  
  /* Reduced motion */
  @media (prefers-reduced-motion: reduce) {
    * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
    
    .featured-products {
      scroll-behavior: auto;
    }
  }
  
  /* Touch targets */
  .catalogue-card,
  .featured-cta,
  .featured-product-card,
  .more-product-card,
  .load-more-btn {
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
  }
}