/* ========================================
   ФОРМАТ-ПОЛИМЕР — ОСНОВНЫЕ СТИЛИ
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #a6a7a9;
    color: #2c3e50;
    line-height: 1.6;
}

/* Высота липкой шапки. Точное значение меряет navigation.js и кладёт
   в эту переменную: шапка неодинакова (70 px на 1440 px, 87 px на 1280 px,
   133 px на 1024 px, когда меню переносится на вторую строку).
   От неё зависят sticky-панели каталога и корзины — они не должны
   заезжать под шапку. */
:root {
    --header-h: 70px;
}

/* ========================================
   ШАПКА
   ======================================== */
header {
    background: linear-gradient(135deg, #1a252f, #2c3e50);
    color: rgb(248, 248, 246);
    padding: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.header-container {
    /* Шапка — во всю ширину экрана. Раньше max-width был 1200px (как у
       контента), и разделы меню не помещались в одну строку: «FAQ» и
       «Доставка» уезжали на вторую строку, а при прокрутке меняли
       расположение ещё и по вертикали. */
    max-width: none;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
    padding: 0 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    /* Постоянная ширина: логотип при прокрутке уменьшается, но пункты
       меню не должны от этого сдвигаться. */
    min-width: 110px;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff, #dc7a6fc4, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text-fallback {
    display: none;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Логотип занимает всю высоту шапки.
   Раньше высота 50px была зашита в JS (shop/settings.js), из-за чего
   логотип занимал меньше двух третей шапки. Теперь размер задаёт CSS —
   поменяем высоту шапки, логотип подстроится сам. */
.site-logo {
    display: block;
    height: 70px;          /* = min-height .header-container */
    width: auto;
    max-width: 320px;
    object-fit: contain;
    object-position: left center;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: center;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 1rem;
    white-space: nowrap;
}

.main-nav a:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.cart-link {
    text-decoration: none;
}

.cart-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: linear-gradient(135deg, #e3c43d, #c0392b);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    color: white;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.cart-badge:hover {
    transform: scale(1.05);
}

.phone-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.12);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    text-decoration: none;
    color: white;
    transition: all 0.3s;
}

.phone-link:hover {
    background: rgba(255,255,255,0.25);
}

/* Ссылка «Войти / Кабинет» в header */
.account-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.12);
    padding: 0.4rem 0.9rem;
    border-radius: 30px;
    text-decoration: none;
    color: white;
    font-size: 0.9rem;
    transition: all 0.3s;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.account-link:hover {
    background: rgba(255,255,255,0.25);
}
.account-link.logged-in {
    background: rgba(16, 185, 129, 0.25); /* зелёный — залогинен */
}
.account-link.logged-in:hover {
    background: rgba(16, 185, 129, 0.4);
}
.account-icon { font-size: 1rem; }
.account-text {
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 768px) {
    .account-text { display: none; }
    .account-link { padding: 0.4rem 0.6rem; }
}

/* ========================================
   ОБЪЯВЛЕНИЯ
   ======================================== */
.announcement-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 12px;
    animation: slideDown 0.9s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.announcement-content {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    flex: 1;
}

.announcement-icon {
    font-size: 1.5rem;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.announcement-title {
    font-weight: bold;
    font-size: 1.1rem;
}

.announcement-link {
    background: rgba(255,255,255,0.2);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    transition: all 0.3s;
}

.announcement-link:hover {
    background: rgba(255,255,255,0.3);
}

.announcement-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 50%;
    opacity: 0.7;
    transition: all 0.3s;
}

.announcement-close:hover {
    opacity: 1;
    background: rgba(0,0,0,0.1);
}

/* ========================================
   ОСНОВНОЙ КОНТЕНТ
   ======================================== */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Фильтры */
.filters {
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.filters h4 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #555;
}

.filter-category, .filter-material {
    background: #ecf0f1;
    border: none;
    padding: 0.3rem 0.85rem;
    margin-right: 0.5rem;
    margin-bottom: 0.35rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.88rem;
}

.filter-category:hover, .filter-material:hover {
    background: #bdc3c7;
}

.filter-category.active, .filter-material.active {
    background: #e74c3c;
    color: white;
    font-weight: bold;
}

/* Названия материалов — длинные и разной длины («Полиацеталь-сополимер»),
   поэтому пилюли прыгали по ширине и текст не выравнивался.
   Материалы рендерим ровным списком на всю ширину: название слева,
   счётчик прижат вправо. Категории остаются короткими пилюлями. */
.filter-material {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    margin-right: 0;
    text-align: left;
    border-radius: 10px;
    font-size: 0.83rem;
    line-height: 1.25;
    padding: 0.28rem 0.6rem;
}

