:root {
    --primary: #4B5842;        /* Темно-оливковый (кнопки, акценты) */
    --bg-color: #FFFFFF;       /* Чистый белый (глобальный фон) */
    --bg-sec: #F5F5F5;         /* Светло-серый (подвал, плашки) */
    --card-bg: #FFFFFF;        /* Чистый белый (фон карточек) */
    --text-main: #2B2B2B;      /* Темный графит (заголовки, основной текст) */
    --text-muted: #808080;     /* Серый (старые цены, плейсхолдеры) */
    --radius: 8px;
    --transition: 0.3s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: var(--bg-color); color: var(--text-main); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Плейсхолдеры в поиске и формах */
::placeholder { color: var(--text-muted); opacity: 1; }

/* Шапка */
.header { background: var(--card-bg); padding: 16px 0; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 24px; font-weight: 700; text-decoration: none; color: var(--text-main); }
.cart-btn { background: none; border: none; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text-main); }
.badge { background: var(--primary); color: white; padding: 2px 8px; border-radius: 12px; font-size: 12px; }

/* Категории */
.categories { margin: 24px 0; overflow-x: auto; white-space: nowrap; padding-bottom: 8px; }
.category-list { list-style: none; display: flex; gap: 12px; }
.category-list button { padding: 8px 16px; border: 1px solid #ddd; background: var(--card-bg); border-radius: 20px; cursor: pointer; color: var(--text-main); }
.category-list button.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Сетка товаров */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 40px; }
@media (min-width: 768px) { .products { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 24px; } }

/* Карточка товара (Обновлено для ровной сетки) */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    border: 1px solid #eaeaea; /* Легкая рамка для отделения от белого фона */
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    height: 100%; /* Карточки растягиваются на всю высоту строки */
}
.product-img-placeholder { height: 150px; background: var(--bg-sec); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--text-muted); margin-bottom: 16px; }

/* НОВОЕ: Фиксируем размер фотографий */
.product-image {
    width: 100%;
    height: 250px; /* Высота всех картинок будет одинаковой */
    object-fit: contain; /* Картинка впишется без обрезки */
    border-radius: var(--radius);
    margin-bottom: 16px;
    background-color: var(--card-bg);
}

