/* BlueMountain Store — global responsive enhancements */

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

img, video {
  max-width: 100%;
  height: auto;
}

/* Prevent horizontal overflow */
body {
  overflow-x: hidden;
}

/* Fluid containers */
.container {
  width: 100%;
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
}

/* Header layout — stack gracefully on small screens */
@media (max-width: 1100px) {
  .main-header .header-inner {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center;
    gap: 12px;
  }
  .main-header .header-main-nav { display: none !important; }
  .main-header .header-right {
    justify-content: flex-end;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .utility-bar .container {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
    font-size: 0.7rem;
  }
  .logo a { font-size: 1rem !important; }
}

/* Footer */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(24px, 4vw, 40px);
}

@media (max-width: 992px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
}

@media (max-width: 576px) {
  .footer-grid { grid-template-columns: 1fr; }
  footer .newsletter-inline-form {
    flex-direction: column;
  }
  footer .newsletter-inline-form input,
  footer .newsletter-inline-form button {
    border-radius: var(--radius-pill) !important;
    width: 100%;
  }
  footer .newsletter-inline-form input { border-right: 1px solid var(--border) !important; margin-bottom: 8px; }
}

/* Shop page */
@media (max-width: 991px) {
  .shop-layout { flex-direction: column !important; }
  .shop-sidebar { width: 100% !important; }
  .products-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .shop-hero-banner { padding: 32px 24px !important; }
}

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

/* Cart & checkout */
@media (max-width: 900px) {
  .cart-grid-responsive { grid-template-columns: 1fr !important; }
}

/* Product detail */
@media (max-width: 900px) {
  .product-detail-grid { grid-template-columns: 1fr !important; }
  .gallery-wrapper { flex-direction: column-reverse !important; }
  .gallery-wrapper .thumbnails {
    flex-direction: row !important;
    width: 100% !important;
    overflow-x: auto;
    gap: 10px !important;
  }
}

/* Blog grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 40px);
}

@media (max-width: 992px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 576px) {
  .blog-grid { grid-template-columns: 1fr !important; }
  .blog-filters { flex-wrap: wrap; gap: 12px !important; justify-content: flex-start !important; }
}

/* Content pages */
.page-content-card {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 576px) {
  .page-content-main { padding: 32px 0 60px; }
  .page-content-card { padding: 24px 18px !important; border-radius: var(--radius) !important; }
}

/* About page */
@media (max-width: 992px) {
  .ab-precision, .ab-footprint-grid { grid-template-columns: 1fr !important; }
  .ab-timeline { grid-template-columns: repeat(2, 1fr) !important; }
  .ab-years { right: 12px !important; bottom: 12px !important; }
}

@media (max-width: 560px) {
  .ab-timeline { grid-template-columns: 1fr !important; }
  .ab-hero-inner { padding: 60px 0 70px !important; }
}

/* Contact page */
@media (max-width: 992px) {
  .ct-grid { grid-template-columns: 1fr !important; }
  .ct-form-row { grid-template-columns: 1fr !important; }
}

/* Home — BlueMountain sections */
@media (max-width: 992px) {
  .tm-hero { padding: 40px 0 56px; }
  .tm-hero-grid { grid-template-columns: 1fr !important; gap: 32px; }
  .tm-hero-visual { order: -1; }
  .tm-brands-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .tm-features-grid { grid-template-columns: 1fr !important; gap: 28px; }
  .tm-promise-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .tm-sec-head { flex-direction: column; align-items: flex-start !important; }
}

@media (max-width: 576px) {
  .tm-brands-grid { grid-template-columns: 1fr !important; }
  .tm-hero-btns { flex-direction: column; width: 100%; }
  .tm-hero-btns a { text-align: center; width: 100%; }
  .tm-hero-badge { left: 12px !important; right: 12px; font-size: 0.75rem; }
  .tm-newsletter-form { flex-direction: column; max-width: 100% !important; padding: 0 8px; }
  .tm-newsletter-form input,
  .tm-newsletter-form button {
    border-radius: var(--radius-pill) !important;
    width: 100%;
  }
  .tm-newsletter-form button { margin-top: 8px; }
  .tm-section { padding: 48px 0; }
}

