/**
 * Основные стили для интернет-магазина TaniaKsiazka_pl
 * Полностью реструктурированный CSS с четким разделением секций
 * Адаптивный дизайн с приоритетом мобильных устройств
 */

/* ========================================
   1. СБРОС СТИЛЕЙ И БАЗОВЫЕ НАСТРОЙКИ
   ======================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* ========================================
   2. СЕТКА И КОНТЕЙНЕРЫ
   ======================================== */

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

.container-fluid {
    width: 100%;
    padding: 0 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

.col-md-3,
.col-md-6,
.col-md-9 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 15px;
}

.align-items-center {
    align-items: center;
}

/* ========================================
   3. ЗАГОЛОВОК САЙТА
   ======================================== */

.header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-main {
    padding: 20px 0;
    background: #fff;
}

/* Header Content - Desktop Layout */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Логотип */
.header-logo {
    flex-shrink: 0;
}

.logo {
    font-size: 2rem;
    font-weight: bold;
    color: #007bff;
    text-decoration: none;
    white-space: nowrap;
}

.logo:hover {
    color: #0056b3;
}

/* Форма поиска - Desktop & Tablet */
.header-search {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-right: none;
    border-radius: 25px 0 0 25px;
    font-size: 1rem;
    outline: none;
}

.search-input:focus {
    border-color: #007bff;
}

.search-button {
    padding: 12px 20px;
    background: #007bff;
    color: white;
    border: 2px solid #007bff;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.search-button:hover {
    background: #0056b3;
    border-color: #0056b3;
}

/* Форма поиска - Mobile (скрыта по умолчанию) */
.header-search-mobile {
    display: none;
}

/* Переключатель языков */
.header-language {
    flex-shrink: 0;
}

.language-switcher {
    position: relative;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #495057;
    transition: all 0.3s ease;
}

.language-toggle:hover {
    background: #e9ecef;
    border-color: #007bff;
    color: #007bff;
}

.language-flag {
    font-size: 1.2rem;
    line-height: 1;
}

.language-text {
    font-weight: 600;
}

/* Dropdown меню языков */
.language-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.language-switcher:hover .language-dropdown,
.language-toggle:focus + .language-dropdown,
.language-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: #495057;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.language-option:hover {
    background: #f8f9fa;
}

.language-option.active {
    background: #e7f3ff;
    color: #007bff;
    font-weight: 600;
}

.language-option .language-flag {
    font-size: 1.3rem;
}

.language-option .language-name {
    flex: 1;
}

/* Бургер-меню (скрыт на Desktop) */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.navbar-toggle-icon {
    display: block;
    width: 25px;
    height: 3px;
    background: #495057;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.navbar-toggle:hover .navbar-toggle-icon {
    background: #007bff;
}

/* ========================================
   4. НАВИГАЦИЯ
   ======================================== */

.navbar {
    background: #007bff;
    padding: 0;
    position: relative;
}

.navbar-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
}

.navbar-nav li {
    margin: 0;
}

.navbar-nav a {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    background: rgba(255,255,255,0.15);
}

/* ========================================
   5. ОСНОВНОЙ КОНТЕНТ И ЗАГОЛОВКИ
   ======================================== */

.main-content {
    padding: 30px 0;
    min-height: calc(100vh - 200px);
}

/* Унифицированный стиль для h1 (заголовок страницы) */
h1 {
    margin-top: 20px;
    margin-bottom: 0;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    line-height: 1.3;
}

/* Мобильная версия h1 */
@media (max-width: 767px) {
    h1 {
        margin-top: 16px;
        font-size: 1.5rem;
    }
}

/* ========================================
   6. ХЛЕБНЫЕ КРОШКИ
   ======================================== */

.breadcrumbs {
    background: #e9ecef;
    padding: 15px 0;
    margin-bottom: 20px;
}

.breadcrumbs .container {
    padding: 0 15px;
}

.breadcrumbs-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    flex-direction: row;
}

.breadcrumbs-item {
    margin-right: 10px;
}

.breadcrumbs-item:not(:last-child)::after {
    content: '>';
    margin-left: 10px;
    color: #6c757d;
}

.breadcrumbs-link {
    color: #007bff;
    text-decoration: none;
}

.breadcrumbs-link:hover {
    text-decoration: underline;
}

.breadcrumbs-current {
    color: #6c757d;
    font-weight: 500;
}

/* ========================================
   7. КНОПКИ
   ======================================== */

