/* --- Сброс и База --- */
:root {
    --primary-blue: #00609c;
    --primary-dark: #004a7a;
    --accent-green: #209c93;
    --text-dark: #333;
    --gray-border: #ccc;
    --bg-light: #f9f9f9;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    color: var(--text-dark);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* --- Кнопки --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: #fff;
}
.btn-primary:hover { background-color: var(--primary-dark); }

.btn-green {
    background-color: var(--accent-green);
    color: #fff;
    font-size: 0.9rem;
    padding: 8px 15px;
}

.btn-white {
    background-color: #fff;
    color: var(--primary-blue);
    font-weight: bold;
}

/* --- Header (ИСПРАВЛЕНО: Центрирование логотипа) --- */
.header {
    padding: 25px 0;
    background: #fff;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* Важно для абсолютного позиционирования лого */
}

.burger-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 50px;
    height: 30px;
    display: flex;
    flex-wrap: wrap;
    align-content: space-between;
    z-index: 2; /* Чтобы был поверх, если что */
    margin-bottom: 25px;
}
.burger-btn span {
    display: block;
    width: 100%;
    height: 18px; 
    width: 18px;
    background-color: var(--primary-blue);
    margin: 1px;
}

.logo {
    /* Абсолютное центрирование */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.header-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 2;
}
.header-email {
    color: var(--accent-green);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* --- Меню (Боковое) --- */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-container {
    width: 320px;
    height: 100%;
    background: var(--primary-blue);
    color: #fff;
    padding: 30px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
.mobile-menu-overlay.active .menu-container {
    transform: translateX(0);
}

.close-menu {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
}
.menu-logo { margin-top: 40px; margin-bottom: 30px; }

.main-nav li { margin-bottom: 15px; }
.main-nav a { 
    font-size: 1.1rem; 
    font-weight: bold; 
    text-transform: uppercase;
}

.menu-search {
    margin-top: auto;
    background: #fff;
    padding: 5px;
    display: flex;
}
.menu-search input {
    border: none;
    flex-grow: 1;
    padding: 5px;
    outline: none;
}
.menu-search button {
    background: var(--primary-blue);
    color: #fff;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
}

.menu-contacts { margin-top: 20px; }
.menu-contacts a { display: block; margin-bottom: 5px; opacity: 0.8; }

/* --- Сетка категорий (ИСПРАВЛЕНО: Hover и Картинки) --- */
.categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.cat-card {
    position: relative;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    min-height: 100px;
    border: 1px solid var(--primary-blue); /* По умолчанию синяя рамка */
    background-color: #fff; /* По умолчанию белый фон */
    color: var(--text-dark);
    transition: all 0.3s ease;
    overflow: hidden; /* Чтобы картинка не вылезала */
    cursor: pointer;
}

/* Логика размеров сетки */
.cat-large {
    width: calc(50% - 10px);
    min-height: 220px; /* Чуть увеличил высоту для красоты */
}
.cat-small {
    width: calc(50% - 10px);
    align-items: center;
}

.cat-content {
    position: relative;
    z-index: 2; /* Текст поверх картинки */
}

.cat-content h2 { font-size: 1.5rem; line-height: 1.2; text-transform: uppercase; }
.cat-content h3 { font-size: 1.1rem; text-transform: uppercase; font-weight: bold;}

.count-badge {
    display: inline-block;
    padding: 5px 10px;
    margin-top: 10px;
    font-weight: bold;
    /* По умолчанию синий бейдж */
    background: var(--primary-blue); 
    color: #fff;
    transition: 0.3s;
}

/* --- HOVER ЭФФЕКТ --- */
.cat-card:hover {
    background-color: var(--primary-blue);
    color: #fff;
}

/* При наведении бейдж становится белым с синим текстом */
.cat-card:hover .count-badge {
    background: #fff;
    color: var(--primary-blue);
}

/* --- Изображения в карточках (ИСПРАВЛЕНО: Full Height) --- */
.cat-image {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    height: 100%; /* Растягиваем контейнер на всю высоту */
    z-index: 1; /* Картинка под текстом (текст z-index: 2) */
    display: flex;
    align-items: flex-end; /* Или center, зависит от картинки */
}

.cat-image img {
    height: 100%; /* Растягиваем картинку по высоте */
    width: auto;
    object-fit: cover; /* Заполняем область */
}

/* --- Секции товаров --- */
.products-section { margin-bottom: 40px; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.section-header h2 { text-transform: uppercase; font-size: 1.2rem; }
.view-all { color: var(--primary-blue); font-size: 0.9rem; border: 1px solid #ccc; padding: 5px 10px;}

.products-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.product-card {
    width: calc(25% - 15px);
    border: 1px solid #eee;
    padding: 15px;
    display: flex;
    flex-direction: column;
}
.product-card.placeholder { background: #f9f9f9; min-height: 300px;}

.prod-img { 
    height: 200px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 15px;
}
.prod-img img { max-width: 100%; max-height: 100%; }

.prod-info h3 { font-size: 1rem; margin-bottom: 15px; text-transform: uppercase;}
.prod-bottom {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.price { font-weight: bold; font-size: 0.9rem; }

/* --- CTA Block --- */
.cta-block {
    background-color: var(--primary-blue);
    color: #fff;
    padding: 30px 0;
}
.cta-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Footer --- */
.footer {
    padding: 40px 0;
    font-size: 0.9rem;
    color: var(--primary-blue);
}
.footer-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
}
.footer-col { max-width: 250px; }
.contacts a { display: block; margin-bottom: 5px; font-weight: bold; }


/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 992px) {
    .cat-large { width: 100%; }
    .product-card { width: calc(33.33% - 14px); }
}

@media (max-width: 768px) {
    /* На мобильном position: absolute для лого может мешать, если элементы налезают.
       Но поскольку мы скрываем правую кнопку (.btn) ниже, места хватит. */
    
    .logo { display: none; }
    
    .cat-small { width: 100%; }
    .product-card { width: calc(50% - 10px); }
    
    .cta-flex { flex-direction: column; text-align: center; gap: 15px; }
    .footer-flex { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 480px) {
    .product-card { width: 100%; }
}


/* =========================================
   СТРАНИЦА КАТАЛОГА (CATALOG.HTML)
   ========================================= */

/* --- Верхние табы категорий --- */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}

.cat-tab {
    display: flex;
    align-items: center;
    border: 1px solid var(--primary-blue);
    padding: 8px 15px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    transition: 0.3s;
    background: #fff;
    color: var(--text-dark);
}

.tab-badge {
    background: var(--primary-blue);
    color: #fff;
    padding: 2px 6px;
    margin-left: 10px;
    font-size: 0.8rem;
}

/* Активный таб */
.cat-tab.active,
.cat-tab:hover {
    background: var(--primary-blue);
    color: #fff;
}
.cat-tab.active .tab-badge,
.cat-tab:hover .tab-badge {
    background: #fff;
    color: var(--primary-blue);
}

/* --- Layout (Сетка: Сайдбар + Контент) --- */
.catalog-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 50px;
}

.catalog-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.catalog-content {
    flex-grow: 1;
}

/* Сайдбар меню */
.sidebar-menu li {
    margin-bottom: 2px;
}
.sidebar-menu a {
    display: block;
    padding: 10px 15px;
    font-weight: bold;
    text-transform: uppercase;
    transition: 0.3s;
}
.sidebar-menu li.active a,
.sidebar-menu a:hover {
    background: var(--primary-blue);
    color: #fff;
}

/* --- Фильтр --- */
.filter-box {
    border: 1px solid var(--primary-blue);
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Кнопка прижата к низу */
}

.filter-groups {
    display: flex;
    gap: 50px;
}

.filter-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-title {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
}
.checkbox-label input {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* --- Список товаров (Строки) --- */
.product-list-rows {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.product-row {
    display: flex;
    align-items: center;
    border: 1px solid var(--gray-border);
    padding: 10px 20px;
    transition: all 0.3s ease;
    background: #fff;
}

.p-row-img {
    width: 80px;
    height: 80px;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.p-row-img img {
    max-height: 100%;
    max-width: 100%;
}

.p-row-info {
    flex-grow: 1;
}
.p-row-info h3 {
    text-transform: uppercase;
    font-size: 1rem;
    margin-bottom: 5px;
}
.p-props p {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 2px;
}

.p-row-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}
.p-row-actions .price {
    white-space: nowrap;
}

/* Hover эффект для строки товара (как на макете) */
.product-row:hover {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}
.product-row:hover .p-props p {
    color: #e0e0e0;
}
/* Кнопка внутри ховера остается зеленой, но можно добавить белый бордер для контраста, если нужно */
.product-row:hover .btn-green {
    border: 1px solid #fff;
}

/* --- Пагинация --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}
.pagination a {
    color: var(--primary-blue);
    font-weight: bold;
    /*width: 30px;
    height: 30px;*/
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}
.pagination a:hover,
.pagination a.active {
    background: var(--primary-blue);
    color: #fff;
}

/* --- Адаптив каталога --- */
@media (max-width: 992px) {
    .catalog-layout {
        flex-direction: column;
    }
    .catalog-sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto; /* Горизонтальный скролл меню на планшете */
    }
    .sidebar-menu {
        display: flex;
        width: 100%;
    }
    .sidebar-menu a {
        white-space: nowrap;
        border: 1px solid #eee;
    }
    
    .filter-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    .filter-groups {
        flex-direction: column;
        gap: 20px;
    }
    .filter-action {
        width: 100%;
    }
    .filter-action .btn {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .product-row {
        flex-wrap: wrap;
        text-align: center;
        justify-content: center;
    }
    .p-row-img {
        margin: 0 0 10px 0;
    }
    .p-row-info {
        width: 100%;
        margin-bottom: 15px;
    }
    .p-row-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* =========================================
   СТРАНИЦА ТОВАРА (PRODUCT.HTML)
   ========================================= */

.product-detail-layout {
    display: flex;
    gap: 50px; /* Отступ между фото и описанием */
    margin-bottom: 60px;
    margin-top: 20px;
}

/* --- Галерея (Слева) --- */
.p-gallery {
    width: 45%; /* Чуть меньше половины */
}

.p-main-image {
    border: 1px solid #ccc;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
}
.p-main-image img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.p-thumbs {
    display: flex;
    gap: 15px;
}
.thumb-item {
    width: 80px;
    height: 100px;
    border: 1px solid #ccc;
    padding: 5px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s;
}
.thumb-item:hover, 
.thumb-item.active {
    border-color: var(--primary-blue);
}
.thumb-item img {
    max-width: 100%;
    max-height: 100%;
}

/* --- Информация (Справа) --- */
.p-info {
    width: 55%;
}

.p-info h1 {
    font-size: 1.8rem;
    text-transform: uppercase;
    margin-bottom: 20px;
    line-height: 1.2;
}

.p-description {
    margin-bottom: 30px;
    font-size: 1rem;
    color: #555;
}

/* Таблица характеристик */
.p-props-table {
    margin-bottom: 40px;
}
.p-prop-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Выравнивание по нижней линии шрифта */
    padding: 10px 0;
    border-bottom: 2px solid #ccc; /* Жирная линия как на макете */
}
.prop-name {
    font-weight: bold;
    color: var(--text-dark);
}
.prop-val {
    text-align: right;
    font-weight: bold;
}

/* Блок покупки */
.p-actions-area {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: flex-end; /* Все элементы прижаты вправо, как на макете */
}

/* Кастомный счетчик */
.qty-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}
.qty-btn {
    width: 40px;
    height: 40px;
    background: var(--accent-green);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}
.qty-btn:hover {
    background: #1a7e77;
}

.qty-input {
    width: 80px;
    height: 40px;
    border: 1px solid var(--accent-green);
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-blue); /* Цвет текста в инпуте */
}

.btn-large {
    padding: 12px 30px;
    font-size: 1rem;
    text-transform: uppercase;
}

/* --- Адаптив товара --- */
@media (max-width: 992px) {
    .product-detail-layout {
        flex-direction: column;
    }
    .p-gallery, .p-info {
        width: 100%;
    }
    .p-actions-area {
        justify-content: flex-start; /* На моб. выравниваем влево или по центру */
        flex-wrap: wrap;
    }
}
@media (max-width: 480px) {
    .p-actions-area {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-large {
        width: 100%;
    }
    .qty-wrapper {
        justify-content: center;
        margin-bottom: 10px;
    }
}


/* =========================================
   ОФОРМЛЕНИЕ ЗАКАЗА (CHECKOUT.HTML)
   ========================================= */

.page-title {
    font-size: 1.5rem;
    text-transform: uppercase;
    margin-bottom: 30px;
    font-weight: bold;
}

.checkout-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 60px;
}

/* --- Левая колонка (Корзина) --- */
.checkout-items {
    flex: 1; /* Занимает оставшееся пространство */
}

.cart-item {
    display: flex;
    align-items: center;
    border: 1px solid var(--primary-blue);
    padding: 15px;
    margin-bottom: 20px;
    background: #fff;
}

.cart-img {
    width: 60px;
    margin-right: 20px;
    display: flex;
    justify-content: center;
}
.cart-img img {
    max-width: 100%;
    height: auto;
}

.cart-info {
    flex-grow: 1;
}
.cart-info h3 {
    font-size: 1rem;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.cart-info p {
    font-size: 0.85rem;
    color: #333;
    line-height: 1.3;
}

.cart-actions {
    margin-left: 20px;
}

/* --- Правая колонка (Форма) --- */
.checkout-form-box {
    width: 450px; /* Фиксированная ширина как на макете */
    flex-shrink: 0;
    border: 1px solid var(--primary-blue);
    padding: 30px;
    background: #fff;
}

.form-group {
    margin-bottom: 25px;
}

/* Стилизация инпутов с подчеркиванием */
.line-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--primary-blue);
    padding: 10px 0;
    font-size: 1rem;
    outline: none;
    color: var(--text-dark);
    font-family: inherit;
    transition: border-color 0.3s;
}

.line-input:focus {
    border-bottom-width: 2px;
}
.line-input::placeholder {
    color: #666;
}

/* Текстареа */
textarea.line-input {
    resize: vertical;
}

/* Чекбокс согласия */
.checkbox-group {
    margin-top: 30px;
    margin-bottom: 30px;
}
.custom-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.2;
}
.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.checkmark {
    position: relative;
    height: 18px;
    width: 18px;
    border: 1px solid var(--primary-blue);
    margin-right: 10px;
    flex-shrink: 0;
}
/* Галочка при выборе */
.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--primary-blue);
}
.custom-checkbox input:checked ~ .checkmark:after {
    content: "";
    position: absolute;
    display: block;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.label-text a {
    text-decoration: underline;
    color: var(--text-dark);
}

.form-actions {
    text-align: right; /* Кнопка справа */
}

/* --- Адаптив --- */
@media (max-width: 992px) {
    .checkout-layout {
        flex-direction: column;
    }
    .checkout-form-box {
        width: 100%; /* На мобильном форма на всю ширину */
    }
}

@media (max-width: 600px) {
    .cart-item {
        flex-direction: column;
        text-align: center;
    }
    .cart-img { margin: 0 0 15px 0; }
    .cart-actions { margin: 15px 0 0 0; }
    
    .form-actions { text-align: center; }
    .form-actions .btn { width: 100%; }
}

.thumb-item.active {
    border-color: var(--primary-blue); /* Или любой другой цвет выделения */
}

/* 1. Стили для активного верхнего таба */
.category-tabs .cat-tab.active {
    background-color: var(--primary-color, #2d5e8e); /* Ваш основной синий цвет */
    color: #fff;
    border-color: var(--primary-color, #2d5e8e);
}

.category-tabs .cat-tab.active .tab-badge {
    background-color: #fff;
    color: var(--primary-color, #2d5e8e);
}

/* 2. Стили для активного пункта сайдбара */
/* Делаем его таким же, как при наведении (жирным или цветным) */
.sidebar-menu li.active > a {
    color: var(--primary-color, #2d5e8e); /* Синий цвет текста */
    font-weight: 700; /* Жирный шрифт */
    background-color: #f5f5f5; /* Легкий фон, если нужно */
}

/* Если у вас есть маркер или полоска слева при ховере, добавьте ее и для active */
.sidebar-menu li.active {
    border-left: 3px solid var(--primary-color, #2d5e8e); /* Пример полоски слева */
    padding-left: 12px; /* Компенсация, если в CSS был padding */
}

/* Стили для новой пагинации */
.pagination-container {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.pagination-list {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 40px;
    padding: 0 15px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pagination-item:hover {
    border-color: #28a745; /* Ваш зеленый цвет */
    color: #28a745;
    text-decoration: none;
}

.pagination-item.active {
    background-color: var(--accent-green); /* Активная страница - зеленая */
    border-color: var(--accent-green);
    color: #fff;
    cursor: default;
}

.pagination-item.prev, 
.pagination-item.next {
    font-weight: normal;
}

.pagination-item .arrow {
    margin: 0 5px;
    font-size: 16px;
    line-height: 1;
}
