/* ═══════════════════════════════════════════════════════════════════
   responsive.css — все @media-правила сайта.
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 500px) {
    .ui-toast-container {
        left: 12px;
        right: 12px;
        top: 12px;
        max-width: none;
    }
}

@media (max-width: 1200px) {
    .catalog-layout { grid-template-columns: 1fr 240px; gap: 20px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .checkout-layout { gap: 30px; }
}

@media (max-width: 992px) {
    .app-layout { flex-direction: column; }
    .sidebar { display: none; }
    .main-content { padding: 24px 20px; }

    .catalog-layout { grid-template-columns: 1fr; gap: 24px; }

    .pdp-layout { grid-template-columns: 1fr; gap: 30px; }
    .pdp-sidebar { position: static; padding: 20px; }
    /* Название товара на мобилке показываем над ценой (см. product.css) */
    .pdp-desc-desktop { display: none; }
    .pdp-mobile-desc { display: block; margin-top: 16px; }

    .checkout-page .container { padding: 0 20px; }
    .checkout-layout {
        grid-template-columns: 1fr;
        gap: 24px;
        padding-top: 24px;
        padding-bottom: 24px;
    }
    .checkout-summary { position: static; }

    /* ═══════════════ ПЛАВАЮЩАЯ КНОПКА «ФИЛЬТРЫ» ═══════════════ */
    .mobile-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: fixed;
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        left: 50%;
        z-index: 90;
        width: auto;
        max-width: calc(100vw - 32px);
        padding: 13px 22px;
        background: var(--accent);
        backdrop-filter: blur(16px) saturate(180%);
        -webkit-backdrop-filter: blur(16px) saturate(180%);
        color: #fff;
        border: 1px solid var(--accent);
        border-radius: var(--radius-pill);
        font-family: var(--font-body);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.03em;
        box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.5), 0 4px 12px rgba(0, 0, 0, 0.4) !important;
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(-50%) translateY(20px);
        transition:
            opacity 0.25s ease,
            transform 0.3s cubic-bezier(0.25, 1, 0.5, 1),
            visibility 0.25s ease,
            background 0.2s ease,
            border-color 0.2s ease,
            color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    .mobile-filter-btn.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }
    .mobile-filter-btn:hover,
    .mobile-filter-btn:active {
        background: var(--accent-hover);
        border-color: var(--accent-hover);
        color: #fff;
    }
    .mobile-filter-btn svg {
        width: 18px;
        height: 18px;
        stroke-width: 2;
        flex-shrink: 0;
        pointer-events: none;
    }
    .mobile-filter-btn span { white-space: nowrap; }

    .mobile-filter-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: var(--overlay-filter-bg);
        backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    .mobile-filter-overlay.active { opacity: 1; visibility: visible; }

    .catalog-controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 88vh;
        overflow-y: auto;
        padding: 0 16px 30px;
        background: var(--bg-surface);
        border: none;
        border-radius: 24px 24px 0 0;
        box-shadow: var(--shadow-catalog-mobile);
        z-index: 1000;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
        order: 0;
        top: auto;
    }
    .catalog-controls.active { transform: translateY(0); }

    .filters-mobile-header {
        position: sticky;
        top: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: var(--bg-surface);
        z-index: 10;
        padding: 24px 16px 12px;
        margin: 0 -16px 16px;
        border-radius: 24px 24px 0 0;
    }

    .filters-mobile-header::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 6px;
        background: var(--border);
        border-radius: 3px;
    }

    .filters-title {
        margin: 0;
        font-size: 18px;
    }

    .mobile-filter-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        background: var(--bg-input);
        border: 1px solid var(--border);
        border-radius: 50%;
        color: var(--text-main);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
    }
    .mobile-filter-close:active { background: var(--bg-body); }

    .mobile-filter-apply {
        display: block;
        width: 100%;
        padding: 16px;
        margin-top: 20px;
        background: var(--accent);
        color: #fff;
        border: none;
        border-radius: var(--radius-pill);
        font-family: var(--font-body);
        font-size: var(--text-base);
        font-weight: 500;
        cursor: pointer;
        position: sticky;
        bottom: 0;
        transition: background 0.2s;
    }
    .mobile-filter-apply:active { background: var(--accent-hover); }
}