.filter-material > .filter-count {
    flex-shrink: 0;
    margin-left: auto;
}

/* Счётчик товаров в кнопках фильтров */
.filter-count {
    opacity: 0.65;
    font-weight: normal;
    margin-left: 2px;
    font-size: 0.85em;
}
.filter-category.active .filter-count,
.filter-material.active .filter-count {
    opacity: 0.9;
}

/* ========== ФИЛЬТРЫ v2: диаметр, толщина, сортировка, сброс ========== */
.filter-select {
    padding: 0.45rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    color: #334155;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-select:hover {
    border-color: #94a3b8;
}
.filter-select:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
}
.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #e74c3c;
    cursor: pointer;
}

.filter-select-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #334155;
}

.filter-reset-btn {
    background: #94a3b8;
    color: white;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}
.filter-reset-btn:hover {
    background: #64748b;
}

.toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.toolbar-filters h4 {
    width: 100%;
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    .filter-select, .filter-reset-btn {
        width: 100%;
        margin-right: 0;
    }
    .toolbar-filters {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ========================================
   КАТАЛОГ
   ======================================== */
.main-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.filters-sidebar {
    flex: 0 0 240px;
    min-width: 240px;
    position: sticky;
    /* Отступ от липкой шапки: панель не должна уезжать под неё. */
    top: calc(var(--header-h) + 1rem);
}

/* Белая карточка фильтров: ограничение по высоте и прокрутка — ВНУТРИ неё.
   Раньше max-height/overflow стояли на .filters-sidebar, и белая карточка
   обрезалась по нижнему краю — содержимое «вылезало» из белой области. */
.filters-details {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 0.5rem;
    max-height: calc(100vh - var(--header-h) - 2rem);
    overflow-y: auto;
}

/* Тонкий скроллбар внутри белой карточки — чтобы было видно, что блок
   прокручивается, и он не выглядел «оборванным». */
.filters-details::-webkit-scrollbar {
    width: 8px;
}
.filters-details::-webkit-scrollbar-track {
    background: transparent;
}
.filters-details::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.filters-details::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.filters-summary {
    cursor: pointer;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    color: #334155;
    user-select: none;
    list-style: none;
}
.filters-summary::-webkit-details-marker { display: none; }
.filters-summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
    color: #94a3b8;
    font-size: 0.7rem;
}
.filters-details[open] .filters-summary::before {
    transform: rotate(90deg);
}

.filters-sidebar .filters {
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    border-top: 1px solid #f1f5f9;
}
.filters-sidebar .filters:first-of-type {
    border-top: none;
    padding-top: 0.6rem;
}
.filters-sidebar .filters h4 {
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: #475569;
}

/* Селекты в боковой колонке — во всю ширину карточки.
   Раньше select сортировки стоял рядом с подписью («Сортировка: [select]»)
   inline-flex-строкой и не помещался в 224px — текст обрезался. */
.filters-sidebar .filter-select {
    display: block;
    width: 100%;
    min-width: 0;
    margin-right: 0;
}

.filters-sidebar .filter-select-label {
    display: block;
    width: 100%;
    margin-right: 0;
    margin-bottom: 0.6rem;
}

.filters-sidebar .filter-select-label .filter-select {
    margin-top: 4px;
}

.filters-sidebar .filter-checkbox {
    display: flex;
    width: 100%;
    margin-right: 0;
    margin-bottom: 0.6rem;
}

.filters-sidebar .filter-reset-btn {
    width: 100%;
}

/* Заголовок страницы (H1) и вводный текст.
   Раньше на главной не было ни одного H1 — поисковик не видел темы страницы.
   На карточке товара H1 ставит сервер (services/pageMeta.js) и клиент. */
/* ---------- Лендинги категорий (/catalog/...) ---------- */
#catalog-landing-bottom { margin: 1.5rem 0 0; }
.landing-breadcrumbs { margin: 0 0 1rem; font-size: 0.9rem; color: #64748b; }
.landing-breadcrumbs .breadcrumb-link { color: #1d4ed8; text-decoration: none; }
.landing-breadcrumbs .breadcrumb-link:hover { text-decoration: underline; }
.landing-breadcrumbs .breadcrumb-current { color: #334155; }
.landing-text {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin: 0 0 1.25rem;
}
.landing-text h2 { font-size: 1.15rem; color: #2c3e50; margin: 0 0 0.75rem; }
.landing-text p { margin: 0; line-height: 1.6; color: #475569; white-space: pre-wrap; }
.landing-links { margin: 0 0 1.25rem; }
.landing-links h2 { font-size: 1.05rem; color: #2c3e50; margin: 0 0 0.6rem; }
.landing-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}
.landing-links a { color: #1d4ed8; text-decoration: none; border-bottom: 1px solid #bfdbfe; }
.landing-links a:hover { border-bottom-color: #1d4ed8; }
.landing-count { color: #94a3b8; font-size: 0.85em; }
.footer-materials-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.9rem;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #94a3b8;
}
.footer-materials-nav a { color: #cbd5e1; text-decoration: none; }
.footer-materials-nav a:hover { color: #ffffff; text-decoration: underline; }

.seo-page-title {
    font-size: 1.6rem;
    color: #2c3e50;
    margin: 0 0 0.5rem;
    line-height: 1.25;
}
.seo-page-lead {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0 0 1.25rem;
    line-height: 1.5;
    /* Лид теперь во всю ширину контейнера — читать длинную строку
       неудобно, ограничиваем ширину. */
    max-width: 780px;
}
/* Заголовок и лид — над тремя колонками (фильтры / каталог / корзина).
   Раньше блок стоял внутри центральной колонки, и боковые панели
   начинались выше карточек товаров на всю высоту заголовка. */
#seo-intro {
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .seo-page-title { font-size: 1.3rem; }
}

.catalog-section {
    flex: 1 1 400px;
    min-width: 280px;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s;
    text-align: center;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.product-images {
    margin-bottom: 1rem;
    position: relative;
}

/* Иконка сертификата — маленький бейдж в правом верхнем углу карточки */
.cert-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    font-size: 1.05rem;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s, background 0.15s;
}
.cert-badge:hover {
    transform: scale(1.12);
    background: #dbeafe;
}

.main-img {
    max-width: 100%;
    height: 150px;
    object-fit: contain;
}

.product-card h3 {
    font-size: 1rem;
    margin: 0.5rem 0;
    min-height: 2.5rem;
    color: #2c3e50;
}

.material {
    color: #666;
    font-size: 0.85rem;
    margin: 0.25rem 0;
}

.price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e74c3c;
    margin: 0.5rem 0;
}

.details-btn {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: #e74c3c;
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.details-btn:hover {
    background: #c0392b;
    transform: scale(1.02);
}

/* ========================================
   САЙДБАР КОРЗИНЫ
   ======================================== */
.cart-sidebar {
    flex: 1;
    min-width: 300px;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    height: fit-content;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.cart-sidebar h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: #2c3e50;
}

.cart-summary {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.cart-action-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.order-btn {
    flex: 1;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.order-btn:hover {
    background: #c0392b;
}

.consent-checkbox {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.4;
    cursor: pointer;
    padding: 0.5rem 0;
}
.consent-checkbox input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.consent-checkbox a {
    color: #3b82f6;
    text-decoration: underline;
}
.consent-checkbox a:hover { color: #1e40af; }

/* ========== Промокод (checkout) ========== */
.promo-block {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #e2e8f0;
}
.promo-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0.4rem;
}
.promo-input-row {
    display: flex;
    gap: 0.4rem;
}
.promo-input-row input {
    flex: 1;
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    text-transform: uppercase;
    background: #fff;
}
.promo-input-row input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.promo-apply-btn {
    padding: 0.55rem 0.9rem;
    background: #3b82f6;
    color: #fff;
    border: 0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.promo-apply-btn:hover:not(:disabled) { background: #1e40af; }
.promo-apply-btn:disabled { background: #94a3b8; cursor: wait; }
.promo-message {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    min-height: 1.2em;
}
.promo-message.error { color: #e74c3c; }
.promo-message.success { color: #16a34a; }
.promo-label-inline {
    font-size: 0.8rem;
    color: #16a34a;
    margin-left: 0.4rem;
    font-family: monospace;
}
.link-btn {
    background: none;
    border: 0;
    color: #3b82f6;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    padding: 0 0.2rem;
}
.link-btn:hover { color: #1e40af; }
.link-btn-sm { font-size: 0.8rem; }

.clear-btn {
    flex: 1;
    background: #95a5a6;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #7f8c8d;
}

/* ========== Кнопки в блоке «Итого» корзины ==========
   Раньше здесь стояли инлайновые стили поверх .clear-btn/.order-btn.
   У обоих в CSS flex:1 и свои padding/border-radius — инлайн их перебивал,
   и на узком экране кнопки вылезали за пределы блока.
   Теперь отдельные классы: свой расклад + перенос на мобильных. */
.cart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
}

.cart-actions-btn {
    flex: 1 1 auto;
    min-width: 140px;
    padding: 0.75rem 1.5rem;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s;
}

.cart-actions-btn--primary { background: #e74c3c; }
.cart-actions-btn--primary:hover:not(:disabled) { background: #c0392b; }
.cart-actions-btn--muted { background: #94a3b8; }
.cart-actions-btn--muted:hover:not(:disabled) { background: #7f8c8d; }
.cart-actions-btn:disabled { background: #94a3b8; cursor: wait; }

/* На телефонах кнопки занимают всю ширину — ничего не вылезает */
@media (max-width: 560px) {
    .cart-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .cart-actions-btn {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
    }
}

/* ========================================
   ПАГИНАЦИЯ
   ======================================== */
.pagination-container {
    margin-top: 2rem;
    text-align: center;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-btn {
    background: #ecf0f1;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: #2c3e50;
}

.page-btn:hover {
    background: #e74c3c;
    color: white;
}

.page-current {
    background: #e74c3c;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
}

/* ========================================
   ХЛЕБНЫЕ КРОШКИ
   ======================================== */
.breadcrumbs {
    padding: 10px 0;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.breadcrumbs a {
    color: #e74c3c;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* ========================================
   КАРТОЧКА ТОВАРА
   ======================================== */
.product-detail-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.size-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: #fafafa;
    transition: all 0.2s;
}

.size-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: #e74c3c;
}

.add-to-cart-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.add-to-cart-btn:hover {
    background: #c0392b;
}

/* Пустое состояние каталога на лендинге материала (/catalog/<материал>).
   Раньше здесь было «Товаров не найдено» — страница с описанием материала
   выглядела сломанной. */
.catalog-empty {
    text-align: center;
    padding: 32px 20px 40px;
    max-width: 620px;
    margin: 0 auto;
}

.catalog-empty-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 10px;
}

.catalog-empty-text {
    color: #64748b;
    margin: 0 0 18px;
    line-height: 1.6;
}

.catalog-empty-link {
    display: inline-block;
    padding: 10px 22px;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    color: #e74c3c;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.catalog-empty-link:hover {
    background: #e74c3c;
    color: #fff;
}

.length-select, .quantity-input, .width-select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.product-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* ========================================
   КОРЗИНА
   ======================================== */
.cart-items-list {
    list-style: none;
    padding: 0;
}

.cart-items-list li {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cart-summary {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
    text-align: right;
}

.cart-summary .total-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: #e74c3c;
}

.cart-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* ========================================
   ОФОРМЛЕНИЕ ЗАКАЗА
   ======================================== */
.checkout-container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.checkout-block {
    flex: 2;
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.cart-sidebar-checkout {
    flex: 1;
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    height: fit-content;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}

.required {
    color: #e74c3c;
}

.payment-options, .delivery-options {
    margin: 1rem 0;
}

.payment-option, .delivery-option {
    display: block;
    margin: 0.5rem 0;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-option:hover, .delivery-option:hover {
    background: #f8f9fa;
    border-color: #e74c3c;
}

/* ========================================
   БАЗА ЗНАНИЙ
   ======================================== */
.knowledge-category-group {
    margin-bottom: 2rem;
}

.category-title {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e74c3c;
    display: inline-block;
}

.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.knowledge-card {
    background: white;
    border-radius: 16px;
    padding: 1.25rem 1.4rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid rgba(15,23,42,0.06);
}

.knowledge-card:focus-visible {
    outline: 2px solid #e74c3c;
    outline-offset: 2px;
}

.knowledge-card:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12) !important;
}

/* ========== HOVER БЕЗ INLINE-ОБРАБОТЧИКОВ ==========
   CSP: script-src-attr 'none' — inline onmouseover в разметке блокируется.
   Поэтому hover-эффекты живут здесь. !important нужен, потому что
   цвет/тень в разметке заданы инлайном и он сильнее стилей из файла. */
.knowledge-card .btn-edit:hover {
    background: #2563eb !important;
}

.knowledge-card .btn-delete:hover {
    background: #dc2626 !important;
}

.search-result-item:hover {
    background: #f8fafc !important;
}

.knowledge-category {
    display: inline-block;
    align-self: flex-start;
    background: #e74c3c;
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-bottom: 0.8rem;
    white-space: nowrap;
}

.knowledge-title {
    color: #2c3e50;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.knowledge-content-short, .knowledge-content-full {
    color: #555;
    line-height: 1.6;
    font-size: 0.92rem;
    /* Статьи приходят из БД обычным текстом с переводами строк — без
       pre-wrap переносы склеиваются в одну простыню. FAQ сделан так же
       (.faq-a-inner). */
    white-space: pre-wrap;
    word-break: break-word;
}

/* Превью статьи — не больше трёх строк */
.knowledge-content-short {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.knowledge-content-short.is-expanded {
    display: block;
    -webkit-line-clamp: unset;
}

/* Мета-строка карточки: дата + кнопка */
.knowledge-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid #eef2f7;
}

.knowledge-meta small {
    color: #94a3b8;
    font-size: 0.78rem;
}

.read-more-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.read-more-btn:hover {
    text-decoration: underline;
}

/* ========================================
   ИНФО-СТРАНИЦЫ
   ======================================== */
.info-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.info-article {
    background: white;
    border-radius: 16px;
    padding: 1.25rem 1.4rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
    border: 1px solid rgba(15,23,42,0.06);
}

.info-article:focus-visible {
    outline: 2px solid #e74c3c;
    outline-offset: 2px;
}

.info-article-head {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.info-article-icon {
    font-size: 1.35rem;
    line-height: 1.35;
    flex-shrink: 0;
}

.info-article-text {
    color: #555;
    line-height: 1.55;
    font-size: 0.92rem;
    margin: 0 0 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
}

.info-article-text.is-expanded {
    display: block;
    -webkit-line-clamp: unset;
}

.info-article-foot {
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid #eef2f7;
}

.info-more-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.info-article:hover {
    transform: translateY(-3px);
}

.info-article h2 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.35;
    flex: 1;
}

.info-image {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 12px;
    margin: 0 0 0.75rem;
}

.buy-btn {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 0.5rem 1.5rem;
    text-decoration: none;
    border-radius: 30px;
    margin-top: 1rem;
    transition: all 0.2s;
}

.buy-btn:hover {
    background: #c0392b;
}

/* ========================================
   ДОСТАВКА
   ======================================== */
.delivery-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    line-height: 1.8;
}

.delivery-content h1, .delivery-content h2, .delivery-content h3 {
    color: #2c3e50;
    margin: 1.5rem 0 1rem;
}

.delivery-content h2 {
    color: #e74c3c;
}

/* ========================================
   БЛОК «КАК ДОБРАТЬСЯ ДО СКЛАДА»
   (страница «Доставка», id="pickup")
   ======================================== */
.pickup-block {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e2e8f0;
}

.pickup-block h2 {
    color: #2c3e50;
    margin: 0 0 1rem;
    font-size: 1.5rem;
}

.pickup-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
}

.pickup-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.pickup-row:last-child {
    margin-bottom: 0;
}

.pickup-icon {
    font-size: 1.2rem;
    line-height: 1.4;
}

.pickup-row-body {
    flex: 1;
    line-height: 1.6;
}

.pickup-address-value {
    display: block;
    font-weight: 600;
    color: #1e293b;
}

.pickup-map-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.pickup-map-link:hover {
    text-decoration: underline;
}

.pickup-directions {
    margin: 0.75rem 0;
    padding: 0.9rem 1rem;
    background: #fff;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    line-height: 1.7;
    color: #334155;
}

.pickup-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
}

.pickup-photo {
    display: block;
    width: 180px;
    height: 135px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.pickup-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pickup-row-note {
    color: #64748b;
    font-size: 0.9rem;
    border-top: 1px dashed #cbd5e1;
    padding-top: 0.75rem;
}

/* ========================================
   ОТЗЫВЫ
   ======================================== */
.reviews-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.reviews-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.reviews-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #f39c12;
}

.write-review-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
}

.review-card {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.review-stars {
    color: #f39c12;
}

/* ========================================
   СТРАНИЦА БЛАГОДАРНОСТИ
   ======================================== */
.thank-you-card {
    max-width: 600px;
    margin: 2rem auto;
    background: white;
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.success-icon {
    font-size: 80px;
    margin-bottom: 1rem;
}

.order-number {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.3rem;
    margin: 1.5rem 0;
}

.info-block {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: left;
}

.info-block ol {
    margin-left: 1.5rem;
}

/* «Сохранить заказ в личный кабинет» (thank-you.html) */
.lk-save-block {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: left;
}
.lk-save-block h3 {
    margin: 0 0 0.5rem;
    color: #1e3a8a;
    font-size: 1.05rem;
}
.lk-save-block p {
    margin: 0 0 1rem;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
}
.lk-save-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.lk-save-btn {
    background: #2563eb;
    color: #fff;
    border: 0;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.lk-save-btn:hover:not(:disabled) { background: #1d4ed8; }
.lk-save-btn:disabled { background: #94a3b8; cursor: wait; }
.lk-save-status {
    font-size: 0.85rem;
    color: #475569;
}
.lk-save-status.error { color: #e74c3c; }
.lk-save-status.success { color: #16a34a; }

.back-btn {
    display: inline-block;
    background: #e74c3c;
    color: white;
    text-decoration: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    margin-top: 1rem;
    font-weight: 500;
}

/* ========================================
   ПОДВАЛ
   ======================================== */
.footer {
    background: linear-gradient(135deg, #1a252f, #2c3e50);
    color: white;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #e74c3c;
}

.footer-section p, .footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    line-height: 1.6;
}

.footer-section a:hover {
    color: #e74c3c;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin: 0.5rem 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.8rem 0;
}

.work-hours {
    list-style: none;
    padding: 0;
}

.work-hours li {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    color: #bdc3c7;
}

/* Реквизиты компании на странице «О компании» — подставляются из настроек */
.company-requisites p {
    margin: 0 0 4px;
}

.footer-social {
    text-align: center;
    padding: 1rem 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
}

.social-link:hover {
    transform: translateY(-3px);
    background: #e74c3c;
}

.footer-bottom {
    text-align: center;
    padding-top: 1rem;
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* Реквизиты продавца (ИП Кавунов А.А., ОГРНИП, ИНН, адрес, контакты).
   Создаётся скриптом settings.js в подвале каждой страницы. */
.company-legal {
    margin: 6px auto 0;
    max-width: 900px;
    line-height: 1.5;
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* ========================================
   МОДАЛЬНЫЕ ОКНА
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.btn-save {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
}

.btn-delete {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
}

/* ========================================
   ЗАГРУЗКА
   ======================================== */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #e74c3c;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */
@media (max-width: 900px) {
    /* Шапка на телефоне ниже — запасное значение до того, как
       navigation.js меряет её точно. */
    :root {
        --header-h: 60px;
    }

    /* Шапку на планшетах и на телефоне в альбомной ориентации
       (769–900 px: iPhone — 844 px) тоже делаем ОДНОЙ СТРОКОЙ:
       логотип слева, иконки и бургер справа, разделы меню — в
       выдвижной панели (см. блок «МОБИЛЬНАЯ АДАПТАЦИЯ» ниже).

       Раньше здесь стоял flex-direction: column — логотип вставал по
       центру шапки, а меню занимало отдельную строку: шапка
       вырастала до 158 px и съедала пол-экрана телефона. */

    .main-nav a {
        white-space: normal;
    }

    .main-layout {
        flex-direction: column;
    }

    /* На мобиле/планшете фильтры — full-width над каталогом, без sticky */
    .filters-sidebar {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        position: static;
        max-height: none;
    }

    .cart-sidebar {
        position: static;
    }

    .checkout-container {
        flex-direction: column;
    }

    .cart-sidebar-checkout {
        position: static;
    }
}

@media (max-width: 600px) {
    .logo-text {
        font-size: 1.2rem;
    }
    
    .main-nav a {
        padding: 0.3rem 0.7rem;
        font-size: 0.85rem;
    }
    
    .header-right {
        flex-wrap: nowrap;
        justify-content: flex-end;
    }
    
    .catalog-grid, .knowledge-grid, .info-pages-grid {
        grid-template-columns: 1fr;
    }
    
    .announcement-block {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .contact-item {
        justify-content: center;
    }
    
    .work-hours li {
        justify-content: center;
        gap: 1rem;
    }
}

/* ========================================
   РАСКРОЙ
   ======================================== */
.custom-order-container {
    max-width: 800px;
    margin: 0 auto;
}

.custom-order-form {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.custom-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.custom-markup-info {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #fff3e0;
    border-radius: 12px;
    justify-content: center;
}

.markup-badge, .leadtime-badge {
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.custom-calculator {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1rem 0;
}

.calc-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.calc-row input {
    width: 150px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.calc-result {
    display: flex;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.result-item strong {
    font-size: 1.3rem;
    color: #e74c3c;
    margin-left: 8px;
}

#custom-add-to-cart {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    margin-top: 1rem;
}

/* ========================================
   ОТЗЫВЫ
   ======================================== */
.reviews-section {
    max-width: 900px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.reviews-section h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e74c3c;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.reviews-header {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.write-review-btn {
    transition: all 0.3s ease;
}

.write-review-btn:hover {
    background: #c0392b !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.review-card {
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.review-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
    border-color: #cbd5e1;
}

/* Форма отзыва в модальном окне */
#review-form .form-row {
    margin-bottom: 1.2rem;
}

#review-form label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: #2c3e50;
}

#review-form input,
#review-form select,
#review-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

#review-form input:focus,
#review-form select:focus,
#review-form textarea:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

#review-form textarea {
    resize: vertical;
    min-height: 100px;
}

/* ========== STICKY HEADER ========== */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Шапка при скролле: добавляется только тень.
   ⚠️ Логотип больше НЕ уменьшается. Раньше при скролле шапка получала
   вертикальные отступы 0.5rem, и чтобы высота осталась прежней, логотип
   приходилось урезать 70px → 54px — картинка «прыгала» при каждой
   прокрутке страницы (владелец: «при скролинге уменьшается логотип»).
   Теперь отступы не меняются: высота шапки постоянна (70px), логотип
   статичен, шапка просто подсвечивается тенью. */
header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ⚠️ Размер пунктов меню при скролле НЕ меняем. Раньше шрифт пунктов
   уменьшался (1rem → 0.9rem), и «FAQ» перескакивал с третьей строки на
   вторую — ярлыки «прыгали» прямо под курсором. Ширина пунктов должна
   быть постоянной, тогда расположение разделов не меняется никогда. */

/* На нешироких экранах телефон в шапке — только иконкой: освобождаем
   место для разделов меню (они должны помещаться в одну строку).
   Сам номер виден в подвале и в блоке «Остались вопросы?» на странице FAQ. */
@media (max-width: 1499px) {
    .header-right .phone-number {
        display: none;
    }
    .header-right .phone-link {
        padding: 0.4rem 0.7rem;
    }
}

/* На ноутбуках (1366–1400) разделы влезают в одну строку, даже если
   владелец включил «Раскрой» — слегка ужимаем отступы и поиск. */
@media (max-width: 1400px) {
    .main-nav {
        gap: 0.25rem;
    }
    .main-nav a {
        padding: 0.5rem 0.55rem;
    }
    #shop-search-input {
        width: 160px;
    }
}

/* ========== БУРГЕР-МЕНЮ ========== */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.burger-menu span {
    display: block;
    width: 100%;
    height: 3px;
    background: currentColor;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Анимация бургера в крестик */
.burger-menu.active span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

/* ========== АКТИВНЫЙ ПУНКТ МЕНЮ ========== */
.main-nav a {
    position: relative;
    transition: color 0.2s ease;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

.main-nav a.active {
    font-weight: 600;
}

/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ ========== */
/* Порог 900 px, а не 768: телефон в альбомной ориентации (iPhone —
   844 px) и планшет тоже должны получать бургер с выдвижной панелью,
   а не растянутую шапку с меню во всю ширину. */
@media (max-width: 900px) {
    .burger-menu {
        display: flex;
    }

    /* Шапка в одну строку: логотип слева, корзина/вход/телефон и
       бургер справа. Меню уезжает в выдвижную панель (ниже). */
    .header-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        min-height: 56px;
        padding: 0.4rem 0.75rem;
        gap: 0.5rem;
    }

    .header-left {
        flex: 0 1 auto;
        min-width: 0;
    }

    .header-right {
        flex: 0 0 auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 0.4rem;
    }

    .site-logo {
        height: 40px;
    }
    
    .header-center {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: rgb(107, 106, 106);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        transition: right 0.3s ease;
        z-index: 1000;
        padding: 80px 20px 20px;
        overflow-y: auto;
    }
    
    .header-center.open {
        right: 0;
    }
    
    .main-nav {
        flex-direction: column;
        align-items: flex-start;
        /* ⚠️ justify-content:center из десктопного правила в колонке
           центрирует пункты по вертикали — они висели в середине
           экрана. В панели они должны идти сверху. */
        justify-content: flex-start;
        gap: 0;
    }
    
    .main-nav a {
        width: 100%;
        padding: 15px 10px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 1.1rem;
    }
    
    .main-nav a::after {
        display: none;
    }
    
    .main-nav a.active {
        background: #fef3c7;
        border-radius: 8px;
    }
    
    /* Оверлей при открытом меню */
    .menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .menu-overlay.active {
        display: block;
        opacity: 1;
    }
}
/* Responsive Styles */
@media (max-width: 480px) {
    .header-container {
        padding: 0.75rem 1rem;
    }

    .site-logo {
        height: 38px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .cart-badge {
        font-size: 0.9rem;
    }
}

/* ========== ПОИСК С ПОДСКАЗКАМИ ========== */
.search-wrapper {
    position: relative;
    margin-right: 0;
}

#shop-search-input {
    width: 180px;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

#shop-search-input:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
    width: 300px;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    min-width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
    padding: 8px;
}

.search-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

.search-item:hover, .search-item.active {
    background: #fef3c7;
}

.search-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #f8fafc;
    flex-shrink: 0;
}

.search-info {
    flex: 1;
    min-width: 0;
}

.search-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.search-meta {
    font-size: 0.8rem;
    color: #64748b;
}

.search-price {
    font-weight: 700;
    color: #e74c3c;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.search-empty {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .search-wrapper {
        display: none; /* На мобильных поиск переносим в отдельную страницу или бургер */
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== КАРТОЧКИ ТОВАРОВ ========== */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    /* Без верхнего отступа: карточки товаров должны начинаться на одной
       линии с панелями фильтров и корзины. */
    padding: 0;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    animation: cardFadeIn 0.5s ease forwards;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card:nth-child(1) { animation-delay: 0.05s; }
.product-card:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3) { animation-delay: 0.15s; }
.product-card:nth-child(4) { animation-delay: 0.2s; }
.product-card:nth-child(5) { animation-delay: 0.25s; }
.product-card:nth-child(6) { animation-delay: 0.3s; }

/* Изображение */
.product-images {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f8fafc;
}

.product-images .main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .main-img {
    transform: scale(1.08);
}

/* Бейджи */
.product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.badge-new { background: #3b82f6; }
.badge-low-stock { background: #f59e0b; }
.badge-out-of-stock { background: #ef4444; }
.badge-hit { background: #10b981; }

/* Кнопка быстрого просмотра */
.quick-view-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.product-card:hover .quick-view-btn {
    opacity: 1;
    transform: translateY(0);
}

.quick-view-btn:hover {
    background: #e74c3c;
    color: white;
}

/* Информация о товаре */
.product-info {
    padding: 1rem 1.25rem 1.25rem;
}

.product-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-material {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #64748b;
}

.product-price {
    margin: 0.75rem 0 1rem 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #e74c3c;
}

.product-price .price-from {
    font-size: 0.85rem;
    font-weight: 400;
    color: #94a3b8;
    margin-right: 4px;
}

.details-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: #f1f5f9;
    color: #1e293b;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.details-btn:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* Stock indicator */
.product-stock {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.stock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stock-dot.in-stock { background: #10b981; }
.stock-dot.low-stock { background: #f59e0b; }
.stock-dot.out-of-stock { background: #ef4444; }

/* Lazy loading placeholder */
.product-images .lazy-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    
    .product-images {
        height: 160px;
    }
    
    .product-info h3 {
        font-size: 0.95rem;
    }
    
    .product-price {
        font-size: 1.2rem;
    }
    
    .quick-view-btn {
        display: none; /* На мобильных скрываем */
    }
}


/* ========================================
   МОДАЛЬНОЕ ОКНО СТАТЬИ (База знаний, Информация о материалах)
   ======================================== */
.am-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 10050;
    opacity: 0;
    transition: opacity 0.18s ease;
    overflow-y: auto;
}

.am-overlay.is-open {
    display: flex;
}

.am-overlay.is-visible {
    opacity: 1;
}

.am-dialog {
    position: relative;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    width: 100%;
    max-width: 820px;
    max-height: 86vh;
    overflow-y: auto;
    padding: 2rem 2.25rem 1.75rem;
    transform: scale(0.94);
    transition: transform 0.2s ease;
    -webkit-overflow-scrolling: touch;
}

.am-overlay.is-visible .am-dialog {
    transform: scale(1);
}

.am-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #475569;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    z-index: 2;
}

.am-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.am-badge {
    display: inline-block;
    background: #e74c3c;
    color: #fff;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

.am-title {
    color: #2c3e50;
    font-size: 1.4rem;
    line-height: 1.3;
    margin: 0 0 1rem;
    padding-right: 2.5rem;
}

.am-body {
    color: #475569;
    line-height: 1.65;
}

.am-body .knowledge-content-full {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
}

.am-desc {
    margin: 0 0 1rem;
    font-weight: 600;
    color: #334155;
}

.am-specs {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0 0 0.75rem;
}

.am-weight {
    margin: 0;
    color: #64748b;
}

.am-image {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 12px;
    margin: 0 0 1rem;
}

.am-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eef2f7;
}

.am-foot-note {
    margin-right: auto;
    color: #94a3b8;
    font-size: 0.82rem;
}

@media (max-width: 640px) {
    .am-overlay {
        padding: 0.75rem;
        align-items: flex-start;
    }

    .am-dialog {
        max-height: 92vh;
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 14px;
    }

    .am-title {
        font-size: 1.15rem;
        padding-right: 2rem;
    }
}
