/* ===== RESPONSIVE ===== */

/* Large screens */
@media (max-width: 1280px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .categories-grid { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px; }
}

/* Medium screens - Tablet landscape */
@media (max-width: 1024px) {
  .hero .container { grid-template-columns: 1fr; text-align: center; }
  .hero-image { display: none; }
  .hero-features { justify-content: center; }
  .hero-btns { justify-content: center; }
  .hero-label::before { display: none; }
  .product-layout { grid-template-columns: 1fr; }
  .product-gallery { position: static; }
  .about-grid { grid-template-columns: 1fr; }
  .about-img { max-height: 400px; }
  .about-img img { height: 100%; object-fit: cover; width: 100%; }
  .catalog-layout { grid-template-columns: 220px 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .cart-summary-card { position: static; }
  .checkout-layout { grid-template-columns: 1fr; }
  .contacts-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet portrait */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .section { padding: 48px 0; }
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.6rem; }
  
  /* Header */
  .header-top { display: none; }
  .header-main .container { flex-wrap: wrap; gap: 12px; }
  .header-search { order: 3; max-width: 100%; flex: 0 0 100%; }
  .header-actions { gap: 4px; }
  .header-phone span { display: none; }
  .header-phone { padding: 10px; }
  .logo-icon { width: 40px; height: 40px; font-size: 1.3rem; }
  
  /* Nav */
  .nav { display: none; }
  .burger { display: flex; }
  
  /* Hero */
  .hero { padding: 48px 0; }
  .hero p { font-size: 0.95rem; }
  
  /* Features bar */
  .features-bar .container { flex-wrap: wrap; }
  .feature-item { flex: 0 0 50%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .feature-item:nth-child(odd) { border-right: 1px solid rgba(255,255,255,0.08); }
  
  /* Categories */
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  
  /* Products */
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  
  /* Catalog */
  .catalog-layout { grid-template-columns: 1fr; }
  .sidebar-card { display: none; }
  .sidebar-card.mobile-show { display: block; }
  
  /* Cart */
  .cart-table { font-size: 0.82rem; }
  .cart-table th:nth-child(3), .cart-table td:nth-child(3) { display: none; }
  .cart-product-img { width: 50px; height: 50px; }
  
  /* Compare */
  .compare-table { font-size: 0.78rem; }
  
  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }
  
  /* Newsletter */
  .newsletter-form { flex-direction: column; }
  
  /* Form */
  .form-row { grid-template-columns: 1fr; }
  
  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  
  /* Mobile cart sticky - show */
  .mobile-cart-sticky { display: block; }
  body { padding-bottom: 76px; }
  #toast-container { bottom: 88px; }
}

/* Mobile */
@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.35rem; }
  
  .header-action-btn span:not(.count) { display: none; }
  
  .categories-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-card-body { padding: 10px; }
  .product-card-title { font-size: 0.8rem; }
  .price-current { font-size: 0.95rem; }
  
  .hero-features { flex-direction: column; align-items: flex-start; }
  .hero-btns { flex-direction: column; width: 100%; }
  .hero-btns .btn { justify-content: center; }
  
  .features-bar .container { flex-direction: column; }
  .feature-item { flex: 1 1 100%; border-right: none; }
  
  .footer-grid { grid-template-columns: 1fr; }
  .footer-brand { grid-column: auto; }
  
  .tabs-nav { overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
  
  .sort-bar { flex-direction: column; align-items: flex-start; }
  
  .promo-input { flex-direction: column; }
  
  .search-form { flex-direction: column; }
  
  .team-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  
  .page-404-code { font-size: 5rem; }
  .page-404 h2 { font-size: 1.5rem; }
}

/* Very small phones */
@media (max-width: 360px) {
  .products-grid { grid-template-columns: 1fr; }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Large monitors */
@media (min-width: 1400px) {
  .container { max-width: 1360px; }
}

/* Print styles */
@media print {
  .header, .footer, #back-to-top, .mobile-cart-sticky, #toast-container { display: none; }
  body { padding-bottom: 0; }
}

/* ===== NEW RESPONSIVE FOR TOPNAV + MOBILE REDESIGN ===== */

/* Tablet and below: hide topnav center, show simpler version */
@media (max-width: 1024px) {
  .topnav-left { display: none; }
  .topnav-center { justify-content: flex-start; }
  .compare-page-layout { grid-template-columns: 200px 1fr; }
}

@media (max-width: 768px) {
  /* TOP NAV - hide on mobile (use mobile menu instead) */
  .header-topnav { display: none; }

  /* HEADER MAIN - mobile: logo left, burger right only */
  .header-main .container {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 16px;
    height: 64px;
    align-items: center;
  }

  /* Show burger */
  .burger {
    display: flex;
    order: -1;
    margin-right: 12px;
    flex-shrink: 0;
  }

  /* Logo centered-ish (between burger and actions) */
  .logo {
    flex: 1;
    justify-content: flex-start;
  }
  .logo-img {
    height: 38px;
  }

  /* Hide search on mobile */
  .header-search { display: none; }

  /* Keep only cart icon in actions */
  .header-actions {
    margin-left: auto;
    gap: 0;
    flex-shrink: 0;
  }
  .header-action-btn { display: none; }
  .header-action-btn:nth-child(3) {
    /* Keep only cart button */
    display: flex;
    padding: 8px;
    font-size: 0;
  }
  .header-action-btn:nth-child(3) span:not(.count) { display: none; }
  .header-phone { display: none; }

  /* Compare layout: stack on mobile */
  .compare-page-layout { grid-template-columns: 1fr; }
  .compare-sidebar { position: static; }

  /* Checkout success adjustments */
  .checkout-success-wrap { padding: 40px 16px 60px; }
  .checkout-success-icon { width: 72px; height: 72px; }
}

@media (max-width: 480px) {
  .header-main .container { height: 56px; padding: 0 12px; }
  .logo-img { height: 32px; }
  .compare-page-layout { gap: 16px; }
  .checkout-success-btns { flex-direction: column; }
  .checkout-success-btns .btn { justify-content: center; }
}
