/* ============================================================
   EAZYMART PREMIUM - Mobile Interface
   Blinkit/Instamart-inspired mobile experience
   Bottom nav | Floating cart | Smooth animations
   Applied: Mobile-first (< 768px)
============================================================ */

/* ==================== MOBILE LAYOUT BASE ==================== */
@media (max-width: 767px) {
  
  body {
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-4));
  }

  /* ==================== STICKY HEADER (Mobile) ==================== */
  .sticky-mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height-mobile);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    transition: transform var(--duration-base) var(--ease-out);
  }

  /* Hide header on scroll down (Blinkit behavior) */
  .sticky-mobile-header.hidden {
    transform: translateY(-100%);
  }

  /* Logo in header */
  .mobile-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    object-fit: contain;
    flex-shrink: 0;
  }

  /* ==================== SEARCH BAR (Mobile) ==================== */
  .search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    border: 1px solid transparent;
    transition: all var(--duration-fast) var(--ease-out);
  }

  .search-bar:focus-within {
    background-color: var(--bg-primary);
    border-color: var(--brand-gold);
    box-shadow: var(--shadow-sm);
  }

  .search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-size: var(--text-sm);
    color: var(--text-primary);
  }

  .search-bar input:focus {
    outline: none;
    box-shadow: none;
  }

  .search-bar input::placeholder {
    color: var(--text-tertiary);
  }

  .search-icon {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
  }

  /* ==================== CATEGORY STRIP (Horizontal Scroll) ==================== */
  .category-strip {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    margin-top: var(--header-height-mobile);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-strip::-webkit-scrollbar {
    display: none;
  }

  .category-icon-item {
    flex: 0 0 auto;
    width: 72px;
    text-align: center;
    scroll-snap-align: start;
    cursor: pointer;
  }

  .category-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-1);
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-out);
    border: 2px solid transparent;
  }

  .category-icon-item.active .category-icon {
    border-color: var(--brand-gold);
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
  }

  .category-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
  }

  .category-label {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    line-height: 1.2;
  }

  .category-icon-item.active .category-label {
    color: var(--brand-blue);
    font-weight: var(--font-bold);
  }

  /* ==================== PRODUCT SECTION ==================== */
  .product-row-container {
    margin: var(--space-4) 0;
  }

  .product-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-3);
  }

  .product-row-title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
  }

  .view-all-link {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--brand-blue);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  /* ==================== PRODUCT ROW (Horizontal Scroll) ==================== */
  .product-row-list {
    display: flex;
    gap: var(--space-3);
    padding: 0 var(--space-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .product-row-list::-webkit-scrollbar {
    display: none;
  }

  .product-row-item {
    flex: 0 0 auto;
    width: var(--card-width-mobile);
    scroll-snap-align: start;
  }

  /* ==================== PRODUCT CARD (Blinkit Style) ==================== */
  .product-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all var(--duration-fast) var(--ease-out);
    border: 1px solid var(--border-light);
  }

  .product-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-xs);
  }

  /* Product image container */
  .product-card-image-container {
    position: relative;
    height: var(--card-image-height-mobile);
    padding: var(--space-2);
    background-color: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--duration-base) var(--ease-out);
  }

  /* Discount badge */
  .discount-badge {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    background-color: var(--accent-green);
    color: white;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    line-height: 1;
    z-index: 1;
  }

  /* Deal badge */
  .deal-badge {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    line-height: 1;
    z-index: 1;
  }

  /* Out of stock overlay */
  .out-of-stock-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
  }

  .out-of-stock-text {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--accent-red);
    text-transform: uppercase;
  }
  /* FIX: Remove empty space at top on mobile */
