/* ============================================================
   АКВАСТОК — E-commerce CSS v4 (сантехника-онлайн стиль)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-light: #eff6ff;
  --secondary: #64748b; --success: #16a34a; --danger: #dc2626;
  --warning: #f59e0b; --info: #0ea5e9;
  --bg: #f1f5f9; --bg-white: #ffffff; --bg-light: #f8fafc;
  --text: #1e293b; --text-muted: #64748b; --text-light: #94a3b8;
  --border: #e2e8f0; --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 30px rgba(0,0,0,.1);
  --radius-sm: 6px; --radius: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --container: 1280px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.sidebar-open { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, select, textarea { font-family: var(--font); }
.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 24px; border-radius: var(--radius); font-weight: 600; border: 2px solid transparent; font-size: 15px; transition: all .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 17px; }
.cart-btn-full { width: 100%; margin-top: 8px; }

/* ============================================================
   TOP HEADER
   ============================================================ */
.top-header { background: var(--text); color: #fff; font-size: 13px; }
.top-header-inner { display: flex; justify-content: space-between; align-items: center; height: 32px; }
.top-header-left { display: flex; gap: 12px; align-items: center; }
.top-header-left a { color: #94a3b8; }
.top-header-left a:hover { color: #fff; }
.top-header-right a { color: #94a3b8; }
.top-header-right a:hover { color: #fff; }
.sep { color: #475569; }

/* ============================================================
   MAIN HEADER
   ============================================================ */
.main-header { background: var(--bg-white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.main-header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 22px; font-weight: 800; color: var(--text); }

/* Catalog button */
.catalog-btn { display: flex; align-items: center; gap: 8px; background: var(--primary); color: #fff; padding: 10px 20px; border-radius: var(--radius); font-size: 15px; font-weight: 600; flex-shrink: 0; transition: background .15s; }
.catalog-btn:hover { background: var(--primary-dark); }
.catalog-btn-icon { font-size: 18px; }

/* Search */
.header-search { flex: 1; display: flex; border: 2px solid var(--primary); border-radius: var(--radius); overflow: hidden; max-width: 600px; }
.header-search-input { flex: 1; padding: 10px 16px; font-size: 14px; border: none; outline: none; background: var(--bg-white); min-width: 0; }
.header-search-input::placeholder { color: var(--text-light); }
.header-search-btn { padding: 10px 20px; background: var(--primary); color: #fff; font-size: 16px; cursor: pointer; border: none; }
.header-search-btn:hover { background: var(--primary-dark); }

/* Header actions */
.header-actions { display: flex; gap: 12px; flex-shrink: 0; }
.cart-action { position: relative; display: flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 500; font-size: 14px; transition: all .15s; }
.cart-action:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.cart-icon { font-size: 20px; }
.cart-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; display: none; }
.cart-badge.has-items { display: flex; }

/* ============================================================
   MAIN NAV
   ============================================================ */
.main-nav { background: var(--bg-white); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; height: 44px; }
.nav-links { display: flex; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-link { padding: 12px 18px; font-size: 14px; font-weight: 500; color: var(--text); display: flex; align-items: center; white-space: nowrap; transition: all .15s; }
.nav-link:hover { color: var(--primary); background: var(--primary-light); }

/* ============================================================
   SIDEBAR CATALOG
   ============================================================ */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: none; }
.sidebar-overlay.open { display: block; }
.sidebar-catalog { position: fixed; top: 0; left: 0; width: 340px; max-width: 90vw; height: 100vh; background: var(--bg-white); z-index: 210; overflow-y: auto; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-xl); }
.sidebar-catalog.open { transform: translateX(0); }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 18px; font-weight: 700; background: var(--primary); color: #fff; }
.sidebar-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px; }
.sidebar-body { padding: 8px 0; }
.sidebar-group { border-bottom: 1px solid var(--border-light); }
.sidebar-group:last-child { border-bottom: none; }
.sidebar-group-title { display: flex; align-items: center; gap: 10px; padding: 14px 20px; font-weight: 600; font-size: 15px; color: var(--text); transition: background .1s; }
.sidebar-group-title:hover { background: var(--primary-light); color: var(--primary); }
.sidebar-group-icon { font-size: 20px; width: 28px; text-align: center; }
.sidebar-group-children { padding: 0 20px 12px 48px; display: grid; grid-template-columns: 1fr; gap: 2px; }
.sidebar-child { display: block; padding: 6px 0; font-size: 13px; color: var(--text-muted); transition: color .1s; }
.sidebar-child:hover { color: var(--primary); }

/* ============================================================
   HERO
   ============================================================ */
.hero { background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%); color: #fff; padding: 60px 0; }
.hero-content { text-align: center; }
.hero-title { font-size: 2.5rem; margin-bottom: 12px; line-height: 1.2; }
.hero-subtitle { font-size: 1.1rem; opacity: .85; max-width: 600px; margin: 0 auto 24px; }
.hero-search { display: flex; max-width: 600px; margin: 0 auto; border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 4px 24px rgba(0,0,0,.3); }
.hero-search-input { flex: 1; padding: 16px 20px; font-size: 16px; border: none; outline: none; }
.hero-search-btn { border-radius: 0; padding: 16px 24px; font-size: 16px; }
.hero-stats { display: flex; justify-content: center; gap: 40px; margin-top: 32px; }
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-size: 1.5rem; }
.hero-stat { font-size: .85rem; opacity: .7; }

/* ============================================================
   TRUST BAR
   ============================================================ */
.trust-bar { background: var(--bg-white); border-bottom: 1px solid var(--border); }
.trust-bar-inner { display: flex; justify-content: space-between; padding: 12px 0; font-size: 13px; color: var(--text-muted); gap: 16px; overflow-x: auto; }
.trust-item { white-space: nowrap; display: flex; align-items: center; gap: 6px; }

/* ============================================================
   SECTIONS & CATALOG GRID
   ============================================================ */
.section { padding: 40px 0; }
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 24px; }
.section-title { font-size: 1.5rem; font-weight: 700; }
.section-all-link { font-size: 14px; font-weight: 500; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.catalog-card { display: flex; flex-direction: column; background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all .2s; }
.catalog-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary); transform: translateY(-2px); }
.catalog-card-img { height: 160px; background: var(--bg-light); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.catalog-card-img img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.catalog-card-placeholder { font-size: 48px; opacity: .25; }
.catalog-card-body { padding: 14px 18px; }
.catalog-card-title { display: block; font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.catalog-card-count { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   PRODUCT GRID & CARDS
   ============================================================ */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.product-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all .2s; display: flex; flex-direction: column; }
.product-card:hover { box-shadow: var(--shadow-lg); border-color: var(--border); }
.product-card-image { height: 200px; background: var(--bg-light); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.product-card-image img { width: 100%; height: 100%; object-fit: contain; padding: 8px; transition: transform .3s; }
.product-card:hover .product-card-image img { transform: scale(1.05); }
.product-label { position: absolute; top: 8px; left: 8px; padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.product-label.out-of-stock { background: #fef3c7; color: #92400e; }
.product-label.in-stock { background: #d1fae5; color: #065f46; }
.product-card-body { padding: 14px; display: flex; flex-direction: column; flex: 1; }
.product-card-vendor { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.product-card-title { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-meta { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.product-card-price { font-size: 20px; font-weight: 700; color: var(--text); margin-top: auto; padding-top: 8px; }
.product-card-out-of-stock { display: block; color: var(--danger); font-size: 13px; font-weight: 500; margin-top: 8px; }

/* ============================================================
   SUBCATEGORY GRID (group page)
   ============================================================ */
.subcat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.subcat-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: all .15s; background: var(--bg-white); }
.subcat-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.subcat-card-img { height: 120px; background: var(--bg-light); display: flex; align-items: center; justify-content: center; position: relative; }
.subcat-card-img img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.subcat-card-icon { position: absolute; font-size: 32px; opacity: .1; }
.subcat-card-body { padding: 10px 14px; }
.subcat-card-name { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.3; }
.subcat-card-count { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   CATALOG PAGE
   ============================================================ */
.page-header { display: flex; align-items: baseline; gap: 12px; margin: 24px 0 16px; }
.page-header h1 { font-size: 1.75rem; }
.page-count { font-size: 15px; color: var(--text-muted); }
.catalog-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.sort-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; background: var(--bg-white); cursor: pointer; }
.catalog-count { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.breadcrumbs { padding: 12px 0; font-size: 13px; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { margin: 0 6px; color: var(--text-light); }
.empty-state { text-align: center; padding: 60px; color: var(--text-muted); font-size: 18px; }
.pagination { display: flex; justify-content: center; gap: 4px; margin: 32px 0; }
.page-link { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 14px; }
.page-link:hover { background: var(--bg); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.brands-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.brand-card { display: block; padding: 14px 16px; text-align: center; background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 14px; font-weight: 500; transition: all .15s; }
.brand-card:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

/* ============================================================
   PRODUCT PAGE
   ============================================================ */
.product-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 24px 0; }
.product-gallery { position: sticky; top: 100px; }
.main-image { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-white); display: flex; align-items: center; justify-content: center; min-height: 400px; }
.main-image img { max-width: 100%; max-height: 450px; object-fit: contain; padding: 20px; }
.thumbnails { display: flex; gap: 8px; margin-top: 12px; }
.thumb { width: 64px; height: 64px; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; object-fit: contain; padding: 4px; background: var(--bg-white); transition: border-color .15s; }
.thumb:hover { border-color: var(--primary); }
.product-details h1 { font-size: 1.5rem; margin-bottom: 16px; }
.product-meta { background: var(--bg-light); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.meta-row { display: flex; padding: 6px 0; font-size: 14px; }
.meta-label { color: var(--text-muted); width: 120px; flex-shrink: 0; }
.meta-value { font-weight: 500; }
.product-price-block { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.price-current { font-size: 2rem; font-weight: 800; color: var(--text); }
.stock-status { padding: 6px 14px; border-radius: 100px; font-size: 14px; font-weight: 600; }
.stock-in { background: #d1fae5; color: #065f46; }
.stock-out { background: #fee2e2; color: #991b1b; }
.product-actions { display: flex; gap: 12px; align-items: center; }
.qty-selector { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.qty-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 18px; background: var(--bg-light); cursor: pointer; border: none; }
.qty-input { width: 50px; height: 40px; text-align: center; border: none; font-size: 16px; font-weight: 600; -moz-appearance: textfield; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.product-params { margin-top: 24px; }
.product-params h3 { margin-bottom: 12px; }
.params-table { width: 100%; border-collapse: collapse; }
.params-table td { padding: 6px 12px; font-size: 13px; border-bottom: 1px solid var(--border-light); }
.params-table tr:nth-child(even) { background: var(--bg-light); }
.param-name { color: var(--text-muted); width: 60%; }
.param-value { font-weight: 500; }
.product-description { margin-top: 32px; padding: 24px; background: var(--bg-white); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.product-description h3 { margin-bottom: 12px; }
.related-section { margin-top: 40px; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { background: var(--text); color: #cbd5e1; padding: 48px 0 24px; margin-top: 60px; }
.footer a { color: #94a3b8; }
.footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 40px; }
.footer-brand p { margin-top: 12px; font-size: 14px; }
.footer-col h4 { color: #fff; margin-bottom: 12px; font-size: 15px; }
.footer-col a { display: block; padding: 4px 0; font-size: 14px; }
.footer-bottom { border-top: 1px solid #334155; margin-top: 32px; padding-top: 16px; font-size: 13px; color: #64748b; }

/* ============================================================
   CART TOAST
   ============================================================ */
.cart-toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: #fff; padding: 14px 24px; border-radius: var(--radius); font-weight: 500; z-index: 999; transform: translateY(100px); opacity: 0; transition: all .3s; }
.cart-toast.show { transform: translateY(0); opacity: 1; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .product-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .main-header-inner { gap: 12px; height: 56px; }
  .catalog-btn { padding: 8px 14px; font-size: 13px; }
  .catalog-btn-text { display: none; }
  .header-search { flex: 1; max-width: none; }
  .header-search-input { padding: 8px 12px; font-size: 13px; }
  .header-search-btn { padding: 8px 14px; }
  .cart-label { display: none; }
  .hero { padding: 40px 0; }
  .hero-title { font-size: 1.75rem; }
  .hero-stats { flex-wrap: wrap; gap: 24px; }
  .nav-links { display: none; }
  .catalog-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-card-image { height: 150px; }
  .product-card-title { font-size: 13px; }
  .product-card-price { font-size: 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .product-layout { gap: 24px; }
}
@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .catalog-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
