/* ============================================
   ПОЛИГРАФИЯ
   ============================================ */

.poligrafiya-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 640px;
    margin: 24px auto;
}

.poligrafiya-card {
    display: block;
    text-decoration: none !important;
    color: var(--dark);
    margin-bottom: 24px;
}

.poligrafiya-card__title {
    margin-bottom: 12px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    color: var(--dark);
}

.poligrafiya-card__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.poligrafiya-card:hover .poligrafiya-card__image {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(55, 140, 219, 0.14);
}

.poligrafiya-form-block {
    width: 100%;
    max-width: 640px;
    margin: 40px auto 0;
}

.poligrafiya-selected-type {
    margin: 0 0 16px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(55, 140, 219, 0.06);
}

.poligrafiya-card.is-selected {
    color: var(--accent);
}

.poligrafiya-card.is-selected .poligrafiya-card__title {
    color: var(--accent);
}

.poligrafiya-card.is-selected .poligrafiya-card__image {
    box-shadow: 0 0 0 3px var(--accent);
}

@media (max-width: 768px) {
    .poligrafiya-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .poligrafiya-card__title {
        font-size: 18px;
    }

    .poligrafiya-form-block {
        max-width: none;
        margin-top: 24px;
    }
}

/* ============================================
   КАТАЛОГ
   ============================================ */

/* ── Шапка страницы ── */
.page-catalog {
    padding-top: 32px;
    padding-bottom: 80px;
}

.catalog-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 48px;
}

.catalog-main h1 {
    font-size: 48px;
    font-weight: 900;
    color: var(--dark);
    white-space: normal;
    word-break: break-word;
    margin-top: 0;
    margin-bottom: 24px;
}

.catalog-header .line-separator {
    width: 100%;
    height: 2px;
    background: var(--dark);
    opacity: 0.1;
}

/* ── Фильтры ── */
.catalog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 40px;
}

.filter-btn {
    padding: 8px 20px;
    border-radius: 999px;
    border: 1.5px solid rgba(55, 140, 219, 0.25);
    background: transparent;
    color: var(--dark);
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition:
        background 0.25s,
        border-color 0.25s,
        color 0.25s;
    white-space: nowrap;
}

.filter-btn:hover {
    background: rgba(55, 140, 219, 0.08);
    border-color: var(--primary);
}

.filter-btn.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ── Сетка товаров ── */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* ── Карточка товара ── */
.product-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(55, 140, 219, 0.1);
    display: flex;
    flex-direction: column;
    transition:
        transform 0.3s,
        box-shadow 0.3s;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(55, 140, 219, 0.15);
}

/* Картинка */
.product-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgba(55, 140, 219, 0.06);
    position: relative;
    overflow: hidden;
}

.product-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(55, 140, 219, 0);
    transition: background 0.3s;
}

.product-card:hover .product-image::after {
    background: rgba(55, 140, 219, 0.06);
}

/* Бейдж категории */
.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 999px;
    z-index: 2;
}

/* Контент карточки */
.product-body {
    padding: 16px 18px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.product-category {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    opacity: 0.8;
}

h1.product-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.3;
    margin: 0;
}

.product-card .product-title {
    font-size: 16px !important;
    line-height: 1.1;
}

.product-desc {
    font-size: 13px;
    line-height: 1.2 !important;
    color: var(--dark);
    opacity: 0.7;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* Нижняя строка карточки */
.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid rgba(55, 140, 219, 0.1);
}

.product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
    opacity: 0.6;
}

.product-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-family: var(--font-main);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    text-decoration: none !important;
    cursor: pointer;
    transition:
        background 0.25s,
        color 0.25s;
    white-space: nowrap;
}

.product-btn:hover {
    background: var(--accent);
    color: #fff;
}

/* ── Пустой каталог ── */
.catalog-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    opacity: 0.5;
    font-size: 18px;
    font-weight: 700;
}

/* ── Пагинация ── */
.catalog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 60px;
    flex-wrap: wrap;
}

.catalog-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid rgba(55, 140, 219, 0.2);
    color: var(--dark);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition:
        background 0.2s,
        border-color 0.2s,
        color 0.2s;
}

.catalog-pagination .page-numbers:hover,
.catalog-pagination .page-numbers.current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.catalog-pagination .page-numbers.dots {
    border: none;
    background: none;
    cursor: default;
}

