/* ==========================================================================
   LOKA MARKET - Dedicated Mobile Experience CSS (mobile.css)
   Tailored for High-End Native App Feel on iOS and Android Devices
   ========================================================================== */

@media (max-width: 768px) {

  /* 1. Mobile Ergonomics & Global Reset */
  *, *::before, *::after, html, body, button, input, select, textarea, label, span, p, h1, h2, h3, h4, h5, h6, a {
    font-family: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  }
  html, body {
    overflow-x: hidden !important;
    width: 100%;
  }

  * {
    -webkit-tap-highlight-color: transparent;
  }

  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 12px)) !important;
    background-color: #FBF8F5;
  }

  /* 2. Mobile App Header */
  .site-header {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid #ECE6DF;
  }

  .main-header {
    padding: 8px 0 10px 0;
  }

  .main-header-inner {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 10px;
  }

  .mobile-menu-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background-color: var(--brand-cream);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-dark);
    order: 1;
  }

  .mobile-menu-toggle:active {
    transform: scale(0.92);
    background-color: var(--brand-orange-light);
  }

  .header-logo-wrap {
    order: 2;
    justify-content: center;
    margin: 0 auto;
  }

  .brand-logo-img {
    height: 36px !important;
    max-width: 140px;
  }

  .header-actions {
    order: 3;
    justify-content: flex-end;
  }

  .header-cart-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    justify-content: center;
    background-color: var(--brand-cream);
    border: 1px solid var(--border);
  }

  .header-cart-btn .cart-icon-container {
    width: 24px;
    height: 24px;
  }

  .header-cart-btn .cart-icon-container svg {
    width: 22px;
    height: 22px;
  }

  .header-cart-btn .cart-badge {
    top: -2px;
    left: -2px;
    min-width: 18px;
    height: 18px;
    font-size: 0.68rem;
  }

  .header-search-wrap {
    grid-column: 1 / -1;
    order: 4;
    margin-top: 4px;
  }

  .search-form {
    background-color: #FFFFFF;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 3px 6px 3px 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  }

  .search-input {
    font-size: 0.88rem;
    padding: 7px 8px;
  }

  .search-btn {
    width: 34px;
    height: 34px;
  }

  .search-btn svg {
    width: 16px;
    height: 16px;
  }

  /* 3. Mobile Hero Section */
  .hero-section {
    padding: 12px 0 8px 0;
  }

  .hero-banner-card {
    border-radius: 18px;
    border: 1px solid #F2DFCC;
    background: linear-gradient(145deg, #FFF6ED 0%, #FFEEDD 100%);
    box-shadow: 0 3px 12px rgba(244, 122, 0, 0.08);
  }

  .hero-content {
    padding: 22px 16px;
  }

  .hero-tag-wrap {
    gap: 6px;
    margin-bottom: 10px;
  }

  .hero-tag {
    font-size: 0.72rem;
    padding: 4px 10px;
  }

  .hero-subtag {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .hero-title {
    font-size: 1.45rem;
    line-height: 1.25;
    margin-bottom: 8px;
  }

  .hero-desc {
    font-size: 0.86rem;
    line-height: 1.4;
    margin-bottom: 14px;
  }

  .hero-features-chips {
    gap: 6px;
    margin-bottom: 16px;
  }

  .hero-chip {
    font-size: 0.72rem;
    padding: 4px 8px;
  }

  .hero-btn-group {
    gap: 8px;
  }

  .hero-btn-group .btn-primary,
  .hero-btn-group .btn-secondary {
    padding: 9px 18px;
    font-size: 0.86rem;
  }

  .hero-media {
    height: 170px;
  }

  .hero-floating-card {
    padding: 6px 10px;
    gap: 6px;
    border-radius: 10px;
  }

  .hero-floating-card.top-badge {
    top: 10px;
    left: 10px;
  }

  .hero-floating-card.bottom-badge {
    bottom: 10px;
    right: 10px;
  }

  .floating-icon {
    width: 26px;
    height: 26px;
    font-size: 0.95rem;
  }

  .floating-info strong {
    font-size: 0.76rem;
  }

  .floating-info span {
    font-size: 0.65rem;
  }

  /* 4. Horizontal Category Circles (Stories Bar Feel) */
  .categories-grid {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px !important;
    padding: 4px 0 14px 0;
    margin-bottom: 20px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .categories-grid::-webkit-scrollbar {
    display: none;
  }

  .category-card {
    flex: 0 0 84px !important;
    scroll-snap-align: start;
    padding: 10px 4px !important;
    border-radius: 16px !important;
    background-color: #FFFFFF;
    border: 1px solid #ECE7E1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  }

  .category-card:active {
    transform: scale(0.94);
  }

  .category-thumb-wrap {
    width: 56px !important;
    height: 56px !important;
    border: 2px solid #FFF3E6;
    background: #FFF9F2;
  }

  .category-label {
    font-size: 0.75rem !important;
    line-height: 1.2;
    margin-top: 4px;
    font-weight: 700;
  }

  /* 5. Mobile Product Cards & Carousels (Snap Scroll Peek) */
  .section-title-wrap {
    margin-bottom: 12px;
  }

  .section-title {
    font-size: 1.18rem;
  }

  .view-all-link {
    font-size: 0.82rem;
  }

  .carousel-wrapper {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    overflow: hidden;
  }

  .carousel-track {
    display: flex;
    gap: 10px !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 6px 4px 14px 4px !important;
    -webkit-overflow-scrolling: touch;
  }

  .carousel-nav-btn {
    display: none !important;
  }

  /* 2-Cards Per Row / Snap Peek on Mobile */
  .product-card {
    flex: 0 0 calc(46% - 5px) !important;
    min-width: 152px !important;
    max-width: 180px;
    scroll-snap-align: start;
    padding: 10px !important;
    border-radius: 16px !important;
    border: 1px solid #ECE7E1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden !important;
  }

  .product-card:active {
    transform: scale(0.98);
  }

  .product-badge-wrap {
    top: 8px;
    right: 8px;
    gap: 3px;
  }

  .product-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
  }

  .wishlist-btn {
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
  }

  .wishlist-btn svg {
    width: 14px;
    height: 14px;
  }

  .product-img-wrap {
    width: calc(100% + 20px) !important;
    margin: -10px -10px 10px -10px !important;
    height: 145px !important;
    padding: 0 !important;
    background-color: #F8F5F0 !important;
  }

  .product-img-wrap img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
  }

  .product-category-tag {
    font-size: 0.68rem;
    margin-bottom: 2px;
  }

  .product-title {
    font-size: 0.82rem !important;
    line-height: 1.3;
    height: 2.6em;
    margin-bottom: 4px;
  }

  .product-rating {
    font-size: 0.72rem;
    margin-bottom: 6px;
  }

  .product-pricing-wrap {
    padding-top: 6px;
    gap: 4px;
  }

  .current-price {
    font-size: 0.98rem !important;
  }

  .current-price .currency {
    font-size: 0.72rem;
  }

  .old-price {
    font-size: 0.72rem;
  }

  /* Thumb-Friendly Quantity Controls */
  .card-add-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 1.2rem;
  }

  .card-add-btn:active {
    transform: scale(0.88);
  }

  .card-qty-controller {
    padding: 2px 4px !important;
    gap: 5px !important;
  }

  .card-qty-controller .qty-btn {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.85rem;
  }

  .card-qty-controller .qty-number {
    font-size: 0.85rem;
    min-width: 14px;
  }

  /* Hide Desktop Quick View Trigger on Touch */
  .quick-view-trigger {
    display: none !important;
  }

  /* 6. Promotional Mid-Banner on Mobile */
  .promo-mid-banner {
    margin: 20px auto;
    width: 100%;
    padding: 0 12px;
  }

  .promo-banner-inner {
    flex-direction: column;
    border-radius: 20px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }

  .promo-banner-text {
    padding: 24px 18px 20px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .promo-banner-text h3 {
    font-size: 1.35rem;
  }

  .promo-banner-text p {
    font-size: 0.88rem;
    max-width: 100%;
    margin-bottom: 18px;
  }

  .promo-banner-media {
    height: 150px;
    width: 100%;
    max-width: 100%;
  }

  /* 7. Category Page on Mobile (Bottom Sheet Filters & 2-Col Grid) */
  .category-page-header {
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 14px;
  }

  .category-page-title-wrap h1 {
    font-size: 1.3rem;
  }

  /* Mobile Listing Toolbar */
  .listing-toolbar {
    padding: 10px 14px !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
  }

  .results-count {
    font-size: 0.85rem !important;
    white-space: nowrap !important;
  }

  .sort-select {
    padding: 5px 8px !important;
    font-size: 0.82rem !important;
  }

  .sort-label {
    font-size: 0.8rem !important;
  }

  .view-modes-group {
    display: none !important;
  }

  .mobile-filter-btn {
    display: inline-flex !important;
    padding: 8px 14px;
    border-radius: 12px;
    background-color: var(--brand-orange-light);
    border: 1px solid var(--brand-orange);
    color: var(--brand-orange-hover);
    font-size: 0.84rem;
  }

  .filter-sidebar.mobile-open {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 1200;
    background-color: #FFFFFF;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)) 16px;
    overflow-y: auto;
    border-radius: 0;
    animation: slideUpModal 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  @keyframes slideUpModal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .products-grid .product-card {
    min-width: unset !important;
    max-width: unset !important;
    flex: unset !important;
  }

  /* 8. Product Details Page on Mobile */
  .product-details-layout {
    padding: 16px;
    border-radius: 18px;
    gap: 18px;
  }

  .main-image-viewport {
    height: 240px !important;
    border-radius: 14px;
  }

  .gallery-thumb {
    width: 58px;
    height: 58px;
  }

  .detail-product-title {
    font-size: 1.3rem;
  }

  .product-buy-col {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .detail-price {
    font-size: 1.7rem;
  }

  .bundle-box {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .bundle-box h3 {
    font-size: 1.15rem;
  }

  /* 9. Mobile Cart & WhatsApp Checkout */
  .cart-page-layout {
    gap: 16px;
  }

  .delivery-progress-card {
    padding: 14px 16px;
    border-radius: 14px;
  }

  .delivery-progress-header {
    font-size: 0.85rem;
  }

  .cart-item-row {
    padding: 12px;
    border-radius: 14px;
  }

  .cart-item-thumb {
    width: 60px;
    height: 60px;
  }

  .cart-item-title {
    font-size: 0.9rem;
  }

  .order-summary-card {
    padding: 18px 16px;
    border-radius: 16px;
  }

  /* Mobile Sticky Bottom Checkout Bar */
  .mobile-sticky-checkout {
    display: flex !important;
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
    z-index: 750;
    align-items: center;
    justify-content: space-between;
  }

  .mobile-sticky-checkout .total-amount {
    font-size: 1.15rem;
  }

  .mobile-sticky-checkout .btn-whatsapp-checkout {
    padding: 10px 18px;
    font-size: 0.92rem;
    border-radius: 12px;
  }

  /* 10. Native Mobile Bottom App Navigation Bar */
  .mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background-color: #FFFFFF;
    border-top: 1px solid #ECE7E1;
    display: flex !important;
    align-items: center;
    justify-content: space-around;
    z-index: 900;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.06);
  }

  .bottom-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #777777;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    flex: 1;
    height: 100%;
    transition: var(--transition);
  }

  .bottom-bar-item:active {
    transform: scale(0.92);
  }

  .bottom-bar-item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
  }

  .bottom-bar-item.active,
  .bottom-bar-item:hover {
    color: var(--brand-orange);
  }

  .bottom-bar-cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .bottom-cart-badge {
    position: absolute;
    top: -6px;
    left: -8px;
    min-width: 16px;
    height: 16px;
    font-size: 0.65rem;
    padding: 0 3px;
  }

  /* 11. Toast positioning on Mobile */
  #lokaToast {
    bottom: calc(64px + env(safe-area-inset-bottom, 10px)) !important;
    right: 16px !important;
    left: 16px !important;
    max-width: unset !important;
    font-size: 0.85rem !important;
    padding: 10px 14px !important;
  }

  /* 12. Floating Back-to-Top on Mobile: Hiding it to avoid blocking bottom app bar */
  .back-to-top-btn {
    display: none !important;
  }

  /* 13. Deals Timer on Mobile */
  .deals-timer-wrap {
    padding: 3px 10px;
    font-size: 0.76rem;
  }

  .timer-digits {
    font-size: 0.85rem;
  }

  /* 14. Floating WhatsApp on Mobile (Left Side) */
  .floating-whatsapp-wrap {
    bottom: calc(68px + env(safe-area-inset-bottom, 8px)) !important;
    left: 16px !important;
    right: auto !important;
    align-items: flex-start !important;
  }

  .floating-whatsapp-btn {
    width: 50px !important;
    height: 50px !important;
  }

  .wa-fab-icon {
    width: 28px !important;
    height: 28px !important;
  }

  .whatsapp-bubble {
    width: calc(100vw - 32px) !important;
    left: 0 !important;
    right: auto !important;
    bottom: 62px !important;
  }
}

/* Hide Mobile App Bar on Desktop & Tablet Screens */
@media (min-width: 769px) {
  .mobile-bottom-bar {
    display: none !important;
  }
}
