/* ==========================================================================
   TT Shop — Responsive Breakpoints
   Mobile-first base lives in style.css / components.css.
   Breakpoints covered: 480, 640, 768, 1024, 1280, 1440
   ========================================================================== */

/* ---------- ~480px small phones tuning ---------- */
@media (max-width: 380px) {
  .container { padding-inline: 12px; }
  .product-grid { gap: 8px; padding-inline: 12px; }
  .category-grid { gap: 10px; padding-inline: 12px; }
  .pd-price-current { font-size: 1.45rem; }
  /* Two stat cards per row gets too cramped for currency values below ~360px. */
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- >=480px ---------- */
@media (min-width: 480px) {
  .category-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- >=640px (large phones / small tablets) ---------- */
@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 40px; }
}

/* ---------- >=768px (tablet) ---------- */
@media (min-width: 768px) {
  :root { --header-h: 72px; }

  .navbar-search { display: flex; flex: 1; max-width: 420px; }
  .hero-slider { margin: 20px; }
  .hero-slide { aspect-ratio: 21 / 9; }
  .hero-slider-nav { display: flex; }

  .category-grid { grid-template-columns: repeat(6, 1fr); padding-inline: 20px; }
  .product-grid { grid-template-columns: repeat(3, 1fr); padding-inline: 20px; gap: 16px; }
  .section-header { padding-inline: 20px; }
  .flash-sale-section, .promo-banner { margin-inline: 20px; }

  .footer-grid { grid-template-columns: 1.4fr repeat(4, 1fr); padding-block: 40px; }
  .footer-col summary { pointer-events: none; padding-bottom: 4px; }
  .footer-col summary::after { display: none; }
  .footer-col { border-bottom: none; }
  .footer-bottom { flex-direction: row; justify-content: space-between; text-align: left; }

  .cart-shop-group, .order-summary, .checkout-section, .order-card, .profile-quicklinks, .profile-menu { margin-inline: 20px; }
  .cart-item-img { width: 92px; height: 92px; }

  .leftbar-header .icon-btn[data-filter-close] { display: none; }

  /* Seller Center */
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(6, 1fr); }
  .store-grid { grid-template-columns: repeat(3, 1fr); }
  .catalog-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .vip-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- >=1024px (desktop) ---------- */