/* Tables scroll on mobile */
@media (max-width: 600px) {
  .specs-table, table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  .header-icon-link,
  .tm-prod-cart,
  .sp-btn,
  .btn,
  .mobile-bottom-nav a {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Swiper slides equal height */
.swiper-slide { height: auto; }

/* Glowza — full-site responsive polish */

/* Safe areas for notched phones */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-left));
    padding-right: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-right));
  }
  .main-header { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

/* Shop — legacy + BM classes */
@media (max-width: 991px) {
  .bm-shop-layout aside,
  .shop-sidebar { width: 100% !important; }
  .shop-layout { flex-direction: column !important; }
}

@media (max-width: 576px) {
  .bm-shop-top h1 { font-size: 1.45rem; }
  .bm-pagination { flex-wrap: wrap; justify-content: center; gap: 6px; }
  .bm-pagination a,
  .bm-pagination span {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Product detail */
@media (max-width: 900px) {
  .product-detail-grid,
  .bm-pdp-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  .reviews-section > div[style*="grid-template-columns"] {
    display: block !important;
  }
  .reviews-section > div > div:first-child {
    margin-bottom: 32px;
  }
  .gallery-wrapper,
  .bm-gallery-wrap {
    flex-direction: column-reverse !important;
    gap: 16px !important;
  }
  .gallery-wrapper .thumbnails,
  .bm-thumbs {
    flex-direction: row !important;
    width: 100% !important;
    overflow-x: auto;
    gap: 10px !important;
    padding-bottom: 4px;
  }
  .bm-pdp-actions { flex-direction: column; }
  .bm-pdp-actions .btn,
  .bm-pdp-actions button { width: 100%; }
}

/* Cart & checkout */
@media (max-width: 900px) {
  .cart-grid-responsive,
  .bm-cart-grid,
  .checkout-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .bm-cart-grid > div { min-width: 0; }
  .bm-cart-table { min-width: 0 !important; }
  .bm-cart-table thead { display: none; }
  .bm-cart-table tbody, .bm-cart-table tr, .bm-cart-table td { display: block; width: 100%; }
  
  .bm-cart-table tr.cart-item {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-areas: 
      "prod remove"
      "price price"
      "qty total";
    gap: 12px 16px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
  }
  .bm-cart-table td { padding: 0 !important; border: none !important; width: 100% !important; box-sizing: border-box !important; }
  
  .bm-cart-table td:nth-child(1) { grid-area: prod; min-width: 0; padding-right: 0 !important; }
  .bm-cart-table td:nth-child(1) .bm-cart-product { align-items: flex-start; }
  .bm-cart-table td:nth-child(1) .bm-cart-product > div { min-width: 0; }
  .bm-cart-table td:nth-child(1) h4 { word-wrap: break-word; white-space: normal; line-height: 1.4; margin-bottom: 4px; }
  
  .bm-cart-table td:nth-child(2) { grid-area: price; font-size: 0.95rem; color: var(--text-muted); font-weight: 600; margin-bottom: 0 !important; }
  .bm-cart-table td:nth-child(3) { grid-area: qty; width: auto !important; margin-right: 0 !important; }
  .bm-cart-table td:nth-child(4) { grid-area: total; text-align: right; font-size: 1.15rem; font-weight: 700; width: auto !important; }
  .bm-cart-table td:nth-child(5) { grid-area: remove; width: auto !important; position: static !important; }
  
  .bm-cart-remove { background: #fee2e2 !important; border: none; padding: 0 !important; color: #ef4444 !important; display: flex !important; align-items: center !important; justify-content: center !important; width: 36px !important; height: 36px !important; font-size: 1.1rem !important; border-radius: 6px !important; }
  
  .bm-cart-table-wrap { padding: 16px !important; }
  .checkout-form-row,
  .bm-form-row {
    grid-template-columns: 1fr !important;
  }
}

/* Account & auth */
@media (max-width: 992px) {
  .account-layout,
  .bm-account-layout,
  .auth-split {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  .account-sidebar { order: -1; }
}

@media (max-width: 576px) {
  .login-card,
  .register-card,
  .auth-card {
    padding: 24px 18px !important;
    border-radius: var(--radius) !important;
  }
}

/* Home — BM sections */
@media (max-width: 992px) {
  .bm-sec-head {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }
  .bm-banner { min-height: 220px; }
  .bm-prod-card .bm-prod-name { font-size: 0.9rem; }
}

@media (max-width: 576px) {
  .bm-section { padding: 40px 0; }
  .bm-banners { padding: 32px 0; }
  .bm-trust { padding: 48px 0; }
  .bm-trust h2 { font-size: 1.5rem; }
}

/* Contact & content pages */
@media (max-width: 992px) {
  .ct-grid,
  .contact-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Wishlist & order pages */
@media (max-width: 768px) {
  .wishlist-grid,
  .order-summary-card {
    grid-template-columns: 1fr !important;
  }
  .order-item-row {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }
}

/* Admin-facing frontend tables */
@media (max-width: 600px) {
  .responsive-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Utility bar */
@media (max-width: 640px) {
  .utility-bar .util-left {
    font-size: 0.68rem;
    line-height: 1.4;
  }
}

/* Prevent fixed elements from clipping on small screens */
@media (max-width: 480px) {
  .search-overlay .container { padding-top: 60px; }
  .search-input-wrapper input { font-size: 1rem; }
}
