/* =========================================
   KhaylimTech — Responsive Styles
   ========================================= */

/* Large Desktop */
@media (max-width: 1280px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-newsletter { grid-column: 1 / -1; }
}

/* Tablet Landscape */
@media (max-width: 1024px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .products-layout { grid-template-columns: 220px 1fr; }
  .detail-layout { gap: 28px; }
  .cart-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}

/* Tablet Portrait */
@media (max-width: 768px) {
  /* Global overflow lock */
  *, *::before, *::after { box-sizing: border-box; }
  html, body { overflow-x: hidden; max-width: 100vw; }
  .container { padding: 0 16px; }

  /* Navbar */
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .nav-search { max-width: 200px; }

  /* Hero — mobile: zoom into gadgets area, text floats on top */
  .hero { min-height: 580px; }
  .hero-bg {
    display: block;
    object-fit: cover;
    object-position: center 65%;
    transform: scale(1.5);
    transform-origin: center 65%;
  }
  .hero-overlay {
    background: linear-gradient(
      to bottom,
      rgba(13,13,18,0.97) 0%,
      rgba(13,13,18,0.88) 40%,
      rgba(13,13,18,0.35) 70%,
      rgba(13,13,18,0.10) 100%
    );
  }
  [data-theme="light"] .hero-overlay {
    background: linear-gradient(
      to bottom,
      rgba(13,13,18,0.96) 0%,
      rgba(13,13,18,0.86) 40%,
      rgba(13,13,18,0.30) 70%,
      rgba(13,13,18,0.08) 100%
    );
  }
  .hero-content {
    padding: 6px 0 0;
    max-width: 100%;
    text-align: center;
  }
  .hero-inner { flex-direction: column; }
  .hero-visual { display: none; }
  .hero-cats { justify-content: center; }
  .hero-actions { justify-content: center; }
  .hero-tag { margin: 0 auto 14px; }

  /* Fix View Phones button visibility */
  .hero .btn-outline {
    color: #fff;
    border-color: rgba(255,255,255,0.6);
  }
  .hero .btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
  }

  /* Product grid — 2 columns everywhere on tablet/mobile */
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
  }

  /* Products page layout — flex column so order works */
  .products-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 20px;
  }
  .sidebar {
    order: 2;           /* filters go BELOW products */
    position: static;
    max-height: none;
    overflow: hidden;
    width: 100%;
  }
  .sidebar-card { padding: 16px; }
  .products-main {
    order: 1;           /* products go FIRST */
    width: 100%;
    overflow: hidden;
    min-width: 0;
  }
  .sidebar-filters-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  /* Stack price inputs vertically on mobile */
  .price-inputs { grid-template-columns: 1fr; }

  /* Detail page */
  .detail-layout { grid-template-columns: 1fr; gap: 24px; padding: 28px 0; }

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

  /* Promo banner */
  .promo-banner { flex-direction: column; text-align: center; padding: 32px 24px; }

  /* Trust strip */
  .trust-inner { gap: 20px; }

  /* Section */
  .section { padding: 44px 0; }
}

/* Mobile Large */
@media (max-width: 540px) {
  .container { padding: 0 12px; }

  /* Product cards — compact for 2-col */
  .product-card { min-width: 0; width: 100%; }
  .product-info { padding: 8px 10px 10px; }
  .product-name { font-size: 0.8rem; }
  .product-price { font-size: 0.88rem; }
  .product-price-old { font-size: 0.72rem; }
  .product-add-btn { font-size: 0.72rem; padding: 8px 4px; gap: 4px; }
  .product-cat { font-size: 0.62rem; }
  .stars { font-size: 0.68rem; }
  .rating-count { font-size: 0.65rem; }

  /* Navbar */
  .nav-search { display: none; }
  .nav-logo img { width: 36px; height: 36px; }
  .nav-logo-text { display: flex !important; }
  .nav-logo-text span:first-child { font-size: 0.78rem; }
  .nav-logo-text span:last-child { font-size: 0.52rem; }

  /* Hero */
  .hero { min-height: 520px; }
  .hero-content { padding: 40px 0 0; max-width: 100%; text-align: center; }
  .hero-actions { flex-direction: column; align-items: center; }
  .btn-gold, .btn-outline { width: 100%; justify-content: center; }

  /* Categories */
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-card { padding: 18px 12px; }

  /* Section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Cart */
  .cart-item { flex-direction: column; }
  .cart-item-img { width: 100%; height: 180px; }
  .cart-item-controls { flex-direction: row; width: 100%; justify-content: space-between; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* Mobile Small */
@media (max-width: 375px) {
  .container { padding: 0 10px; }
  .product-grid { gap: 8px; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .product-add-btn { font-size: 0.68rem; }
}
