
.catalog-page { display: grid; grid-template-columns: 270px 1fr; gap: 35px; padding: 140px 40px 60px; max-width: 1540px; margin: 0 auto; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 15px; color: #777; }
.breadcrumbs a { text-decoration: none; color: #555; transition: color 0.2s; }
.breadcrumbs a:hover { color: #b71c1c; text-decoration: underline; }
.breadcrumbs .current { color: #111; font-weight: 500; }
.sidebar { background: white; border-radius: 20px; padding: 30px; box-shadow: 0 15px 40px rgba(0,0,0,.06); border: 1px solid #eee; height: max-content; position: sticky; top: 110px; z-index: 100; transition: transform 0.3s ease; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.sidebar h2 { font-size: 20px; color: #111; margin: 0; }
.close-sidebar-btn { display: none; background: none; border: none; font-size: 28px; color: #333; cursor: pointer; line-height: 1; }
.reset-filters-btn { width: 100%; padding: 12px; border: 1px solid #e0e0e0; border-radius: 12px; background: #f8f9fa; color: #555; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .25s ease; margin-top: 10px; }
.reset-filters-btn:hover { background: #b71c1c; color: white; border-color: #b71c1c; box-shadow: 0 4px 12px rgba(183, 28, 28, 0.2); }
.filter-group { margin-bottom: 20px; }
.filter-group h3 { margin-bottom: 12px; color: #222; font-size: 15px; font-weight: 700; }
.filter-option { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; transition: .2s; font-size: 14px; color: #444; }
.filter-option:hover { color: #b71c1c; }
.filter-option input { width: 18px; height: 18px; accent-color: #b71c1c; cursor: pointer; }
.price-inputs-modern { display: flex; align-items: center; gap: 10px; }
.input-wrapper { position: relative; flex: 1; }
.input-wrapper input { width: 100%; padding: 10px 30px 10px 10px; border: 1px solid #ddd; border-radius: 8px; outline: none; font-size: 14px; }
.input-wrapper input:focus { border-color: #b71c1c; }
.input-wrapper span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #999; font-size: 12px; }
.sidebar hr { border: none; height: 1px; background: #eee; margin: 18px 0; }
.catalog-content { width: 100%; }
.catalog-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; gap: 20px; background: white; padding: 20px 25px; border-radius: 16px; border: 1px solid #eee; box-shadow: 0 4px 20px rgba(0,0,0,0.02); }
.catalog-header h1 { font-size: 26px; color: #111; margin-bottom: 4px;}
.products-count { color: #777; font-size: 13px; margin:0;}
.catalog-actions { display: flex; align-items: center; gap: 15px; }
#sortSelect { padding: 10px 16px; border: 1px solid #ddd; border-radius: 10px; cursor: pointer; font-size: 14px; outline: none; background: white; font-weight: 500; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
.product-card { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.04); border: 1px solid #eee; transition: all .3s; display: flex; flex-direction: column; justify-content: space-between; position: relative; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(0,0,0,.08); border-color: #e0e0e0; }
.image-wrap { height: 200px; width: 100%; display: flex; justify-content: center; align-items: center; position: relative; margin-bottom: 15px; cursor: pointer; background: transparent; }
.image-wrap img { max-width: 100% !important; max-height: 100% !important; object-fit: contain !important; transition: transform 0.3s ease; }
.product-card:hover .image-wrap img { transform: scale(1.04); }
.quick-view-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; opacity: 0; transition: all 0.3s ease; pointer-events: none; border-radius: 12px; }
.quick-view-btn { background: rgba(17, 17, 17, 0.9); color: white; border: none; padding: 10px 20px; border-radius: 30px; font-size: 13px; font-weight: 600; pointer-events: auto; cursor: pointer; transform: translateY(15px); transition: all 0.3s ease; display: flex; align-items: center; gap: 6px; box-shadow: 0 10px 20px rgba(0,0,0,0.15); }
.quick-view-btn:hover { background: #b71c1c !important; }
.image-wrap:hover .quick-view-overlay { opacity: 1; }
.image-wrap:hover .quick-view-btn { transform: translateY(0); }
.product-top { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
.product-title { font-weight: 700; font-size: 15px; color: #222; line-height: 1.3; }
.product-price { font-size: 20px; font-weight: 800; color: #111; display: flex; align-items: baseline; gap: 4px; margin-top: 2px; }
.product-price .price-num { color: #b71c1c; letter-spacing: -0.5px; }
.product-price .price-currency { font-size: 13px; font-weight: 600; color: #777; }
/* ==========================================
   ДИНАМІЧНІ БЕЙДЖІ ТОВАРІВ
   ========================================== */
.badges-container { position: absolute; top: -10px; right: -10px; display: flex; flex-direction: column; gap: 6px; z-index: 10; align-items: flex-end; }
.product-badge { color: white; font-size: 11px; font-weight: bold; padding: 5px 12px; border-radius: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.product-badge.bestseller { background: #ff9f43; }
.product-badge.delivery { background: var(--green); }
.product-badge.new { background: #0066cc; }
.product-buttons { display: flex; gap: 10px; margin-top: 15px; width: 100%; }
.product-buttons a, .product-buttons button { flex: 1; padding: 10px; border-radius: 8px; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.tarlana-btn-secondary { border: 1px solid #ccc; background: white; color: #333; }
.tarlana-btn-secondary:hover { background: #f5f5f5; border-color: #bbb; }
.tarlana-btn-primary { border: none; background: #b71c1c; color: white; font-weight: 700; }
.tarlana-btn-primary:hover { background: #991818; }
.mobile-filter-btn { display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111; color: white; border: none; padding: 12px 25px; border-radius: 30px; font-size: 15px; font-weight: 700; box-shadow: 0 10px 25px rgba(0,0,0,0.25); z-index: 999; align-items: center; gap: 8px; cursor: pointer; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1050; opacity: 0; transition: opacity 0.3s; }
@media (max-width: 1024px) {
    .catalog-page { grid-template-columns: 1fr; padding: 120px 20px 80px; } 
    .catalog-grid { grid-template-columns: repeat(2, 1fr); }
    .sidebar { position: fixed; top: 0; left: -100%; width: 300px; height: 100%; max-width: 85vw; overflow-y: auto; z-index: 1100; border-radius: 0; margin: 0; transform: translateX(0); }
    .sidebar.active { left: 0; }
    .close-sidebar-btn { display: block; }
    .mobile-filter-btn { display: flex; }
    .sidebar-overlay.active { display: block; opacity: 1; }
}
@media (max-width: 768px) {
    .catalog-grid { grid-template-columns: 1fr; }
    .catalog-top { flex-direction: column; align-items: flex-start; }
}


/* Контейнер для кнопок перемикання вигляду */
.view-toggles {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px; /* Відстань між кнопками */
}

/* Переконаємось, що кнопки не розтягуються */
.view-toggles button { 
    background: white; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    padding: 8px; 
    cursor: pointer; 
    transition: 0.2s; 
    color: #777; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 38px; /* Фіксована висота, щоб збігалася з селектом */
    width: 38px;
}

.view-toggles button:hover { background: #f5f5f5; }
.view-toggles button.active { background: #fdf2f2; color: #b71c1c; border-color: #b71c1c; }
/* ==========================================
   СТИЛІ ДЛЯ КНОПОК ПЕРЕМИКАННЯ
   ========================================== */
.view-toggles button { background: white; border: 1px solid #ddd; border-radius: 6px; padding: 6px; cursor: pointer; transition: 0.2s; color: #777; display: flex; align-items: center; justify-content: center; }
.view-toggles button:hover { background: #f5f5f5; }
.view-toggles button.active { background: #fdf2f2; color: #b71c1c; border-color: #b71c1c; }

/* ==========================================
   ВИГЛЯД СПИСКОМ (LIST VIEW)
   ========================================== */
.catalog-grid.list-view { display: flex; flex-direction: column; gap: 20px; }
.catalog-grid.list-view .product-card { flex-direction: row; align-items: center; padding: 20px; gap: 30px; }
.catalog-grid.list-view .image-wrap { width: 220px; height: 180px; margin-bottom: 0; flex-shrink: 0; }
.catalog-grid.list-view .product-top { flex: 1; margin-bottom: 0; }
.catalog-grid.list-view .product-buttons { width: auto; flex-direction: column; justify-content: center; gap: 10px; min-width: 180px; }

/* Мобільна адаптація для вигляду списком */
@media (max-width: 768px) {
    .catalog-grid.list-view .product-card { flex-direction: column; align-items: flex-start; gap: 15px; }
    .catalog-grid.list-view .image-wrap { width: 100%; height: 200px; }
    .catalog-grid.list-view .product-buttons { width: 100%; flex-direction: row; }
}

/* ==========================================
   КНОПКА ФІЛЬТРІВ НА МОБІЛЬНОМУ
   ========================================== */
.sidebar-mobile-footer {
    display: none; /* Ховаємо на ПК */
}

@media (max-width: 1024px) {
    .sidebar-mobile-footer {
        display: block;
        position: sticky;
        bottom: -30px; /* Прилипає до низу меню */
        background: white;
        padding: 15px 0;
        border-top: 1px solid #eee;
        margin-top: 20px;
        z-index: 10;
    }
    .sidebar-mobile-footer button {
        width: 100%;
        padding: 14px;
        font-size: 15px;
        border-radius: 8px;
        display: flex;
        justify-content: center;
        gap: 5px;
    }
    .sidebar {
        padding-bottom: 60px; /* Додаткове місце, щоб контент не ховався за кнопкою */
    }
}

/* ==========================================
   АКТИВНІ ФІЛЬТРИ (ТЕГИ / CHIPS)
   ========================================== */
.active-filters-container { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    margin-bottom: 20px; 
    align-items: center;
}
.active-filters-container:empty { 
    display: none; 
    margin-bottom: 0; 
}
.filter-chip { 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    background: white; 
    border: 1px solid #e0e0e0; 
    padding: 6px 12px; 
    border-radius: 20px; 
    font-size: 13px; 
    color: #555; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.02); 
    transition: all 0.2s ease; 
}
.filter-chip:hover { 
    border-color: #b71c1c; 
    background: #fffafa; 
}
.filter-chip .chip-label { 
    color: #111; 
    font-weight: 700; 
}
.filter-chip-close { 
    background: #f5f5f5; 
    border: none; 
    font-size: 14px; 
    color: #777; 
    cursor: pointer; 
    line-height: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 20px; 
    height: 20px; 
    border-radius: 50%; 
    transition: 0.2s; 
    margin-left: 4px;
}
.filter-chip:hover .filter-chip-close {
    background: #ffe0e0;
    color: #b71c1c;
}
.clear-all-chips { 
    background: transparent; 
    border: none; 
    color: #0066cc; 
    font-size: 13px; 
    font-weight: 600; 
    cursor: pointer; 
    text-decoration: underline; 
    margin-left: 5px; 
    padding: 6px 10px;
}
.clear-all-chips:hover { 
    color: #b71c1c; 
}

/* --- ДОДАТКОВІ ПАДИ (ЖОРСТКА СІТКА 4 В РЯД) --- */
.cp-promo-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Ідеально рівні 4 колонки */
    gap: 10px;
    padding-top: 5px;
}
.cp-promo-option {
    background: white;
    border: 1px solid #f9e3c9;
    border-radius: 8px;
    padding: 10px 6px; 
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: 0.2s;
    box-sizing: border-box;
    cursor: pointer;
    width: 100%;
}
.cp-promo-option:hover {
    border-color: #00a046;
    box-shadow: 0 4px 10px rgba(0,160,70,0.1);
}
.cp-promo-option.selected {
    border-color: #b71c1c;
    box-shadow: 0 4px 10px rgba(183,28,28,0.15);
}
.cp-promo-option img { width: 45px; height: 45px; object-fit: contain; margin: 0 auto; }
.cp-promo-option-name { font-size: 11px; font-weight: 600; line-height: 1.3; color: #333; }
.cp-promo-option-price { font-size: 14px; font-weight: 900; color: #00a046; }
.cp-promo-option-btn {
    background: #00a046; color: white; border: none; padding: 6px; border-radius: 6px; font-size: 11px; font-weight: 700; cursor: pointer; margin-top: auto; transition: 0.2s;
}
.cp-promo-option-btn:hover { background: #008a3c; }
.cp-promo-option.selected .cp-promo-option-btn {
    background: #b71c1c;
}

/* --- WYBRANY PAD W MODALU (СТИЛЬ ЯК У КОШИКУ) --- */
.cp-addon-row {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 15px;
    border: 1px solid #00a046; border-radius: 8px; padding: 10px 15px; background: #f0fdf4;
}
.cp-addon-info { display: flex; align-items: center; gap: 15px; flex: 1; min-width: 0; }
.cp-addon-text-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.cp-addon-name { font-size: 14px; font-weight: 600; color: #444; white-space: normal; }
.cp-addon-badge { background: #00a046; color: white; font-size: 10px; padding: 4px 8px; border-radius: 4px; text-transform: uppercase; font-weight: 800; white-space: nowrap; }
.cp-addon-action { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.cp-addon-price-col { text-align: right; line-height: 1.2; white-space: nowrap; }
.cp-addon-price-col del { font-size: 12px; color: #888; font-weight: 500;}
.cp-addon-price-col strong { font-size: 16px; color: #111; font-weight: 900; }

/* ==========================================
   ЯДЕРНИЙ ФІКС ДЛЯ МОБІЛЬНИХ (ШВИДКИЙ ПЕРЕГЛЯД ТА ЗЕЛЕНИЙ БЛОК)
   ========================================== */
@media (max-width: 900px) {
    /* 1. НАЗАВЖДИ ВБИВАЄМО ШВИДКИЙ ПЕРЕГЛЯД */
    #quickViewModal {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        z-index: -9999 !important;
    }
    
    /* Блокуємо клік по картинці, щоб скрипт навіть не намагався відкрити вікно. 
       (Для переходу на сторінку товару клієнт буде тиснути кнопку "Zobacz") */
    body .catalog-grid .image-wrap {
        pointer-events: none !important;
    }

    /* 2. ЖОРСТКО ЛАМАЄМО СТАРИЙ ДИЗАЙН ЗЕЛЕНОГО БЛОКУ І РОБИМО 2 ПОВЕРХИ */
    body #upsellModalOverlay .cp-addon-row,
    body #cartModalOverlay .cp-addon-row,
    body .rozetka-modal-content .cp-addon-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 15px !important;
        height: auto !important;
        /* ГОЛОВНЕ: ЗНІМАЄМО ЗАБОРОНУ НА ПЕРЕНОС ТЕКСТУ, ЩОБ КНОПКА НЕ ВИЛАЗИЛА */
        white-space: normal !important; 
    }
    
    body .rozetka-modal-content .cp-addon-info {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        margin-bottom: 15px !important;
    }
    
    body .rozetka-modal-content .cp-addon-action {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        border-top: 1px dashed #00a046 !important;
        padding-top: 15px !important;
        margin: 0 !important;
    }
}
/* ==========================================
   ФІКС ДИЗАЙНУ КНОПКИ "ZMIEŃ" (ТЕЛЕФОНИ)
   ========================================== */
@media (max-width: 900px) {
    body .rozetka-modal-content .cp-addon-action button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 8px 16px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        background: #ffffff !important;
        color: #333333 !important;
        border: 1px solid #cccccc !important;
        border-radius: 6px !important;
        white-space: nowrap !important; /* Текст завжди в 1 рядок */
        margin-left: auto !important; /* Жорстко притискаємо кнопку вправо */
        min-width: 80px !important; /* Мінімальна ширина, щоб не була надто дрібною */
    }

    body .rozetka-modal-content .cp-addon-action button:active {
        background: #f0fdf4 !important;
        border-color: #00a046 !important;
        color: #00a046 !important;
    }
}