.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.btn-primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.btn-success:hover {
    background: #1e7e34;
    border-color: #1e7e34;
}

.btn-outline {
    background: transparent;
    color: #007bff;
    border-color: #007bff;
}

.btn-outline:hover {
    background: #007bff;
    color: white;
}

.w-100 {
    width: 100%;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

/* ========================================
   8. КАТАЛОГ ТОВАРОВ
   ======================================== */

/* Мобильные фильтры - скрыты по умолчанию */
.mobile-filters-trigger {
    display: none;
}

.mobile-filters-overlay {
    display: none;
}

/* Фильтры - над товарами на всех устройствах */
.filters-sidebar {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 15px;
}

.filters-header h3 {
    margin: 0;
    color: #333;
}

.filters-toggle-btn {
    display: block;
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.filters-toggle-btn:hover {
    background: #0056b3;
}

.filters-content {
    display: block;
}

.filters-content.collapsed {
    display: none;
}

.filters-content.show {
    display: block;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-title {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.filter-select,
.filter-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    font-size: 1rem;
    background: white;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #007bff;
}

.filter-category,
.filter-producer {
    font-size: 1rem;
}

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

.filter-type-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.filter-type-option:hover {
    background: #f8f9fa;
}

.filter-type-radio {
    margin-right: 8px;
}

.filters-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

/* Панель управления каталогом */
.catalog-controls {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.results-info {
    color: #6c757d;
    font-size: 0.9rem;
}

.sort-controls {
    text-align: right;
}

.sort-controls label {
    margin-right: 10px;
    font-weight: 500;
}

.sort-select {
    min-width: 200px;
}

/* ========================================
   9. КАРТОЧКИ ТОВАРОВ
   ======================================== */

/* Сетка товаров - 1 колонка по умолчанию (мобильные) */
.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 30px;
}

.product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.product-link {
    display: block;
    text-decoration: none;
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
}

/* Анимация загрузки для lazy loading изображений */
.product-image[loading="lazy"] {
    opacity: 0;
    animation: fadeIn 0.3s ease-in forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Placeholder эффект пока изображение загружается */
.product-image:not([src]),
.product-image[src=""],
.product-image[src*="placeholder"] {
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-title-link {
    color: #333;
    text-decoration: none;
}

.product-title-link:hover {
    color: #007bff;
}

.product-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 15px;
    flex: 1;
    line-height: 1.5;
}

.product-description-link {
    color: inherit;
    text-decoration: none;
}

.product-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 15px;
}

/* Discount badge */
.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Old price (strikethrough) */
.old-price {
    font-size: 1rem;
    color: #6c757d;
    text-decoration: line-through;
    margin-right: 8px;
    display: inline-block;
}

/* Current price with discount */
.current-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #dc3545;
    display: inline-block;
}

/* Large versions for product detail page */
.product-badge-large {
    font-size: 1.2rem;
    padding: 10px 20px;
    top: 20px;
    right: 20px;
}

.old-price-large {
    font-size: 1.5rem;
    margin-right: 15px;
}

.current-price-large {
    font-size: 2.5rem;
}

.product-actions {
    display: flex;
    gap: 10px;
}

.product-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* ========================================
   10. СТРАНИЦА ТОВАРА
   ======================================== */

.product-image-container {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.product-main-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
}

/* Главное изображение товара загружается сразу, но с плавным появлением */
.product-main-image {
    animation: fadeIn 0.3s ease-in;
}

.product-details {
    padding: 20px 0;
}

.product-details .product-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.3;
}

.product-meta {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.product-category {
    margin-bottom: 10px;
}

.product-category a {
    color: #007bff;
    text-decoration: none;
}

.product-category a:hover {
    text-decoration: underline;
}

.product-price-section {
    margin-bottom: 30px;
}

.product-details .product-price {
    font-size: 2.5rem;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 10px;
}

.product-details .product-description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 30px;
}

.product-details .product-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.product-details .product-actions .btn {
    flex: 1;
    padding: 15px 25px;
    font-size: 1.1rem;
}

/* Секция похожих товаров */
.similar-products {
    background: #f8f9fa;
    padding: 40px 0;
    margin-top: 40px;
    border-top: 1px solid #dee2e6;
    width: 100%;
}

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

.similar-products h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 2rem;
    font-weight: 600;
}

