:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-light: #f8fafc;
    --text: #1e293b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --success: #10b981;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; line-height: 1.5; color: var(--text); background: var(--bg-light); }
a { text-decoration: none; color: inherit; }

/* HEADER */
.site-header { background: #fff; padding: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.shop-info p { font-size: 0.9rem; color: #64748b; margin-bottom: 0.5rem; }
.contacts span { margin-right: 1rem; font-size: 0.85rem; }
.search-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-form input { flex: 1; padding: 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem; }
.search-form button { padding: 0.75rem 1.2rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; }
.search-form button:hover { background: var(--primary-hover); }
.cart-indicator { background: var(--bg-light); padding: 0.6rem 1rem; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); font-weight: 500; }
.cart-indicator:hover { background: #e2e8f0; }

/* MAIN */
.main-content { padding: 2rem; max-width: 1200px; margin: 0 auto; min-height: 70vh; }
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }

/* FOOTER */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 2rem; text-align: center; margin-top: 3rem; }
.site-footer p { margin-bottom: 0.5rem; }

/* CART MODAL */
.cart-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.cart-modal.hidden { display: none; }
.cart-content { background: #fff; padding: 1.5rem; border-radius: 10px; width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto; position: relative; }
.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.close-cart { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #64748b; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px dashed var(--border); }
.cart-item input { width: 60px; padding: 4px; text-align: center; }
.cart-actions { display: flex; gap: 1rem; margin-top: 1rem; justify-content: flex-end; }
.btn-primary { background: var(--primary); color: #fff; padding: 0.6rem 1rem; border-radius: 6px; text-decoration: none; display: inline-block; border:none; cursor:pointer; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-light); padding: 0.6rem 1rem; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; text-decoration:none; display:inline-block; }
.hidden { display: none !important; }

/* КАТЕГОРИИ - СЕТКА (ГЛАВНАЯ) - КЛЮЧЕВОЙ БЛОК */
.categories-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 1rem; 
    margin-top: 1rem; 
}
.category-card { 
    background: #fff; 
    border-radius: 8px; 
    overflow: hidden; 
    border: 1px solid var(--border); 
    text-align: center; 
    cursor: pointer; 
    transition: transform 0.2s; 
    height: 260px; 
    display: flex; 
    flex-direction: column; 
}
.category-card:hover { transform: translateY(-4px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.category-card img { width: 200px; height: 200px; object-fit: contain; background: #f1f5f9; margin: 0 auto; display: block; }
.cat-name { padding: 0.75rem; font-weight: 600; font-size: 1rem; flex: 1; display: flex; align-items: center; justify-content: center; }

/* АДАПТИВ: Планшеты (3 колонки) */
@media (min-width: 768px) { 
    .categories-grid { grid-template-columns: repeat(3, 1fr); } 
}
/* АДАПТИВ: Десктоп (5 колонок) */
@media (min-width: 1024px) { 
    .categories-grid { grid-template-columns: repeat(5, 1fr); } 
}

/* КАТАЛОГ ТОВАРОВ */
.catalog-header { margin-bottom: 1.5rem; }
.filters-bar { background: #fff; padding: 1rem; border-radius: 8px; border: 1px solid var(--border); }
.filter-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.filter-form input, .filter-form select { padding: 0.6rem; border: 1px solid var(--border); border-radius: 4px; min-width: 120px; }
.filter-form button { background: var(--primary); color: #fff; border: none; padding: 0.6rem 1rem; border-radius: 4px; cursor: pointer; font-weight: 500; }
.filter-form button:hover { background: var(--primary-hover); }

.products-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 1.5rem; 
    margin-top: 1rem; 
}
.product-card { 
    background: #fff; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    transition: box-shadow 0.2s; 
}
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.product-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #f8fafc; }
.product-info { padding: 1rem; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.product-title { font-weight: 500; margin-bottom: 0.5rem; font-size: 0.95rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-price { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
.product-actions { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.btn-add-cart { background: var(--success); color: #fff; border: none; padding: 0.5rem 0.8rem; border-radius: 4px; cursor: pointer; font-size: 0.9rem; font-weight: 500; }
.btn-add-cart:disabled { background: #9ca3af; cursor: not-allowed; }

.out-stock-section { margin-top: 3rem; padding-top: 2rem; border-top: 2px dashed #cbd5e1; }
.out-stock-section .product-card { opacity: 0.75; border-style: dashed; background: #f8fafc; }

.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2rem; flex-wrap: wrap; }
.pagination button { padding: 0.5rem 0.9rem; border: 1px solid var(--border); background: #fff; cursor: pointer; border-radius: 4px; font-weight: 500; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.no-results { text-align: center; padding: 3rem; color: #64748b; grid-column: 1 / -1; font-size: 1.1rem; }

/* ЧЕКАУТ И ЗАКАЗ */
.admin-form { background: #fff; padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.admin-form label { width: 100%; font-weight: 500; margin-bottom: 0.25rem; }
.admin-form input, .admin-form select, .admin-form textarea { padding: 0.6rem; border: 1px solid var(--border); border-radius: 6px; width: 100%; box-sizing: border-box; }
.admin-form button { background: var(--primary); color: #fff; border: none; padding: 0.6rem 1rem; border-radius: 6px; cursor: pointer; font-weight: 500; width: auto; }
.captcha-box { background: #f8fafc; padding: 1rem; border-radius: 6px; border: 1px solid var(--border); width: 100%; text-align: center; }
.captcha { font-weight: bold; font-size: 1.2rem; margin-bottom: 0.5rem; }
.order-receipt { background: #fff; padding: 2rem; border-radius: 8px; border: 1px solid var(--border); max-width: 800px; margin: 0 auto; }
.order-items-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.order-items-table th, .order-items-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.order-items-table th { background: #f1f5f9; }
.print-actions { text-align: center; margin-top: 2rem; display: flex; justify-content: center; gap: 1rem; }

/* Статические страницы */
.static-page { background: #fff; padding: 2rem; border-radius: 8px; border: 1px solid var(--border); max-width: 900px; margin: 0 auto; }
.static-page h1 { margin-bottom: 1rem; color: var(--text); }
.static-page p { margin-bottom: 1rem; }
.static-page ul, .static-page ol { margin: 1rem 0; padding-left: 2rem; }
.static-page a { color: var(--primary); text-decoration: none; }
.static-page a:hover { text-decoration: underline; }

/* ПЕЧАТЬ */
@media print {
    body * { visibility: hidden; }
    #order-receipt, #order-receipt * { visibility: visible; }
    #order-receipt { position: absolute; left: 0; top: 0; width: 100%; border: none; padding: 0; box-shadow: none; }
    .print-actions, header, footer, .cart-indicator, .search-form { display: none !important; }
}