/**
 * Каталог товаров — стили страницы и печати
 *
 * @package avtostart2026
 */

/* ─── Сброс для всей страницы ─────────────────────────────── */
.catalog-pdf-page * { box-sizing: border-box; }

/* ─── Колонтитул печати (скрыт на экране) ─────────────────── */
.cpdf-running-header { display: none; }

/* ─── Обёртка ──────────────────────────────────────────────── */
.catalog-pdf-page {
    max-width: 1140px;
    margin: 0 auto;
    padding: 30px 24px 60px;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    color: #1a1a1a;
}

/* ─── Шапка страницы ───────────────────────────────────────── */
.cpdf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #F05F23;
    padding-bottom: 16px;
    margin-bottom: 24px;
}
.cpdf-header-left { display: flex; align-items: center; gap: 16px; }
.cpdf-logo img { max-height: 52px; width: auto; }
.cpdf-logo-text {
    font-size: 22px; font-weight: 900; letter-spacing: -1px; color: #2D3444;
}
.cpdf-logo-text span { color: #F05F23; }
.cpdf-title {
    font-size: 18px; font-weight: 700; color: #2D3444; margin: 0;
}
.cpdf-meta {
    font-size: 11px; color: #888; margin-top: 3px;
}
.cpdf-header-right { text-align: right; }
.cpdf-print-btn {
    background: #F05F23; color: #fff; border: none; border-radius: 8px;
    padding: 10px 20px; font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit; transition: background .2s;
    display: inline-flex; align-items: center; gap: 6px;
}
.cpdf-print-btn:hover { background: #d14d17; }
.cpdf-print-hint { font-size: 10px; color: #aaa; margin-top: 5px; }

/* ─── Статистика ────────────────────────────────────────────── */
.cpdf-stats {
    display: flex; gap: 24px; margin-bottom: 28px;
    background: #f8f8f8; border-radius: 8px; padding: 12px 16px;
    font-size: 12px; color: #555;
}
.cpdf-stats strong { color: #2D3444; font-size: 15px; display: block; }

/* ─── Секция категории ──────────────────────────────────────── */
.cpdf-section { margin-bottom: 36px; }

.cpdf-cat-heading {
    background: #2D3444;
    color: #fff;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cpdf-cat-heading .cat-count {
    font-size: 11px; font-weight: 400; opacity: .7;
}

/* ─── Таблица товаров ───────────────────────────────────────── */
.pdf-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ddd;
    border-top: none;
}
.pdf-table thead th {
    background: #f0f0f0;
    color: #555;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 7px 10px;
    border: 1px solid #ddd;
    text-align: left;
}
.pdf-table td {
    padding: 8px 10px;
    border: 1px solid #e8e8e8;
    vertical-align: middle;
}
.pdf-table tbody tr:nth-child(even) td { background: #fafafa; }
.pdf-table tbody tr:hover td { background: #fff8f5; }

/* Колонка: Фото */
.pdf-col-img { width: 96px; text-align: center; }
.pdf-col-img img {
    width: 90px; height: 90px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #eee;
    background: #fff;
}
.pdf-col-img .no-img {
    width: 90px; height: 90px;
    display: flex; align-items: center; justify-content: center;
    background: #f5f5f5; border-radius: 4px; border: 1px solid #eee;
    font-size: 24px; color: #ccc;
    margin: 0 auto;
}

/* Колонка: Название + Арт. */
.pdf-col-name { min-width: 220px; }
.pdf-prod-name {
    font-weight: 600; font-size: 12px; color: #2D3444;
    line-height: 1.35; margin-bottom: 3px;
}
.pdf-prod-sku { font-size: 10px; color: #999; }

/* Колонка: Описание */
.pdf-col-desc { color: #555; font-size: 11px; line-height: 1.5; max-width: 340px; }

/* Колонка: Цена (розница) */
.pdf-col-price {
    width: 78px; text-align: right; white-space: nowrap;
    font-weight: 700; font-size: 11px; color: #F05F23;
}

/* Колонка: Оптовая цена */
.pdf-col-wholesale {
    color: #2D3444 !important;
}
.pdf-col-wholesale .no-wholesale { color: #ccc; font-weight: 400; }

/* Подкатегория — хлебная крошка */
.cpdf-subcat-heading {
    background: #edf0f7;
    color: #2D3444;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    border-left: 4px solid #F05F23;
    border-top: 2px solid #dde2ee;
    border-bottom: 1px solid #dde2ee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}
.cpdf-subcat-heading .subcat-breadcrumb { display: flex; align-items: center; gap: 0; }
.cpdf-subcat-heading .subcat-parent { color: #8896b0; font-weight: 500; font-size: 12px; }
.cpdf-subcat-heading .subcat-arrow { color: #F05F23; margin: 0 5px; font-weight: 400; }
.cpdf-subcat-heading .subcat-name { color: #2D3444; font-weight: 700; font-size: 14px; }
.cpdf-subcat-heading .subcat-count {
    font-size: 11px; font-weight: 400; color: #8896b0; white-space: nowrap;
}

/* Колонка: QR-код */
.pdf-col-qr { width: 100px; text-align: center; }
.pdf-col-qr img { width: 90px; height: 90px; display: block; margin: 0 auto; }

/* ─── Подвал страницы ───────────────────────────────────────── */
.cpdf-footer {
    margin-top: 40px;
    border-top: 1px solid #ddd;
    padding-top: 14px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #aaa;
}

/* ─── ПЕЧАТЬ (@media print) ────────────────────────────────── */
@media print {
    /* Скрыть кнопки, основную шапку сайта */
    .cpdf-print-btn,
    .cpdf-print-hint,
    .cpdf-header,
    .cpdf-stats,
    .site-header,
    .site-footer,
    .topbar,
    .breadcrumb-section,
    #back-to-top { display: none !important; }

    /* Колонтитул — фиксированный, повторяется на каждой странице */
    .cpdf-running-header {
        display: flex !important;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 36px;
        background: #fff;
        border-bottom: 2px solid #F05F23;
        align-items: center;
        justify-content: space-between;
        padding: 0 14px;
        font-size: 8pt;
        color: #555;
        z-index: 9999;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .rh-left { display: flex; align-items: center; gap: 10px; }
    .rh-logo { height: 24px; width: auto; }
    .rh-title { font-weight: 700; font-size: 9pt; color: #2D3444; }
    .rh-right { font-size: 8pt; color: #888; }

    body {
        margin: 0;
        font-size: 9pt;
        color: #000;
        background: #fff;
    }

    .catalog-pdf-page {
        max-width: 100%;
        padding: 0;
        padding-top: 44px; /* отступ под колонтитул */
    }

    /* Заголовок категории — сохранить фоновый цвет */
    .cpdf-cat-heading {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-radius: 0;
    }

    /* Не разрывать строку товара между страницами */
    .pdf-table tbody tr { page-break-inside: avoid; }

    /* Перед каждой новой категорией — мягкий разрыв */
    .cpdf-section { page-break-inside: avoid; }
    .cpdf-section + .cpdf-section { page-break-before: auto; }

    /* Подкатегория — сохранить фон и цвета */
    .cpdf-subcat-heading {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-left-color: #F05F23;
    }
    .cpdf-subcat-heading .subcat-arrow { color: #F05F23; }

    /* Изображение в печати */
    .pdf-col-img img,
    .pdf-col-img .no-img { width: 72px; height: 72px; }
    .pdf-col-img { width: 78px; }

    /* Цена в печати */
    .pdf-col-price { width: 65px; font-size: 9pt; }

    /* Таблица — чёткие границы */
    .pdf-table, .pdf-table td, .pdf-table th {
        border-color: #ccc !important;
    }
    .pdf-table tbody tr:nth-child(even) td {
        background: #f9f9f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Шапка и подвал страницы */
    .cpdf-header { margin-bottom: 12px; padding-bottom: 8px; }
    .cpdf-stats { padding: 6px 10px; }
    .cpdf-footer { margin-top: 16px; }

    /* QR в печати — минимум 22мм для сканирования */
    .pdf-col-qr { width: 24mm; }
    .pdf-col-qr img { width: 22mm; height: 22mm; }
}