@media (min-width: 1024px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }

  .navbar-links { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
  .navbar-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    position: relative;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  }
  .navbar-link:hover { background: var(--background); color: var(--text); }
  .navbar-link i { font-size: 1.05rem; }
  .navbar-icon-link span:not(.badge-count) { display: none; }
  .navbar-profile span { display: none; }
  .navbar-mobile-actions { display: none; }
  .navbar-mobile-search { display: none !important; }
  .search-submit {
    display: inline-flex;
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    padding: 0 18px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    align-items: center;
  }
  .search-input { padding-right: 90px; }

  .container { padding-inline: 24px; }
  .category-grid { grid-template-columns: repeat(8, 1fr); }
  .product-grid { grid-template-columns: repeat(4, 1fr); }
  .hero-slide { aspect-ratio: 24 / 9; }
  .section-header-text h2 { font-size: 1.3rem; }

  /* Listing page: static sidebar instead of bottom sheet */
  .listing-layout { display: grid; grid-template-columns: 272px 1fr; gap: 24px; align-items: start; }
  .filter-sheet-backdrop { display: none !important; }
  .leftbar {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    max-height: calc(100vh - var(--header-h) - 32px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
  }
  .leftbar-header { display: none; }
  .leftbar-actions { position: static; }

  .pd-layout { display: grid; grid-template-columns: 460px 1fr; gap: 32px; align-items: flex-start; }
  .pd-gallery { position: sticky; top: calc(var(--header-h) + 16px); border-radius: var(--radius-lg); overflow: hidden; }
  .pd-info, .pd-section { margin-top: 0; }
  .pd-sticky-bar { position: static; border-top: none; padding-inline: 0; margin-top: 12px; }

  .cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: flex-start; }
  .order-summary { position: sticky; top: calc(var(--header-h) + 16px); }
  .cart-page .order-summary { display: block; }
  .cart-page .sticky-checkout-bar { display: none; }
  .cart-page .cart-min-order-banner { display: none; }

  .checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: flex-start; }
  .checkout-layout .order-summary { margin-inline: 0; }

  .profile-header { border-radius: var(--radius-lg); margin-inline: 0; }
  .profile-quicklinks { grid-template-columns: repeat(2, 1fr); margin: 16px 0; }

  .auth-page { background: linear-gradient(120deg, var(--primary) 0%, #ff8a65 50%, var(--accent) 100%); }
  .auth-card { max-width: 460px; }

  .container.narrow { max-width: 720px; }

  /* Seller Center: sidebar becomes a permanent column, no drawer/backdrop/bottom-nav */
  .seller-shell { display: flex; align-items: flex-start; }
  .seller-drawer-backdrop { display: none !important; }
  .seller-sidebar {
    position: sticky;
    top: 0;
    left: auto;
    transform: none;
    height: 100vh;
    box-shadow: none;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
  }
  .seller-drawer-toggle, .seller-drawer-close { display: none; }
  .seller-main { flex: 1; min-width: 0; }
  .seller-content { padding: 24px 32px; }
  .seller-topbar { padding: 16px 32px; }
  .seller-topbar-title { font-size: 1.3rem; }

  /* Live Chat: desktop shows list + thread (+ context, on admin) side by side */
  .chat-body[data-active-view] .conv-panel,
  .chat-body[data-active-view] .thread-panel { display: flex; }
  .conv-panel { width: 340px; flex-shrink: 0; }
  .thread-back-btn { display: none; }
  .thread-panel { flex: 1; }
  .context-panel {
    width: 300px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    position: static;
    transform: none;
    box-shadow: none;
    padding-top: 18px;
  }
  .context-panel-close, .context-panel-backdrop { display: none !important; }
  .admin-context-toggle { display: none !important; }
  .chat-widget-panel { width: 400px; }
}

/* ---------- >=1280px ---------- */
@media (min-width: 1280px) {
  .product-grid { grid-template-columns: repeat(5, 1fr); }
  .hero-slide-overlay h2 { font-size: 1.9rem; }
  .hero-slide-overlay { max-width: 560px; padding: 40px; }
  .flash-sale-section .product-card { min-width: 176px; max-width: 176px; }
}

/* ---------- >=1440px ---------- */
@media (min-width: 1440px) {
  .container { padding-inline: 32px; }
}

/* ---------- Desktop navbar: tidy grouping (links | icons | CTA | auth | lang) ---------- */
@media (min-width: 1024px) {
  .navbar-inner { gap: 20px; }
  .navbar-search { max-width: 440px; margin-inline: auto; }
  .navbar-links { margin-left: 0; gap: 2px; flex-shrink: 0; }
  .navbar-link { white-space: nowrap; }
  .navbar-link[href*="marketplace"], .navbar-link[href*="category"] { color: var(--text); font-weight: 600; }
  .navbar-divider { width: 1px; height: 22px; background: var(--border); margin: 0 10px; flex: none; }
  .navbar-sell-cta { margin-left: 0; }
  .navbar-auth { display: flex; align-items: center; gap: 8px; margin-left: 10px; }
  .navbar-login { border: 1.5px solid var(--border); color: var(--text); font-weight: 600; }
  .navbar-login:hover { border-color: var(--text); background: transparent; }
  .navbar-register { background: var(--primary); color: #fff; font-weight: 600; }
  .navbar-register:hover { background: var(--primary-dark); color: #fff; }
  .navbar-lang-switcher { display: flex; align-items: center; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--border); }
  .navbar-lang-switcher i { margin-right: 6px; color: var(--text-muted); }
  .navbar-lang-switcher select { border: 0; background: transparent; font-size: 0.82rem; color: var(--text); cursor: pointer; padding: 4px 2px; }
}