/* ========================================
   11. ПАГИНАЦИЯ
   ======================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    gap: 5px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 10px 15px;
    text-decoration: none;
    border: 1px solid #dee2e6;
    color: #007bff;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination .current {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination .disabled {
    color: #6c757d;
    cursor: not-allowed;
}

.pagination .disabled:hover {
    background: transparent;
    color: #6c757d;
    border-color: #dee2e6;
}

/* ========================================
   12. УТИЛИТЫ
   ======================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

/* ========================================
   12.5. СЛУЖЕБНЫЕ КЛАССЫ
   ======================================== */

/* Honeypot поле для защиты формы от ботов */
.honeypot {
    position: absolute;
    left: -9999px;
}

/* ========================================
   13. АДАПТИВНОСТЬ - ПЛАНШЕТЫ (768-991px)
   ======================================== */

@media (min-width: 768px) and (max-width: 991px) {
    /* Header - Tablet Layout */
    .header-content {
        flex-wrap: wrap;
    }
    
    .header-logo {
        order: 1;
    }
    
    .header-language {
        order: 2;
        margin-left: auto;
    }
    
    .header-search {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        margin-top: 15px;
    }
    
    .navbar-toggle {
        order: 4;
    }
    
    /* Навигация - компактная */
    .navbar-nav a {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    /* Логотип - немного меньше */
    .logo {
        font-size: 1.75rem;
    }
}

@media (min-width: 768px) {
    /* Сетка товаров - 2 колонки на планшетах */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    /* Колонки для планшетов */
    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-md-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }
    
    /* Страница товара */
    .product-details .product-price {
        font-size: 2rem;
    }
}

/* ========================================
   14. АДАПТИВНОСТЬ - МОБИЛЬНЫЕ УСТРОЙСТВА
   ======================================== */

