/* ============================================================
   MOC Store — Mobile App Experience (< 992px)
   ============================================================ */

@media (max-width: 991.98px) {
  /* --- Layout & safe areas --- */
  body.mocbt-store-body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
  }

  body.mocbt-store-body.mocbt-page-loading {
    cursor: wait;
  }

  .mocbt-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9999;
    background: rgba(37, 99, 235, 0.15);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  .mocbt-page-loader.is-active {
    opacity: 1;
  }

  .mocbt-page-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: var(--primary-blue);
    animation: mocbt-loader-bar 0.9s ease-in-out infinite;
  }

  @keyframes mocbt-loader-bar {
    0% { left: -40%; }
    100% { left: 100%; }
  }

  .container--mobile-flush {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* --- Mobile sticky header --- */
  .mocbt-mobile-top {
    position: sticky;
    top: 0;
    z-index: 1045;
    background: #fff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.06);
  }

  .mocbt-mobile-top__bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem 0.35rem;
  }

  .mocbt-mobile-top__brand {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
  }

  .mocbt-mobile-top__logo {
    height: 34px !important;
    width: auto;
    max-width: 140px;
    object-fit: contain;
  }

  .mocbt-mobile-top__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: #f1f5f9;
    border-radius: 12px;
    color: #334155;
    font-size: 1rem;
    text-decoration: none;
    transition: transform 0.15s, background 0.15s;
  }

  .mocbt-mobile-top__icon:active {
    transform: scale(0.92);
    background: #e2e8f0;
  }

  .mocbt-mobile-top__search {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 1rem 0.65rem;
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
  }

  .mocbt-mobile-top__search i {
    color: #94a3b8;
    font-size: 0.95rem;
  }

  .mocbt-mobile-top__search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
  }

  .mocbt-search-results {
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: calc(108px + env(safe-area-inset-top, 0));
    z-index: 1046;
    max-height: 60vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15);
  }

  /* --- Bottom navigation --- */
  .mocbt-mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
  }

  .mocbt-mobile-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    padding: 0.35rem 0.15rem;
    font-size: 0.62rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    border: none;
    background: transparent;
    transition: color 0.2s, transform 0.15s;
    cursor: pointer;
    font-family: inherit;
  }

  .mocbt-mobile-nav__item i {
    font-size: 1.2rem;
    transition: transform 0.2s;
  }

  .mocbt-mobile-nav__item.is-active {
    color: var(--primary-blue);
  }

  .mocbt-mobile-nav__item.is-active i {
    transform: scale(1.08);
  }

  .mocbt-mobile-nav__item:active {
    transform: scale(0.94);
  }

  /* --- Slide drawer --- */
  .mocbt-mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 1055;
    pointer-events: none;
    visibility: hidden;
  }

  .mocbt-mobile-drawer.is-open {
    pointer-events: auto;
    visibility: visible;
  }

  .mocbt-mobile-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mocbt-mobile-drawer.is-open .mocbt-mobile-drawer__backdrop {
    opacity: 1;
  }

  .mocbt-mobile-drawer__panel {
    position: absolute;
    top: 0;
    left: 0;
    width: min(320px, 88vw);
    height: 100%;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 4px 0 32px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
  }

  .mocbt-mobile-drawer.is-open .mocbt-mobile-drawer__panel {
    transform: none;
  }

  .mocbt-mobile-drawer__head {
    position: relative;
    padding: 1.5rem 1.25rem 1.25rem;
    background: var(--primary-blue);
    color: #fff;
  }

  .mocbt-mobile-drawer__close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.1rem;
  }

  .mocbt-mobile-drawer__logo-img {
    height: 42px !important;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    filter: brightness(0) invert(1);
  }

  .mocbt-mobile-drawer__logo-img.is-fallback {
    filter: none;
    border-radius: 8px;
  }

  .mocbt-mobile-drawer__tagline {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-top: 0.35rem;
  }

  .mocbt-mobile-drawer__account {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
  }

  .mocbt-mobile-drawer__account-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
  }

  .mocbt-mobile-drawer__account-btn {
    margin-left: auto;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: var(--primary-blue);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
  }

  .mocbt-mobile-drawer__section {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
  }

  .mocbt-mobile-drawer__section--muted {
    margin-top: auto;
    background: #fafafa;
  }

  .mocbt-mobile-drawer__section-title {
    padding: 0.65rem 1.25rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
  }

  .mocbt-mobile-drawer__section a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.25rem;
    color: #334155;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: background 0.15s;
  }

  .mocbt-mobile-drawer__section a i {
    width: 20px;
    text-align: center;
    color: var(--primary-blue);
  }

  .mocbt-mobile-drawer__section a:active {
    background: #f8fafc;
  }

  /* --- Mobile footer (credit only) --- */
  .mocbt-footer__mobile {
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0));
    background: #f8fafc;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
  }

  .mocbt-footer__mobile .mocbt-brand-credit {
    border-top: none;
    background: transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.72rem;
  }

  .mocbt-footer__mobile .mocbt-brand-credit__label {
    font-size: 0.62rem;
  }

  .mocbt-footer__mobile .mocbt-brand-credit__link {
    font-size: 0.75rem;
  }

  /* --- Home app layout --- */
  .mocbt-home--app {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
  }

  .mocbt-home-block--hero { order: 1; }
  .mocbt-home-block--categories { order: 2; }
  .mocbt-home-block--flash { order: 3; }
  .mocbt-home-block--new { order: 4; }
  .mocbt-home-block--trending { order: 5; }
  .mocbt-home-block--uploads { order: 6; }
  .mocbt-home-block--recent { order: 7; }

  .mocbt-home-section {
    padding: 0.85rem 0;
    background: #fff;
    margin-bottom: 0.5rem;
  }

  .mocbt-home-block--hero {
    background: #fff;
    margin-bottom: 0.5rem;
  }

  .mocbt-app-section {
    padding: 0.85rem 0;
    background: #fff;
  }

  .mocbt-app-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem 0.65rem;
    gap: 0.5rem;
  }

  .mocbt-section-head.mocbt-app-section__head {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .mocbt-app-section__title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
    color: #0f172a;
  }

  .mocbt-app-section__link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary-blue);
    text-decoration: none;
    white-space: nowrap;
  }

  .mocbt-section-sub {
    font-size: 0.78rem;
    margin: 0.15rem 0 0;
  }

  /* Category horizontal scroll */
  .mocbt-cat-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0 1rem 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mocbt-cat-scroll::-webkit-scrollbar {
    display: none;
  }

  .mocbt-cat-chip {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 72px;
    text-decoration: none;
    scroll-snap-align: start;
    transition: transform 0.15s;
  }

  .mocbt-cat-chip:active {
    transform: scale(0.94);
  }

  .mocbt-cat-chip__icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #eff6ff;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border: 1px solid rgba(37, 99, 235, 0.12);
  }

  .mocbt-cat-chip__label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #475569;
    text-align: center;
    line-height: 1.2;
    max-width: 72px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  /* Hero on mobile */
  .mocbt-hero-swiper--app {
    border-radius: 16px !important;
    min-height: 180px;
  }

  .mocbt-hero-swiper--app .swiper-pagination-bullet {
    width: 6px;
    height: 6px;
    opacity: 0.5;
  }

  .mocbt-hero-swiper--app .swiper-pagination-bullet-active {
    width: 18px;
    border-radius: 4px;
    opacity: 1;
    background: var(--primary-blue);
  }

  .mocbt-skeleton--hero {
    min-height: 180px !important;
  }

  /* Product rails — app style */
  .mocbt-product-rail-wrap--app {
    margin: 0 -0.25rem;
  }

  .mocbt-product-rail {
    overflow: hidden;
    padding: 0 0.25rem;
  }

  .mocbt-product-rail__item {
    flex: 0 0 168px !important;
    max-width: 168px !important;
  }

  /* Mobile product cards */
  .mocbt-product-card--mobile,
  .mocbt-home--app .mocbt-product-card {
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: transform 0.15s, box-shadow 0.15s;
  }

  .mocbt-product-card--mobile:active,
  .mocbt-home--app .mocbt-product-card:active {
    transform: scale(0.98);
  }

  .mocbt-product-card--mobile .mocbt-product-card__media,
  .mocbt-home--app .mocbt-product-card__media {
    aspect-ratio: 1;
  }

  .mocbt-product-card--mobile .mocbt-product-card__img,
  .mocbt-home--app .mocbt-product-card__img {
    object-fit: contain;
    padding: 0.5rem;
  }

  .mocbt-product-card--mobile .mocbt-product-card__actions,
  .mocbt-home--app .mocbt-product-card__actions {
    display: none;
  }

  .mocbt-product-card--mobile .mocbt-product-card__body,
  .mocbt-home--app .mocbt-product-card__body {
    padding: 0.55rem 0.65rem 0.65rem;
  }

  .mocbt-product-card--mobile .mocbt-product-card__title,
  .mocbt-home--app .mocbt-product-card__title {
    font-size: 0.78rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .mocbt-product-card--mobile .mocbt-product-card__price-current,
  .mocbt-home--app .mocbt-product-card__price-current {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--primary-red);
  }

  .mocbt-product-card--mobile .mocbt-pcard-badges,
  .mocbt-home--app .mocbt-pcard-badges {
    top: 0.4rem;
    left: 0.4rem;
    gap: 0.2rem;
  }

  .mocbt-product-card--mobile .mocbt-pcard-badge,
  .mocbt-home--app .mocbt-pcard-badge {
    font-size: 0.58rem;
    padding: 0.15rem 0.4rem;
  }

  .mocbt-product-card--mobile .mocbt-product-card__order,
  .mocbt-home--app .mocbt-product-card__order {
    font-size: 0.72rem;
    padding: 0.4rem;
    border-radius: 10px;
    margin-top: 0.35rem;
  }

  .mocbt-product-card__mobile-status {
    display: block;
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: center;
    padding: 0.35rem;
  }

  /* Latest uploads grid on mobile */
  .mocbt-uploads-grid--app .col-6 {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .mocbt-uploads-pagination {
    padding: 0 1rem;
  }

  .mocbt-uploads-page-btn {
    font-size: 0.78rem;
    padding: 0.45rem 0.75rem;
  }

  /* Recently viewed horizontal rail */
  .mocbt-recent-rail {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    padding: 0 1rem 0.85rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mocbt-recent-rail::-webkit-scrollbar {
    display: none;
  }

  .mocbt-recent-rail__item {
    flex: 0 0 160px;
    scroll-snap-align: start;
  }

  .mocbt-recent-section {
    background: #fff;
    padding: 0.85rem 0;
    margin-bottom: 0.5rem;
  }

  /* Skeleton shimmer */
  .mocbt-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: mocbt-shimmer 1.4s ease-in-out infinite;
    border-radius: 12px;
  }

  @keyframes mocbt-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  .mocbt-skeleton--card {
    height: 220px !important;
  }

  /* Shop page mobile */
  main.container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .mocbt-page-title {
    font-size: 1.25rem !important;
  }

  .mocbt-shop-sidebar {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top, 0));
  }

  .mocbt-shop-sidebar.is-open {
    transform: none;
  }

  .mocbt-shop-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1049;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .mocbt-shop-sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mocbt-shop-filter-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.82rem;
    font-weight: 600;
  }

  /* Product detail mobile bar */
  .mocbt-pd-mobile-bar {
    display: flex;
    gap: 0.5rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(72px + env(safe-area-inset-bottom, 0));
    z-index: 1035;
    padding: 0.65rem 1rem;
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
  }

  .mocbt-pd-mobile-bar__btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem;
    border: none;
    background: transparent;
    font-size: 0.65rem;
    font-weight: 600;
    color: #64748b;
    transition: transform 0.15s, color 0.15s;
  }

  .mocbt-pd-mobile-bar__btn:active {
    transform: scale(0.92);
  }

  .mocbt-pd-mobile-bar__btn.is-saved {
    color: var(--primary-red);
  }

  .mocbt-pd-mobile-bar__btn i {
    font-size: 1.1rem;
  }

  .mocbt-product-detail {
    padding-bottom: 140px;
  }

  /* Wishlist page */
  .mocbt-wishlist-grid .col-6 {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  /* Page fade-in */
  .mocbt-fade-in {
    animation: mocbt-fade-up 0.35s ease-out;
  }

  @keyframes mocbt-fade-up {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  /* Touch-friendly buttons globally */
  .mocbt-btn {
    min-height: 44px;
  }

  .mocbt-btn--sm {
    min-height: 36px;
  }

  /* Breadcrumb compact */
  .mocbt-breadcrumb {
    font-size: 0.78rem;
    margin-bottom: 0.75rem !important;
  }

  /* Hide chat widget overlap with bottom nav if needed */
  .mocbt-chat-widget {
    bottom: calc(80px + env(safe-area-inset-bottom, 0)) !important;
  }
}

@media (min-width: 992px) {
  .mocbt-mobile-top,
  .mocbt-mobile-nav,
  .mocbt-footer__mobile,
  .mocbt-page-loader {
    display: none !important;
  }

  .mocbt-pd-mobile-bar,
  .mocbt-mobile-drawer {
    display: none !important;
  }
}