/* НОВОЕ: Выталкиваем цену и кнопку вниз */
.product-title {
    font-size: 14px;
    margin-bottom: 8px;
    flex-grow: 1; /* Занимает всё свободное место, выравнивая низ карточек */
    color: var(--text-main);
}
.product-price { font-weight: 700; font-size: 16px; margin-bottom: 16px; color: var(--text-main); }
.add-to-cart-btn { background: var(--primary); color: white; border: none; padding: 10px; border-radius: var(--radius); cursor: pointer; transition: var(--transition); margin-top: auto; }
.add-to-cart-btn:hover { background: #3a4533; }
.add-to-cart-btn:active { transform: scale(0.98); }

/* Акции и скидки */
.section-title { font-size: 24px; margin: 32px 0 24px; color: var(--primary); }
.promo-card { position: relative; border: 2px solid #ff4757; }
.sale-badge { position: absolute; top: 12px; left: 12px; background: #ff4757; color: white; padding: 4px 10px; border-radius: 4px; font-weight: bold; font-size: 12px; z-index: 1; }
.price-block { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.product-old-price { text-decoration: line-through; color: var(--text-muted); font-size: 14px; }
.promo-card .product-price { color: #ff4757; margin-bottom: 0; }

/* Корзина (Offcanvas) */
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: var(--transition); z-index: 100; }
.cart-overlay.active { opacity: 1; pointer-events: auto; }
.cart-panel { position: absolute; right: -100%; top: 0; bottom: 0; width: 100%; max-width: 400px; background: var(--card-bg); display: flex; flex-direction: column; transition: right var(--transition); }
.cart-overlay.active .cart-panel { right: 0; }
.cart-header { padding: 20px; display: flex; justify-content: space-between; border-bottom: 1px solid #eee; }
.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.close-btn:hover { color: var(--text-main); }
.cart-items { padding: 20px; flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.item-info { flex-grow: 1; }
.item-title { font-size: 14px; margin-bottom: 4px; color: var(--text-main); }
.item-controls { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.qty-btn { background: var(--bg-sec); color: var(--text-main); border: none; width: 24px; height: 24px; border-radius: 4px; cursor: pointer; }
.remove-btn { color: #ff4757; font-size: 12px; border: none; background: none; cursor: pointer; margin-left: auto; }
.cart-footer { padding: 20px; border-top: 1px solid #eee; background: var(--card-bg); }
.cart-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--text-main); }
.checkout-form { display: flex; flex-direction: column; gap: 12px; }
.checkout-form input, .checkout-form textarea { padding: 12px; border: 1px solid #ccc; border-radius: var(--radius); font-family: inherit; color: var(--text-main); }
.checkout-form input:focus, .checkout-form textarea:focus { outline: none; border-color: var(--primary); }
.whatsapp-btn { background: var(--primary); color: white; border: none; padding: 16px; border-radius: var(--radius); font-weight: 700; font-size: 16px; cursor: pointer; text-align: center; transition: var(--transition); }
.whatsapp-btn:hover { background: #3a4533; }

/* Подвал (Footer) - Изменен на светло-серый */
.footer { background: var(--bg-sec); color: var(--text-main); padding: 48px 0 24px; margin-top: 60px; border-top: 1px solid #eaeaea; }
.footer-inner { display: grid; grid-template-columns: 1fr; gap: 32px; margin-bottom: 32px; }
@media (min-width: 768px) { .footer-inner { grid-template-columns: repeat(3, 1fr); } }
.footer-col h4 { font-size: 18px; margin-bottom: 16px; color: var(--text-main); }
.footer-desc { color: var(--text-muted); margin-top: 12px; line-height: 1.5; font-size: 14px; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: var(--transition); cursor: pointer; }
.footer-links a:hover { color: var(--primary); }
.footer-col p { color: var(--text-muted); margin-bottom: 8px; font-size: 14px; }
.footer-bottom { text-align: center; border-top: 1px solid #eaeaea; padding-top: 24px; color: var(--text-muted); font-size: 14px; }
.footer .logo { color: var(--text-main); }

/* Общие модальные окна */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: var(--transition); z-index: 200; padding: 16px; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--card-bg); width: 100%; max-width: 500px; border-radius: var(--radius); padding: 24px; transform: translateY(-20px); transition: var(--transition); max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; border-bottom: 1px solid #eee; padding-bottom: 12px; }
.modal-header h3 { font-size: 20px; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 28px; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 0 8px; }
.modal-close:hover { color: #ff4757; }
.modal-body p { margin-bottom: 12px; line-height: 1.6; font-size: 15px; color: var(--text-main); }
.modal-body ul { margin-left: 20px; margin-bottom: 12px; line-height: 1.6; font-size: 15px; color: var(--text-main); }

/* Быстрый просмотр товара (Quick View) */
.product-modal { max-width: 800px; padding: 24px; }
.quick-view-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 8px; }
@media (min-width: 768px) { .quick-view-grid { grid-template-columns: 1fr 1fr; } }
.quick-view-image { background: var(--bg-sec); border-radius: var(--radius); min-height: 250px; max-height: 400px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.quick-view-image img { width: 100%; height: 100%; object-fit: contain; } /* НОВОЕ: Ограничиваем фото в Quick View */
.quick-view-info h3 { font-size: 24px; margin-bottom: 8px; color: var(--primary); }
.qv-details { margin: 16px 0; padding: 16px; background: var(--bg-sec); border-radius: var(--radius); }
.qv-details h4 { margin-bottom: 8px; font-size: 16px; color: var(--primary); }
.qv-details ul { margin-left: 20px; font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.qv-description { font-size: 14px; line-height: 1.6; margin-bottom: 24px; color: var(--text-main); }
.qv-add-btn { width: 100%; font-size: 16px; padding: 14px; font-weight: bold; background: var(--primary); color: white; border: none; border-radius: var(--radius); cursor: pointer; transition: var(--transition); }
.qv-add-btn:hover { background: #3a4533; }
.quick-view-trigger { cursor: pointer; transition: opacity var(--transition); }
.quick-view-trigger:hover { opacity: 0.8; }

/* Выбор параметров (Цвет, Размер) */
.qv-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.qv-option-group { display: flex; flex-direction: column; gap: 6px; }
.qv-option-group label { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.qv-option-group select { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; font-size: 15px; outline: none; color: var(--text-main); }
.qv-option-group select:focus { border-color: var(--primary); }

/* Галерея миниатюр в быстром просмотре */
#qv-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

/* Кнопка "Наверх" */
.scroll-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
}
.scroll-top-btn:hover { background: #3a4533; }