@media (max-width: 767px) {
  body {
    margin: 0 !important;
    padding-top: 0 !important;
  }
  
  .main-content-area-mobile {
    margin-top: var(--header-height-mobile) !important;
    padding-top: 0 !important;
  }
  
  /* Fix category strip spacing */
  .category-strip {
    margin-top: 0 !important;
    padding-top: var(--space-3);
  }
  
  /* Remove any inherited spacing */
  .sticky-mobile-header + * {
    margin-top: 0 !important;
  }
}

  /* Product details */
  .product-card-body {
    padding: var(--space-3);
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .product-card-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .product-card-unit {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
  }

  /* Price section */
  .product-price-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: auto;
  }

  .product-price {
    font-size: var(--text-lg);
    font-weight: var(--font-extrabold);
    color: var(--brand-blue);
  }

  .product-old-price {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    text-decoration: line-through;
  }

  /* ==================== ADD TO CART BUTTON ==================== */
  .quantity-area-row {
    position: absolute;
    bottom: var(--space-3);
    right: var(--space-3);
    z-index: 10;
  }

  .add-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-gold-dark) 100%);
    color: var(--brand-blue);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-lg);
    font-weight: var(--font-extrabold);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
  }

  .add-btn:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-sm);
  }

  /* Quantity controls */
  .quantity-control-card {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background-color: var(--bg-primary);
    padding: 6px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--brand-gold);
  }

  .quantity-btn {
    width: 32px;
    height: 32px;
    background-color: var(--brand-gold);
    color: var(--brand-blue);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
  }

  .quantity-btn:active {
    transform: scale(0.9);
  }

  .quantity-value {
    min-width: 28px;
    text-align: center;
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    color: var(--brand-blue);
  }

  /* ==================== MINI CART BAR (Floating) ==================== */
  .mini-cart-bar {
    position: fixed;
    left: var(--space-3);
    right: var(--space-3);
    bottom: calc(var(--bottom-nav-height) + var(--space-2));
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-light) 100%);
    color: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    z-index: var(--z-mini-cart);
    transform: translateY(0);
    transition: all var(--duration-base) var(--ease-spring);
  }

  .mini-cart-bar.active {
    display: flex;
    animation: slideInUp var(--duration-base) var(--ease-spring);
  }

  @keyframes slideInUp {
    from {
      transform: translateY(120%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .mini-cart-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mini-cart-items {
    font-size: var(--text-xs);
    opacity: 0.9;
  }

  .mini-cart-total {
    font-size: var(--text-xl);
    font-weight: var(--font-extrabold);
  }

  .view-cart-btn {
    background-color: var(--brand-gold);
    color: var(--brand-blue);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-fast) var(--ease-out);
  }

  .view-cart-btn:active {
    transform: scale(0.95);
  }

  /* ==================== BOTTOM NAVIGATION BAR ==================== */
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--bottom-nav-height);
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -4px 16px rgba(4, 40, 83, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: var(--space-2) var(--space-3);
    z-index: var(--z-bottom-nav);
  }

  /* iOS safe area support */
  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
      padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
      height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }
  }

  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-tertiary);
    text-decoration: none;
    flex: 1;
    padding: var(--space-1);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
  }

  .nav-item-icon {
    width: 24px;
    height: 24px;
    transition: transform var(--duration-fast) var(--ease-out);
  }

  .nav-item-label {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
  }

  .nav-item.nav-item-active {
    color: var(--brand-blue);
  }

  .nav-item.nav-item-active .nav-item-icon {
    transform: scale(1.1);
  }

  .nav-item.nav-item-active .nav-item-label {
    font-weight: var(--font-bold);
  }

  /* Cart badge on nav */
  .nav-cart-badge {
    position: absolute;
    top: 0;
    right: 20%;
    background-color: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: var(--font-bold);
    padding: 2px 5px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
  }

  /* ==================== PRODUCT GRID (Shopping page) ==================== */
  .shopping-product-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols-mobile), 1fr);
    gap: var(--grid-gap-mobile);
    padding: var(--space-3);
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-6));
  }

  /* ==================== LOADING STATE ==================== */
  .loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    gap: var(--space-3);
  }

  .loading-spinner {
    width: 40px;
    height: 40px;
  }

  /* ==================== EMPTY STATE ==================== */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
    text-align: center;
    min-height: 60vh;
  }

  .empty-state-icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
  }

  .empty-state-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
  }

  .empty-state-description {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
  }

  /* ==================== PULL TO REFRESH ==================== */
  .pull-to-refresh {
    position: fixed;
    top: var(--header-height-mobile);
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background-color: var(--bg-primary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--brand-blue);
    z-index: calc(var(--z-header) + 1);
    transition: transform var(--duration-base) var(--ease-out);
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .pull-to-refresh.visible {
    transform: translateX(-50%) translateY(var(--space-2));
  }

  /* ==================== TOAST NOTIFICATIONS ==================== */
  .toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--space-4));
    left: var(--space-3);
    right: var(--space-3);
    background-color: var(--brand-blue);
    color: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    z-index: var(--z-toast);
    transform: translateY(120%);
    transition: transform var(--duration-base) var(--ease-spring);
  }

  .toast.show {
    transform: translateY(0);
  }

  .toast.success {
    background-color: var(--accent-green);
  }

  .toast.error {
    background-color: var(--accent-red);
  }

} /* End mobile media query */