@media (max-width: 768px) {
    header { padding: 10px 16px; height: 60px; }
    .header-inner { gap: 8px; justify-content: space-between; }
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        margin-left: -8px;
    }
    .logo { flex: 1; min-width: 0; }
    .logo-main {
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
    }
    .logo-img { width: 32px; height: 32px; }
    .logo--compact .logo-img { width: 28px; height: 28px; }
    .header-search { display: none; }
    .header-admin-btn { display: none; }

    .cart-btn {
        padding: 8px;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border);
        position: relative;
        gap: 0;
    }
    .cart-btn .cart-icon { display: block; }
    .cart-btn .cart-btn-text { display: none; }
    .cart-btn .cart-count {
        position: absolute;
        top: -6px;
        right: -6px;
        width: 20px;
        height: 20px;
        font-size: 11px;
        margin: 0;
    }

    .footer-logo .logo-main { font-size: var(--text-xl); }
    .footer-logo .logo-img { width: 40px; height: 40px; }

    .main-content { padding: 16px; }
    .page-title { font-size: var(--text-2xl); }
    .grid { grid-template-columns: repeat(2, 1fr); gap: 32px 20px; }
    .product-img-wrapper { height: 160px; }

    .slider-container { margin: 0 -16px; padding: 0 16px; }
    .slider-track { scroll-padding-left: 16px; gap: 16px; }
    .slider-track .product-card { min-width: 200px; max-width: 200px; }

    .quick-add-btn {
        width: auto;
        height: 36px;
        padding: 0 12px;
        border-radius: var(--radius-pill);
        justify-content: center;
        background: rgba(var(--accent-rgb), 0.95);
        bottom: 6px;
        right: 6px;
    }
    .quick-add-btn svg { width: 16px; height: 16px; }
    .quick-add-btn .quick-add-text {
        display: block;
        font-size: 13px;
        font-weight: 500;
        margin-left: 6px;
        white-space: nowrap;
    }
    .quick-add-btn:hover {
        width: auto;
        padding: 0 12px;
        justify-content: center;
        background: var(--accent);
    }
    .quick-add-btn:hover .quick-add-text { display: block; }

    .cart-panel { border-radius: 0; padding: 20px 16px; }

    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        bottom: 12px;
        left: 12px;
        right: 12px;
        padding: 16px;
        gap: 12px;
    }
    .cookie-banner-actions { flex-direction: column-reverse; }
    .cookie-btn-accept,
    .cookie-btn-necessary { width: 100%; padding: 12px; }

    .checkout-page .container { padding: 0 16px; }
    .checkout-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px 0;
    }
    .checkout-header .close-btn { order: -1; margin-bottom: 8px; font-size: var(--text-sm); }
    .checkout-form-section .form-control { font-size: var(--text-base); padding: 16px 0 12px 0; }
    .date-time-row { grid-template-columns: 1fr !important; gap: 12px !important; }
    .checkout-summary { padding: 20px; }
    .btn-submit { margin-bottom: 20px; }

    /* ← ВОЗВРАЩЕНО «как было» (совпадает с product.css) */
    .pdp-main-image-wrapper { height: 300px; }

    .pdp-zoom-btn { top: 10px; right: 10px; width: 40px; height: 40px; }
    .pdp-zoom-btn svg { width: 18px; height: 18px; }
    .slider-arrow { width: 42px; height: 42px; }
    .slider-arrow svg { width: 20px; height: 20px; }
    .arrow-left { left: 12px; }
    .arrow-right { right: 12px; }
    .pdp-thumb { width: 60px; height: 60px; border-radius: 10px; }
    .pdp-thumbnails { gap: 10px; }

    .pdp-lightbox-prev,
    .pdp-lightbox-next { width: 48px; height: 48px; font-size: 22px; }
    .pdp-lightbox-prev { left: 12px; }
    .pdp-lightbox-next { right: 12px; }
    .pdp-lightbox-close { top: 10px; right: 15px; font-size: 36px; }
    .pdp-lightbox-thumb { width: 50px; height: 50px; }

    .mobile-filter-btn {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        padding: 12px 20px;
        font-size: 13px;
    }

    .price-filter { gap: 8px; padding: 8px 14px; }
    .price-input { max-width: none; }
    .search-suggestions { max-height: 60vh; }
    .search-suggestion { padding: 12px 14px; }
    .search-suggestion img { width: 44px; height: 44px; }

    .reviews-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .reviews-source-link { width: 100%; justify-content: center; }
    .reviews-grid { grid-template-columns: 1fr; }
    .review-card { padding: 18px; }
    .review-head { padding-right: 28px; }
}

@media (max-width: 480px) {
    .grid { grid-template-columns: 1fr; gap: 36px; }
    .product-img-wrapper { height: 260px; }
    .pdp-thumb { width: 50px; height: 50px; }
    .product-title,
    .page-title,
    .pdp-sidebar h1,
    .cart-item-title { word-break: break-word; overflow-wrap: break-word; }
    .checkout-page .container { padding: 0 12px; }
    .checkout-header h2 { font-size: var(--text-lg); }
    .checkout-summary { padding: 16px; }
}