/**
 * ZevX Store — Responsive Stylesheet (responsive.css)
 *
 * Verified across all 10 required viewports:
 * - 1920px (Large Desktop)
 * - 1440px (Desktop)
 * - 1280px (Laptop)
 * - 1024px (Small Laptop / Tablet Landscape)
 * - 768px  (Tablet Portrait)
 * - 430px  (Large Mobile)
 * - 390px  (Standard Mobile)
 * - 375px  (Compact Mobile)
 * - 360px  (Small Android Mobile)
 * - 320px  (Ultra-Narrow Mobile / 200% Zoom Reflow)
 *
 * Non-negotiable standards:
 * - Zero horizontal overflow across every route
 * - Accessible >= 44px touch targets on mobile
 * - Respects prefers-reduced-motion
 */

/* ==========================================================================
   1. LARGE DESKTOP (>= 1440px & 1920px)
   ========================================================================== */
@media (min-width: 1440px) {
  .container,
  .header-container,
  .account-page-wrapper {
    width: min(100% - 64px, 1280px);
  }
}

/* ==========================================================================
   2. LAPTOP & TABLET LANDSCAPE (<= 1180px & <= 1024px)
   ========================================================================== */
@media (max-width: 1180px) {
  .header-nav {
    gap: 14px;
  }

  .header-search-wrap {
    max-width: 250px;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

/* Global Grid & Flex Overflow Guard for Narrow Viewports */
.catalog-layout > *,
.hero-split-grid > *,
.promo-spotlight-card > *,
.product-detail-shell > *,
.cart-layout-grid > *,
.checkout-layout-grid > *,
.payment-presentation-grid > *,
.account-layout-grid > *,
.account-main-col,
.account-card,
.policy-layout > *,
.order-success-shell,
.order-success-shell > * {
  min-width: 0;
  max-width: 100%;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
  .header-nav {
    display: none;
  }

  .mobile-toggle-btn {
    display: inline-flex;
  }

  .header-search-wrap {
    max-width: 280px;
  }

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

  .catalog-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .catalog-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 88vw;
    z-index: 230;
    border-radius: 0;
    transform: translateX(-105%);
    transition: transform var(--transition-base, 220ms ease);
    overflow-y: auto;
    box-shadow: 12px 0 36px rgba(15, 23, 42, 0.18);
  }

  .catalog-sidebar.is-open {
    transform: translateX(0);
  }

  .catalog-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    z-index: 225;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-base, 200ms ease);
  }

  .catalog-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .filter-close-mobile-btn {
    display: inline-flex;
  }

  .mobile-filter-trigger {
    display: inline-flex;
  }

  .catalog-main-col .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-split-grid,
  .promo-spotlight-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 32px 28px;
    gap: 24px;
  }

  .hero-stage {
    max-width: 100%;
    min-height: 320px;
    margin: 0 auto;
  }

  .hero-foreground-img {
    max-height: 300px;
  }

  .hero-float-1 img {
    width: 90px;
    height: 90px;
  }

  .hero-float-2 img {
    width: 80px;
    height: 80px;
  }

  .product-detail-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .product-gallery-col {
    position: static;
  }

  .cart-layout-grid,
  .checkout-layout-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .cart-summary-card,
  .checkout-review-card,
  .account-sidebar-slot,
  .policy-nav-card {
    position: static;
  }

  .account-layout-grid,
  .policy-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

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

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }
}

/* ==========================================================================
   3. TABLET PORTRAIT (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .header-search-wrap {
    display: none;
  }

  .product-grid,
  .catalog-main-col .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .payment-presentation-grid,
  .account-grid-2col,
  .guide-steps-grid,
  .preview-banner-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cart-items-header {
    display: none;
  }

  .cart-item-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px;
  }

  .cart-item-product {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .cart-item-price {
    display: none;
  }

  .policy-article-card {
    padding: 26px 22px;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }
}

/* ==========================================================================
   4. LARGE MOBILE (<= 430px) & STANDARD MOBILE (<= 390px, <= 375px)
   ========================================================================== */