@media (max-width: 767px) {
    /* Header - Mobile Layout */
    .header-main {
        padding: 10px 0;
    }
    
    .header-content {
        flex-wrap: nowrap;
        gap: 10px;
    }
    
    /* Логотип */
    .header-logo {
        flex: 1;
        order: 1;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    /* Скрыть Desktop поиск */
    .header-search {
        display: none;
    }
    
    /* Показать Mobile поиск */
    .header-search-mobile {
        display: block;
        margin-top: 10px;
    }
    
    .header-search-mobile .search-form {
        width: 100%;
    }
    
    .header-search-mobile .search-input,
    .header-search-mobile .search-button {
        padding: 10px 12px;
    }
    
    /* Переключатель языков - Mobile */
    .header-language {
        order: 2;
        flex-shrink: 0;
    }
    
    .language-toggle {
        padding: 6px 10px;
        min-width: 50px;
    }
    
    .language-text {
        display: none;
    }
    
    .language-flag {
        font-size: 1.4rem;
    }
    
    /* Dropdown для мобильных - клик вместо hover */
    .language-dropdown {
        right: 0;
        left: auto;
    }
    
    .language-switcher.active .language-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* Бургер-меню */
    .navbar-toggle {
        display: flex;
        order: 3;
        flex-shrink: 0;
    }
    
    /* Навигация */
    .navbar-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #007bff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .navbar-nav.show {
        display: flex;
    }
    
    .navbar-nav a {
        padding: 15px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* Основной контент */
    .main-content {
        padding: 10px 0;
    }
    
    /* Главная страница - уменьшаем заголовок для мобильных */
    .hero-section h1 {
        margin: 0 auto;
    }
    
    /* Каталог - все колонки на полную ширину */
    .row {
        flex-direction: column;
    }
    
    .col-md-3,
    .col-md-6,
    .col-md-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Фильтры над товарами */
    .filters-sidebar {
        order: 1;
        margin-bottom: 20px;
    }
    
    .col-md-9 {
        order: 2;
    }
    
    /* Сетка товаров - 1 колонка на мобильных */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 10px;
    }
    
    /* Карточки товаров */
    .product-actions {
        flex-direction: column;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    /* Страница товара - основное изображение как в карточках */
    .main-content .row {
        flex-direction: column;
    }
    
    .product-image-container {
        margin: 0 0 20px 0;
        height: 200px;
        background: #f8f9fa;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .product-main-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .product-details {
        padding: 15px 0;
    }
    
    .product-details .product-title {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
    
    .category-description {
        font-size: 1.4rem;
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .product-meta {
        margin-bottom: 20px;
    }
    
    .product-details .product-price {
        font-size: 2rem;
    }
    
    .product-details .product-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .product-details .product-actions .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    /* Пагинация */
    .pagination {
        flex-wrap: wrap;
        gap: 2px;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* ========================================
   15. АДАПТИВНОСТЬ - ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ
   ======================================== */

@media (max-width: 480px) {
    .search-input,
    .search-button {
        padding: 8px 10px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .container {
        padding: 0 15px;
    }
}

/* ========================================
   16. ДЕСКТОПНЫЕ СТИЛИ - КАТАЛОГ И ТОВАРЫ
   ======================================== */

@media (min-width: 992px) {
    /* Сетка товаров - 3 колонки на десктопе */
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
    
    /* Основное изображение товара - оригинальный размер без перекрытий */
    .product-image-container {
        height: auto; /* Автоматическая высота для сохранения пропорций */
        margin-bottom: 30px;
        overflow: hidden; /* Предотвращаем выход за границы */
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .product-main-image {
        width: 100%;
        height: auto; /* Автоматическая высота для сохранения пропорций */
        display: block; /* Убираем возможные отступы */
        transition: transform 0.3s ease;
        transform-origin: center;
    }
    
    .product-main-image:hover {
        transform: scale(1.05); /* Легкое увеличение при наведении */
    }
    
    /* Сетка для страницы товара - 2 колонки на десктопе */
    .main-content .row {
        flex-direction: row; /* Восстанавливаем горизонтальную сетку */
    }
    
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Фильтры и товары - все на полную ширину */
    .col-md-3,
    .col-md-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Фильтры над товарами */
    .filters-sidebar {
        order: 1;
    }
    
    .col-md-9 {
        order: 2;
    }
}

/* ========================================
   17. ФУТЕР
   ======================================== */

.footer {
    background: #343a40;
    color: #fff;
    margin-top: 50px;
    padding: 40px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
    display: inline-block;
}

.footer-section p {
    color: #adb5bd;
    line-height: 1.6;
    margin-bottom: 10px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #007bff;
}

.footer-bottom {
    border-top: 1px solid #495057;
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    color: #adb5bd;
    margin: 0;
    font-size: 0.9rem;
}

/* Адаптивность футера */
@media (max-width: 768px) {
    .footer {
        padding: 30px 0 15px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
        margin-bottom: 25px;
    }
    
    .footer-section h3 {
        font-size: 1.1rem;
    }
}

/* ========================================
   СТРАНИЦА КАТЕГОРИЙ
   ======================================== */

.categories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

.category-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.category-title {
    margin-bottom: 10px;
    font-size: 1.25rem;
    font-weight: 600;
}

.category-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.category-title a:hover {
    color: #007bff;
}

.category-count {
    color: #6c757d;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.subcategories {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.subcategories-title {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #495057;
}

.subcategories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.subcategory-item {
    display: inline-block;
}

.subcategory-link {
    display: inline-block;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    color: #495057;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.subcategory-link:hover {
    background: #e9ecef;
    color: #007bff;
}

.subcategory-count {
    color: #6c757d;
    font-size: 0.8rem;
}

/* Адаптивность для категорий */
@media (min-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (min-width: 992px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
    
    .category-card {
        padding: 25px;
    }
    
    .category-title {
        font-size: 1.3rem;
    }
}

/* ========================================
   СТРАНИЦЫ КОНТЕНТА (ABOUT, CONTACT)
   ======================================== */

.about-content,
.contact-content {
    padding: 0 15px;
}

.about-section,
.contact-info,
.contact-form {
    margin-bottom: 30px;
}

.about-section h2,
.contact-info h2,
.contact-form h2 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.5rem;
}

.about-section p,
.contact-info p {
    margin-bottom: 15px;
    line-height: 1.7;
    color: #555;
}

.contact-method {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.contact-method h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1rem;
}

.contact-method p {
    margin-bottom: 0;
    color: #666;
}

.contact-method a {
    color: #007bff;
    text-decoration: none;
}

.contact-method a:hover {
    text-decoration: underline;
}

/* Адаптивность для страниц контента */
@media (max-width: 767px) {
    .about-content,
    .contact-content {
        padding: 0 15px;
    }
    
    .about-section,
    .contact-info,
    .contact-form {
        margin-bottom: 25px;
    }
    
    .contact-method {
        padding: 12px;
    }
}

/* Стили для списков на странице about */
.process-list,
.trust-list {
    margin-left: 20px;
    padding-left: 20px;
    margin-bottom: 20px;
}

.process-list li,
.trust-list li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #555;
}

.trust-list li {
    list-style: none;
    position: relative;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.feature-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.feature-item h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1rem;
}

.feature-item p {
    margin-bottom: 0;
    color: #666;
    font-size: 0.95rem;
}

@media (max-width: 480px) {
    .about-content,
    .contact-content {
        padding: 0 15px;
    }
    
    .process-list,
    .trust-list {
        margin-left: 10px;
        padding-left: 15px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ========================================
   SEARCH FILTERS
   ======================================== */

/* Collapse utility class */
.collapse {
    display: none;
}

.collapse.show {
    display: block;
}

/* Active Filters Display */
.active-filters {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.active-filters h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    background: #007bff;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.filter-badge:hover {
    background: #0056b3;
}

.filter-badge strong {
    margin-right: 5px;
}

.remove-filter {
    color: #fff;
    text-decoration: none;
    margin-left: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.remove-filter:hover {
    opacity: 1;
    color: #fff;
}

.clear-all-filters {
    display: inline-block;
    background: #dc3545;
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.clear-all-filters:hover {
    background: #c82333;
    color: #fff;
}

/* Available Filters Panel */
.available-filters {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.available-filters h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    padding-left: 15px;
    border-bottom: 2px solid #007bff;
}

/* На десктопе добавляем отступ слева для колонок кроме первой */
@media (min-width: 768px) {
    .available-filters .col-md-4:not(:first-child) {
        padding-left: 20px;
    }
    
    .available-filters h3 {
        padding-left: 0;
    }
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-item {
    margin-bottom: 8px;
}

.filter-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: #f8f9fa;
    gap: 8px;
}

.filter-link:hover {
    background: #e9ecef;
    color: #007bff;
    transform: translateX(3px);
}

.filter-link.active {
    background: #007bff;
    color: #fff;
    font-weight: 600;
}

.filter-link.active:hover {
    background: #0056b3;
    color: #fff;
}

.filter-count {
    background: #6c757d;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
    flex-shrink: 0;
}

/* На десктопе увеличиваем отступ между текстом и цифрой */
@media (min-width: 768px) {
    .filter-link {
        gap: 10px;
    }
}

.filter-link.active .filter-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Price Filter Form */
.price-filter-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.price-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.price-input-group {
    flex: 1;
}

.price-input-group label {
    display: block;
    font-size: 0.875rem;
    color: #495057;
    margin-bottom: 5px;
    font-weight: 500;
}

.price-input-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.price-input-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.price-range-info {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 12px;
    font-style: italic;
}

.price-filter-form button {
    width: 100%;
    padding: 10px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.price-filter-form button:hover {
    background: #218838;
}

/* Filter Toggle Button */
.btn-toggle-filters {
    width: 100%;
    padding: 12px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 15px;
}

.btn-toggle-filters:hover {
    background: #0056b3;
}

.btn-toggle-filters.collapsed {
    background: #6c757d;
}

.btn-toggle-filters.collapsed:hover {
    background: #5a6268;
}

/* Collapse Animation */
.collapse {
    display: none;
}

.collapse.show {
    display: block;
}

/* Responsive Design for Filters */
@media (max-width: 768px) {
    .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 20px;
    }
    
    .filters-list {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-badge,
    .clear-all-filters {
        justify-content: space-between;
        width: 100%;
    }
    
    .price-inputs {
        flex-direction: column;
    }
    
    .available-filters {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .active-filters,
    .available-filters {
        padding: 12px;
    }
    
    .active-filters h4,
    .available-filters h3 {
        font-size: 0.95rem;
    }
    
    .filter-badge,
    .clear-all-filters {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .filter-link {
        padding: 6px 10px;
        font-size: 0.875rem;
    }
}

/* ========================================
   КНОПКА ВОЗВРАТА НАВЕРХ
   ======================================== */

.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #0056b3;
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
    transform: translateY(-3px);
}

.back-to-top:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 123, 255, 0.3);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* Стили для описания категории */
.category-description {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

/* Показываем кнопку только на мобильных устройствах (до 768px) */
@media (min-width: 769px) {
    .back-to-top {
        display: none !important;
    }
}

/* Адаптация для очень маленьких экранов */
@media (max-width: 480px) {
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }
    
    .back-to-top svg {
        width: 20px;
        height: 20px;
    }
}