/* Mobile and low-end adaptive layer (authoritative post-app.css overrides) */
:root {
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 900px) {
  html,
  body,
  .store-shell,
  .store-container,
  .page-inner,
  .admin-layout,
  .admin-content {
    overflow-x: clip;
  }

  .store-container,
  .page-inner,
  .admin-content {
    min-width: 0;
  }

  .store-container {
    padding-top: calc(12px + var(--safe-top));
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .hero-stats-box,
  .checkout-grid,
  .checkout-hero,
  .success-layout {
    grid-template-columns: 1fr !important;
  }

  .checkout-page .store-container > div {
    grid-template-columns: 1fr !important;
  }

  .checkout-hero-copy,
  .checkout-hero-card,
  .checkout-summary-card,
  .checkout-form-card,
  .auth-card {
    overflow: hidden;
    min-width: 0;
  }

  .hero-drop-item span,
  .section-title-row h2,
  .topbar h1,
  .pdp-title,
  .spc-title {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .search-form .btn,
  .sort-form .btn,
  .auth-card .btn,
  .checkout-page .pdp-buy-form .btn,
  .checkout-page .btn-buy-now {
    width: 100% !important;
  }

  .category-pills {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

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

@media (max-width: 720px) {
  .store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .spc-body {
    min-height: 0 !important;
    padding: 10px !important;
  }

  .spc-title {
    font-size: 12px !important;
    line-height: 1.25;
  }

  .spc-wishlist-btn {
    top: 10px !important;
    right: 10px !important;
    width: 36px !important;
    height: 36px !important;
  }

  .spc-meta-stack,
  .spc-trust-badge,
  .spc-rating,
  .spc-sizes {
    display: none !important;
  }

  .custom-upload-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .custom-upload-actions .btn {
    width: 100%;
  }

  .pending-upload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 340px) {
  .store-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Heart pulse animation (micro-interaction) */
@keyframes heartPulse {

/* Heart pulse animation (micro-interaction) */
@keyframes heartPulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.28); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.spc-wishlist-btn.active {
  animation: heartPulse 480ms cubic-bezier(0.16, 1, 0.3, 1);
  border-color: rgba(239, 68, 68, 0.95);
  color: rgba(239, 68, 68, 0.95);
}

/* Floating wishlist FAB (mobile) */
.wishlist-fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  color: #fff;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.25);
  z-index: 9999;
  border: none;
  cursor: pointer;
  transition: bottom 0.3s ease, transform 0.3s ease;
}
.wishlist-fab .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 0 6px;
}

/* Move fabs up when sticky mobile buy bar is present */
body:has(.mobile-buy-bar) .wishlist-fab,
body:has(.mobile-buy-bar) .share-fab {
  bottom: calc(96px + var(--safe-bottom)) !important;
}

@media (max-width: 900px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-summary-panel {
    position: static;
  }

  .cart-page-head h1 {
    font-size: clamp(2rem, 9vw, 2.9rem);
  }
}

@media (max-width: 720px) {
  .pdp-action-row {
    flex-direction: column;
    width: 100%;
  }

  .pdp-family-color-list {
    grid-template-columns: 1fr;
  }

  .family-color-link {
    padding: 10px;
  }

  .pdp-buy-form .btn-add-cart,
  .pdp-buy-form .btn-buy-now {
    width: 100%;
  }

  .cart-item-card {
    flex-direction: column;
  }

  .cart-item-media {
    width: 100%;
    max-width: 132px;
    height: 132px;
  }

  .cart-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .cart-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .cart-head-stats {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cart-item-top,
  .cart-item-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cart-line-total {
    justify-items: start;
    min-width: 0;
  }

  .cart-summary-grid {
    grid-template-columns: 1fr;
  }

  .cart-summary-panel {
    padding: 18px;
  }

  .cart-item-card {
    padding: 16px;
  }

  .mobile-buy-bar .mobile-cart-btn {
    flex: 0 0 auto;
    min-width: 88px;
  }
}
@media (max-width: 980px) {
  .wishlist-fab { display: flex; }
}

/* Share FAB (positioned next to wishlist FAB on PDP) */
.share-fab { right: 86px; background: linear-gradient(135deg, #60a5fa, #7dd3fc); }

/* Minor polish */
.store-product-card { transition: transform 260ms ease, box-shadow 260ms ease; }
.store-product-card:active { transform: scale(0.998); }

/* Adaptive performance tier on low-end/mobile contexts */
@media (max-width: 900px), (pointer: coarse) {
  .branding-animation,
  .brand-pulse,
  .success-processing-steps span,
  .flip-card,
  .flip-glow {
    animation: none !important;
  }

  .store-product-card,
  .glass-card,
  .auth-card,
  .store-navbar,
  .store-footer {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* Safe defaults for devices without env() support */
@supports not (padding: env(safe-area-inset-top)) {
  :root { --safe-top: 12px; --safe-bottom: 12px; }
}
