/* ============================================================
   RESPONSIVE — глобальные адаптивные правила
   Точно под реальную разметку (partials/*.html + storefront.js)
   ============================================================ */

/* ==================== ПЛАНШЕТ (≤ 1100px) ==================== */
@media (max-width: 1100px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar-filters {
        flex: 0 0 200px;
    }

    /* Быстрый просмотр — компактнее */
    .product-modal-body {
        flex-direction: column;
    }

    .product-modal-gallery {
        border-right: none;
        border-bottom: 1px solid var(--color-line);
    }

    .product-modal-stage {
        min-height: 320px;
    }

    .product-modal-details {
        padding: 24px;
    }
}

/* ==================== МОБИЛЬНЫЙ (≤ 768px) ==================== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    /* Каталог — на мобильных фильтры скрыты, открываются кнопкой «Фильтры» */
    .catalog-layout {
        flex-direction: column;
        gap: 20px;
        padding: 20px 0 40px;
        position: relative;
    }

    /* Показываем кнопку «Фильтры» и заголовок панели только на мобильных */
    .filters-toggle-btn {
        display: inline-flex;
    }

    .filters-panel-header {
        display: flex;
    }

    .sidebar-filters {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1301;
        width: min(340px, 88vw);
        height: 100%;
        max-height: none;
        overflow-y: auto;
        margin: 0;
        padding: 18px;
        transform: translateX(-105%);
        transition: transform 0.3s ease;
        border-right: 1px solid var(--color-line);
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.15);
    }

    body.filters-open .sidebar-filters {
        transform: translateX(0);
    }

    .filters-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1300;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    body.filters-open .filters-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.filters-open {
        overflow: hidden;
    }

    .catalog-content {
        width: 100%;
    }

    .catalog-controls {
        flex-wrap: wrap;
        margin-bottom: 16px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 12px;
    }

    /* Быстрый просмотр — в столбик */
    .product-modal {
        width: 94vw;
        max-width: 420px;
    }

    /* Модалки — шире под весь экран */
    .checkout-modal,
    .success-modal {
        max-height: 94vh;
    }

    /* Шторка корзины — на весь экран */
    .cart-drawer {
        width: 100%;
        max-width: 100%;
    }
}

/* ==================== МЕЛКИЕ ЭКРАНЫ (≤ 400px) ==================== */
@media (max-width: 400px) {
    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 18px 10px;
    }

    .product-title {
        font-size: 13px;
    }

    .quick-add {
        font-size: 10px;
        padding: 8px;
    }

    .catalog-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==================== ПЕЧАТЬ ==================== */
@media print {

    .main-header,
    .utility-bar,
    .site-footer,
    .cart-overlay,
    .cart-drawer,
    .modal-overlay,
    .checkout-modal,
    .product-modal,
    .success-modal,
    .cart-toast,
    .sidebar-filters,
    .quick-add {
        display: none !important;
    }

    .catalog-layout {
        padding: 0;
        display: block;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}