.product-btn--disabled {
    font-size: 12px;
    border: none;
    color: var(--dark);
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.product-btn--added {
    background: rgba(55, 140, 219, 0.12);
    border-color: var(--primary);
    color: var(--primary) !important;
}

.product-btn--added:hover {
    background: var(--primary);
    color: #fff !important;
}

@media (max-width: 1400px) {
    .catalog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1200px) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .catalog-main h1 {
        font-size: 32px;
    }
}

@media (max-width: 768px) {
    .catalog-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .catalog-main h1 {
        font-size: 24px;
        white-space: normal;
    }

    .product-image {
        aspect-ratio: 16 / 9;
    }
}

/* ==========================
   Главные разделы каталога
   ========================== */
.catalog-sections {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.catalog-section-card {
    position: relative;
    display: block;
    flex: 0 0 280px;
    width: 280px;
    max-width: 280px;
    height: 160px;
    padding: 24px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none !important;
    color: #fff;
    background: var(--primary);
    border: 1px solid rgba(55, 140, 219, 0.12);
    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease;
}

.catalog-section-card::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    left: -60px;
    top: -60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    z-index: 0;
    transition: transform 0.5s ease;
}

.catalog-section-card::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    right: -40px;
    bottom: -40px;
    border-radius: 50%;
    background: rgba(250, 107, 5, 0.18);
    z-index: 0;
    transition: transform 0.5s ease;
}

.catalog-section-card__inner {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalog-section-card__label {
    display: none;
}

.catalog-section-card__title {
    font-size: 24px;
    line-height: 1.05;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    max-width: 100%;
}

.catalog-section-card__text {
    display: none;
}

.catalog-section-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 18px 44px rgba(55, 140, 219, 0.22);
}

.catalog-section-card:hover::before {
    transform: translate(24px, 18px) scale(1.08);
}

.catalog-section-card:hover::after {
    transform: translate(-18px, -20px) scale(1.12);
}

.catalog-mobile-toggle {
    display: none;
}

.catalog-mobile-popup {
    display: none;
}

.catalog-search-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.catalog-search-input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1.5px solid rgba(55, 140, 219, 0.2);
    background: #fff;
    color: var(--dark);
    font-family: var(--font-main);
    font-size: 14px;
    outline: none;
}

.catalog-search-input:focus {
    border-color: var(--primary);
}

.catalog-search-result-title {
    margin-bottom: 28px;
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
}

.catalog-mobile-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.catalog-mobile-header h1 {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 0 24px 0;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.catalog-mobile-toggle svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 1024px) {
    .catalog-sections {
        gap: 16px;
    }

    .catalog-section-card {
        flex: 0 0 240px;
        width: 240px;
        max-width: 240px;
        padding: 24px;
    }

    .catalog-section-card__title {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .page-catalog {
        padding-top: 20px;
        padding-bottom: 48px;
    }

    .catalog-header {
        display: block;
        margin-bottom: 28px;
    }

    .catalog-main h1 {
        font-size: 32px;
    }

    .catalog-search-input {
        flex: none !important;
    }

    .catalog-filters {
        gap: 8px;
        margin-bottom: 24px;
    }

    .filter-btn {
        font-size: 12px;
        padding: 7px 14px;
    }

    .catalog-sections {
        gap: 12px;
    }

    .catalog-section-card {
        flex: 0 0 calc(50% - 6px);
        width: calc(50% - 6px);
        max-width: none;
        padding: 20px;
    }

    .catalog-section-card__title {
        font-size: 20px;
        line-height: 1.05;
    }

    .catalog-search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .catalog-search-form .product-btn {
        justify-content: center;
        text-align: center;
        height: 40px;
        font-size: 14px;
    }

    .catalog-search-result-title {
        font-size: 16px;
        margin-bottom: 20px;
    }

    .catalog-mobile-header h1 {
        display: block;
        font-size: 32px;
        line-height: 1.05;
    }

    .catalog-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
        border: 1.5px solid var(--accent);
        background: transparent;
        color: var(--accent);
        cursor: pointer;
    }

    .catalog-sidebar {
        display: none;
    }

    .catalog-mobile-popup.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9999;
    }

    .catalog-mobile-popup__overlay {
        position: absolute;
        inset: 0;
        background: rgba(43, 42, 41, 0.6);
        backdrop-filter: blur(6px);
    }

    .catalog-mobile-popup__panel {
        position: absolute;
        inset: 0;
        background: #dbeeff;
        padding: 80px 24px 32px;
        overflow-y: auto;
    }

    .catalog-mobile-popup__close {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        color: var(--dark);
        font-size: 34px;
        line-height: 1;
        cursor: pointer;
    }

    .catalog-mobile-popup .catalog-sidebar-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .catalog-mobile-popup .catalog-sidebar-link {
        font-size: 18px;
        font-weight: 800;
        text-decoration: none;
        color: var(--dark);
    }
}