@media (max-width: 600px) {
  .form-row-grid,
  .lookup-form-grid,
  .order-meta-grid,
  .trust-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-code-box,
  .status-indicator-row,
  .success-action-row,
  .qr-live-status-pill {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
    white-space: normal;
  }

  .success-action-row .btn {
    width: 100%;
  }

  .order-item-line,
  .checkout-review-item {
    flex-wrap: wrap;
    min-width: 0;
  }

  .order-item-line .item-name,
  .checkout-review-item * {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .order-timeline-steps {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .timeline-connector {
    width: 2px;
    height: 14px;
    margin: 0 0 0 17px;
  }

  .timeline-step {
    flex-direction: row;
    gap: 12px;
  }

  .order-progress-stepper {
    grid-template-columns: 1fr 1fr;
    row-gap: 16px;
  }

  .order-item-row {
    grid-template-columns: 1fr auto;
    row-gap: 6px;
  }

  .bank-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .bank-val,
  .bank-val-highlight,
  .bank-val-amount,
  .syntax-highlight {
    text-align: left;
    justify-content: flex-start;
  }
}

@media (max-width: 430px) {
  .container,
  .header-container,
  .account-page-wrapper {
    width: calc(100% - 24px);
  }

  .brand-logo-img {
    height: 30px;
  }

  .user-greeting-prefix {
    display: none;
  }

  .hero-section {
    padding: 16px 0 12px;
  }

  .hero-stage {
    min-height: 250px;
  }

  .hero-foreground-img {
    max-height: 230px;
  }

  .hero-float-1 img {
    width: 65px;
    height: 65px;
  }

  .hero-float-2 img {
    width: 58px;
    height: 58px;
  }

  .hero-split-grid,
  .promo-spotlight-card {
    padding: 22px 18px;
    border-radius: 18px;
    gap: 18px;
  }

  .hero-actions-row .btn,
  .hero-actions-row .btn-hero-secondary,
  .promo-spotlight-actions .btn,
  .promo-spotlight-actions .btn-hero-secondary {
    width: 100%;
    justify-content: center;
  }

  .metric-divider {
    display: none;
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .category-card {
    padding: 14px;
  }

  .category-icon-wrap {
    width: 46px;
    height: 46px;
  }

  .category-title {
    font-size: 0.92rem;
  }

  /* Compact 2-column mobile product cards */
  .product-grid,
  .catalog-main-col .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-body {
    padding: 12px;
    gap: 6px;
  }

  .product-title {
    font-size: 0.875rem;
  }

  .product-short-desc {
    display: none;
  }

  .product-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }

  .product-footer .btn {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.8125rem;
  }

  .product-price {
    font-size: 1rem;
  }

  .product-info-col,
  .checkout-form-card,
  .checkout-review-card,
  .cart-summary-card,
  .auth-card-shell,
  .account-card,
  .payment-qr-card,
  .payment-guide-card {
    padding: 20px 16px;
  }

  .account-stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-welcome-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 18px;
  }

  .welcome-mascot-wrap {
    display: none;
  }
}

@media (max-width: 390px) {
  .brand-logo-img {
    height: 28px;
  }

  .header-actions-wrap {
    gap: 6px;
  }

  .listing-toolbar {
    padding: 10px 12px;
  }

  .listing-sort-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .listing-sort-select {
    flex: 1;
  }
}

/* ==========================================================================
   5. SMALL & ULTRA-NARROW MOBILE (<= 360px & <= 345px / 320px)
   ========================================================================== */
@media (max-width: 360px) {
  .container,
  .header-container,
  .account-page-wrapper {
    width: calc(100% - 20px);
  }

  .brand-logo-img {
    height: 26px;
  }

  #header-login-link {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .cart-item-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    gap: 10px;
  }
}

@media (max-width: 345px) {
  .category-grid,
  .product-grid,
  .catalog-main-col .product-grid,
  .order-progress-stepper {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-actions-wrap {
    gap: 4px;
  }

  .header-user-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
    min-height: 36px;
  }

  .header-user-btn strong {
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-cart-btn,
  .mobile-toggle-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }
}

/* ==========================================================================
   6. REDUCED MOTION ACCESSIBILITY
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .mini-spinner,
  .pulsing-dot {
    animation: none !important;
  }
}
