/* Расширенный дизайн для предпросмотра каталога */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: #7096ad !important;
    text-decoration: none;
}

a:hover {
    color: #7096ad !important;
    text-decoration: underline;
}

a:visited {
    color: #7096ad !important;
}

/* Общие стили для всех изображений */
img {
    border: 1px solid #f0f0f0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Исключение для логотипа в шапке */
.header-logo {
    border: none !important;
}

.header-logo-link {
    display: inline-block;
    text-decoration: none;
    border: none;
}

.header-logo-link:hover {
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.preview-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Шапка */
.preview-header {
    background: #C80A32;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-content {
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.preview-header h1 {
    font-size: 0.65rem;
    font-weight: normal;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.preview-header h1 .header-logo {
    height: 3.6rem;
    width: auto;
    vertical-align: middle;
}

.header-controls {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Поиск */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.search-box input {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0;
    font-size: 0.9rem;
    width: 100%;
    background: transparent;
    color: #fff;
    transition: border-bottom-color 0.2s;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-box input:focus {
    outline: none;
    border-bottom-color: #fff;
}

.search-clear {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.2s;
}

.search-clear:hover {
    color: #fff;
}

/* Кнопка меню для мобильных */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: absolute;
    right: 0;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: #fff;
    transition: all 0.3s;
}

/* Основной layout */
.layout-wrapper {
    display: flex;
    flex: 1;
    width: 100%;
    margin: 0;
    padding: 0;
    gap: 0;
    min-height: 0;
}

/* Боковая панель категорий */
.sidebar-overlay {
    display: none;
}

.categories-sidebar {
    width: 280px;
    min-width: 200px;
    max-width: 320px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 1rem 0;
    position: sticky;
    top: 73px;
    height: calc(100vh - 73px);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 1rem 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0.75rem;
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.25rem;
}

.categories-count {
    font-size: 0.8rem;
    color: #666;
}

.categories-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0;
    width: 100%;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem 0.5rem 1.1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    border-radius: 0;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.85rem;
    color: #333;
    width: 100%;
}

.category-item:hover:not(:disabled) {
    background-color: #f5f5f5;
}

.category-item.active {
    background-color: #f1f4f7;
    color: #7096ad;
    font-weight: 500;
}

.category-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-count {
    font-size: 0.75rem;
    color: #999;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.category-item.active .category-count {
    color: #000;
}

/* Основной контент */
.preview-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

/* Вид списка продуктов */
.products-view {
    width: 100%;
}

/* Вид детального просмотра */
.product-detail-view {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    overflow-y: auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: #f5f5f5;
    border-radius: 0;
    padding: 0.25rem;
}

.view-toggle-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: normal;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.view-toggle-btn.active {
    background: white;
    color: #000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: normal;
    color: #666;
}

.breadcrumb-home {
    background: none;
    border: none;
    color: #7096ad;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    font-size: inherit;
    transition: color 0.2s;
}

.breadcrumb-home:hover {
    color: #7096ad;
    text-decoration: underline;
}

.breadcrumb-category {
    background: none;
    border: none;
    color: #7096ad;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    font-size: inherit;
    transition: color 0.2s;
}

.breadcrumb-category:hover {
    color: #7096ad;
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #999;
}

.breadcrumb-current {
    color: #333;
    font-weight: normal;
}

.products-count {
    font-size: 0.9rem;
    font-weight: normal;
    color: #666;
}

.products-container {
    width: 100%;
}

/* Категория */
.category-section {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 1rem;
    padding-bottom: 0;
    border-bottom: none;
}

/* Сетка продуктов */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

/* Горизонтальный список продуктов */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.products-list .product-card {
    flex-direction: row;
    height: auto;
    max-height: 60px;
}

.products-list .product-image-container {
    width: 60px;
    min-width: 60px;
    padding-top: 0;
    height: 60px;
    flex-shrink: 0;
    border: none;
}

.products-list .product-image {
    position: relative;
    width: 100%;
    height: 100%;
}

.products-list img {
    border: none !important;
}

.products-list .product-info {
    flex: 1;
    padding: 0.75rem;
    justify-content: space-between;
    min-width: 0;
}

.products-list .product-title {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.products-list .product-details-btn {
    align-self: flex-start;
    margin-top: auto;
}

@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 1440px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (min-width: 1920px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* Карточка продукта */
.product-card {
    background: white;
    border-radius: 0;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: none;
    border: none;
}

.product-image-container {
    width: 100%;
    padding-top: 100%;
    position: relative;
    background-color: #f9f9f9;
    overflow: hidden;
    border: none;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #f9f9f9;
}

.product-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.75rem;
    background-color: #f9f9f9;
}

.product-info {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
}

.product-title {
    font-size: 0.85rem;
    color: #333;
    line-height: 1.3;
    word-wrap: break-word;
    flex: 1;
}

.product-details-btn {
    padding: 0.4rem 0.75rem;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 0;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
    align-self: flex-start;
}

.product-details-btn:hover {
    background-color: #1976d2;
}

/* Заголовок детального просмотра */
.detail-view-header {
    margin-bottom: 1rem;
    padding-bottom: 0;
    border-bottom: none;
}

.detail-view-header .breadcrumbs {
    margin-bottom: 0;
}

/* Заголовок продукта */
.product-detail-header {
    margin-bottom: 1rem;
    padding-bottom: 0;
    border-bottom: none;
}

.product-detail-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-category-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background-color: #ffffff;
    color: #666;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 400;
}

.product-detail-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.product-detail-image {
    text-align: center;
}

.product-detail-image img {
    max-width: 100%;
    height: auto;
    border: 1px solid #f0f0f0 !important;
    border-radius: 0;
    box-shadow: none;
}

.product-details-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}


.detail-section {
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 1rem;
    margin-bottom: 0;
}

.detail-section:first-child {
    margin-top: 0;
}

.detail-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-section.tech-content-section {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

.detail-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.75rem;
    margin-top: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.detail-content {
    color: #555;
    font-size: 0.875rem;
    line-height: 1.4;
}

.detail-content p {
    margin-bottom: 0.75rem;
}

.detail-content ul,
.detail-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.detail-content li {
    margin-bottom: 0.5rem;
}

.detail-content.sizes-table {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.detail-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.detail-images img {
    width: 100%;
    height: auto;
    border: 1px solid #f0f0f0 !important;
    border-radius: 0;
    box-shadow: none;
}

/* Галерея изображений - thumbnails */
.product-images-gallery {
    margin-bottom: 2rem;
    padding-bottom: 0;
    border-bottom: none;
}

.tech-images-gallery {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.tech-images-gallery .images-thumbnails {
    margin-bottom: 1rem;
}

.tech-images-gallery .image-thumbnail {
    cursor: default !important;
    pointer-events: none;
}

.tech-images-gallery .image-thumbnail:hover {
    transform: none !important;
    opacity: 1 !important;
}

.product-images-gallery h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 1rem;
}

.images-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.product-images-gallery:not(.tech-images-gallery) .images-thumbnails {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}


.image-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background-color: #ffffff;
    border-radius: 0;
    overflow: hidden;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.image-thumbnail:hover {
    border: none;
    transform: translateY(-2px);
    box-shadow: none;
}

.image-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 1px solid #f0f0f0 !important;
    border-radius: 0;
    background-color: #ffffff;
}

.image-thumbnail-wrapper {
    display: flex;
    flex-direction: column;
}

.image-caption {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #666;
    line-height: 1.3;
    word-break: break-word;
    display: none;
}

/* Лайтбокс */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image-wrapper {
    position: relative;
    display: inline-block;
    padding: 1rem;
    background-color: #ffffff;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border: none !important;
    border-radius: 0;
    box-shadow: none;
    display: block;
}

.lightbox-name {
    margin-top: 15px;
    color: #333;
    font-size: 0.9rem;
    text-align: center;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 0;
    max-width: 100%;
    word-break: break-word;
}

.lightbox-close {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 0;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 20px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.sizes-table {
    overflow-x: auto;
}

.sizes-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.sizes-table td {
    padding: 0.35rem 0.5rem;
    text-align: left;
    border: none;
    border-bottom: 1px solid #333;
    line-height: 1.3;
    vertical-align: top;
}

.sizes-table th {
    padding: 0.35rem 0.5rem;
    text-align: left;
    border: none;
    border-bottom: 1px solid #333;
    line-height: 1.3;
    background-color: #333 !important;
    color: #fff !important;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    vertical-align: top;
}

.sizes-table thead td {
    background-color: #333 !important;
    color: #fff !important;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    vertical-align: top;
}

.tech-table table {
    margin-bottom: 1rem;
}

.tech-table td,
.tech-table th {
    vertical-align: top;
}

/* Общее правило для всех таблиц */
table td,
table th {
    vertical-align: top;
}

/* Состояния загрузки и ошибки */
.loading {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-size: 1rem;
}

.error {
    text-align: center;
    padding: 3rem;
    color: #d32f2f;
    font-size: 1rem;
    background: white;
    border-radius: 0;
    border: none;
}

.empty-category {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-style: italic;
    background: white;
    border-radius: 0;
}

/* Адаптивность для планшетов */
@media (max-width: 1024px) {
    .categories-sidebar {
        width: 240px;
        min-width: 200px;
        max-width: 280px;
    }

    .preview-content {
        padding: 1.5rem;
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .preview-header {
        position: relative;
    }

    .header-content {
        padding: 0 1rem;
    }

    .header-top {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .preview-header h1 {
        font-size: 0.6rem;
    }

    .preview-header h1 .header-logo {
        height: 3.2rem;
    }

    .menu-toggle {
        display: flex;
        position: relative;
        z-index: 101;
    }

    .header-controls {
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }
    
    .header-content .header-controls {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        width: calc(100% + 2rem);
        max-width: none;
    }

    .menu-toggle {
        display: flex;
        position: absolute;
        top: 0;
        right: 0;
        z-index: 101;
        margin: 0;
    }
    
    .header-controls .menu-toggle {
        position: absolute;
        top: -3rem;
        right: 0;
    }

    .layout-wrapper {
        flex-direction: column;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 199;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .categories-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        min-width: 280px;
        max-width: 280px;
        height: 100vh;
        z-index: 200;
        transition: left 0.3s;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .categories-sidebar.active {
        left: 0;
    }

    .preview-content {
        padding: 1rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .product-detail-view {
        padding: 0;
    }

    .product-detail-header h1 {
        font-size: 1.25rem;
    }

    .detail-section h2 {
        font-size: 1.25rem;
    }

    .detail-images {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .preview-content {
        padding: 0.75rem;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .product-title {
        font-size: 0.8rem;
    }

    .product-detail-header h1 {
        font-size: 1.1rem;
    }

    .images-thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.75rem;
    }

}

/* Для очень больших экранов - ограничиваем максимальную ширину контента для читаемости */
@media (min-width: 1920px) {
    .layout-wrapper {
        max-width: 1800px;
        margin: 0 auto;
        padding: 0 2rem;
    }

    .header-content {
        max-width: 1800px;
        padding: 0 2rem;
    }
}