/* ==========================
   Меню каталога
   ========================== */
.catalog_submenu {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.catalog_submenu .menu-item {
    position: relative;
    display: block;
    width: 220px;
}

.catalog_submenu .menu-item img {
    width: 100%;
    display: block;
    transition: opacity 0.2s;
}

.img-hover {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.catalog_submenu .menu-item:hover .img-hover {
    opacity: 1;
}

.catalog_submenu .menu-item:hover .img-default {
    opacity: 0;
}

@media (max-width: 768px) {
    .catalog_submenu {
        gap: 12px;
    }

    .catalog_submenu .menu-item {
        width: 48%;
    }

    .catalog_submenu .menu-item .img-default {
        opacity: 1 !important;
    }
}

/* ==========================
   Сайдбар каталога
   ========================== */
.catalog-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

.catalog-sidebar {
    position: sticky;
    top: 20px;
    background: rgba(55, 140, 219, 0.06);
    border: 1px solid rgba(55, 140, 219, 0.12);
    border-radius: var(--radius-md);
    padding: 20px;
}

.catalog-sidebar-list,
.catalog-sidebar-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.catalog-sidebar-item+.catalog-sidebar-item {
    margin-top: 14px;
}

.catalog-sidebar-link,
.catalog-sidebar-sublink {
    display: block;
    text-decoration: none;
    color: var(--dark);
}

.catalog-sidebar-link {
    font-size: 15px;
    font-weight: 800;
}

.catalog-sidebar-sublink {
    font-size: 14px;
    opacity: 0.75;
    padding-left: 14px;
    margin-top: 8px;
}

.catalog-sidebar-link.is-active,
.catalog-sidebar-sublink.is-active {
    color: var(--accent);
}

.catalog-main {
    min-width: 0;
}

.catalog-main-header {
    margin-bottom: 28px;
}

.catalog-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    opacity: 0.7;
}

.catalog-breadcrumbs a {
    color: var(--dark);
    text-decoration: none;
}

.catalog-breadcrumbs a:hover {
    color: var(--accent);
}

.catalog-title {
    margin: 0;
    font-size: 40px;
    font-weight: 900;
    color: var(--dark);
}

@media (max-width: 768px) {
    .catalog-title {
        font-size: 28px;
    }

    .catalog-layout {
        grid-template-columns: 1fr;
    }

    .catalog-sidebar {
        position: static;
    }
}

/* ============================================
   product.php
   ============================================ */
.product-layout {
    display: flex;
    gap: 40px;
}

.product-buy-block {
    margin: 20px 0 25px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.product-gallery {
    width: 50%;
}

.product-main-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    margin-bottom: 12px;
}

.product-thumbs {
    display: flex;
    gap: 8px;
}

.product-thumb {
    width: 70px;
    height: 70px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    cursor: pointer;
}

.product-info {
    width: 50%;
}

.product-info .title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.product-info .sku {
    font-size: 14px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.product-info .price {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 20px;
    opacity: 1;
}

.product-info .price ins {
    text-decoration: none;
}

.product-info .price del {
    display: block;
    font-size: 18px;
    color: var(--dark);
    opacity: 0.5;
}

.product-info .description {
    margin-bottom: 20px;
}

/* ===== Сетка атрибутов ===== */
.product-info .attributes {
    margin: 25px 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

/* Карточка */
.product-attr {
    padding: 14px 16px;
    background: #f8f8f8;
    border-radius: 12px;
    transition: 0.2s;
}

/* Ховер */
.product-attr:hover {
    background: #f1f1f1;
}

/* Название сверху */
.attr-name {
    font-size: 13px;
    color: #888;
    margin-bottom: 4px;
}

/* Значение снизу */
.attr-value {
    font-size: 15px;
    font-weight: 600;
    color: #111;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .product-layout {
        flex-direction: column;
        gap: 24px;
    }

    .product-gallery,
    .product-info {
        width: 100%;
    }

    .product-attributes {
        grid-template-columns: 1fr;
    }
}

/* ===== Секции ===== */
.product-section {
    margin-top: 40px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* ===== Сетка товаров ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Карточка */
.product-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Картинка */
.product-card-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    margin-bottom: 8px;
}

/* Название */
.product-card-title {
    font-size: 14px;
    margin-bottom: 4px;
}

/* Цена */
.product-card-price {
    font-weight: 600;
}

/* Мобилка */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}