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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.header-top {
    display: flex;
    align-items: center;
    padding: 20px 0;
    gap: 20px;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    cursor: pointer;
}

.logo-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo-text {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.logo-subtitle {
    font-size: 14px;
    font-weight: normal;
    color: #666;
}

.header-description {
    color: #666;
    font-size: 14px;
    flex-grow: 1;
}

.social-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icon {
    display: block;
    width: 40px;
    height: 40px;
    transition: transform 0.3s;
}

.social-icon:hover {
    transform: scale(1.1);
}

.social-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.social-hours {
    font-size: 12px;
    color: #999;
    text-align: center;
}

.search-bar {
    display: flex;
    gap: 10px;
    padding: 15px 0;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-button {
    padding: 12px 30px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

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

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
}

.filter-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.filter-btn:hover {
    background: #e0e0e0;
}

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

.tags-section {
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin: 10px 0;
}

.tags-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

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

.tag-btn {
    padding: 6px 14px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    color: #1976d2;
    transition: all 0.3s;
    font-weight: 500;
}

.tag-btn:hover {
    background: #1976d2;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

.tag-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1565c0;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.product-tag {
    padding: 4px 10px;
    background: #f0f7ff;
    border: 1px solid #c5e1ff;
    border-radius: 12px;
    font-size: 11px;
    color: #0066cc;
    cursor: pointer;
    transition: all 0.2s;
}

.product-tag:hover {
    background: #0066cc;
    color: white;
    transform: scale(1.05);
}

.favorites-link {
    padding: 10px 0;
}

.favorites-btn {
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #ff6b6b;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #ff6b6b;
    font-weight: 500;
}

.favorites-btn:hover {
    background: #ff6b6b;
    color: white;
}

/* Main Content */
.catalog-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Filters Sidebar */
.filters-sidebar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

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

.filter-group h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #333;
}

.filter-option {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 14px;
}

.filter-option input[type="radio"] {
    margin-right: 8px;
}

.reset-filters-btn {
    width: 100%;
    padding: 10px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

.close-filters-btn {
    display: none;
    width: 100%;
    padding: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
}

.close-filters-btn:hover {
    background: #c82333;
}

/* Products Grid */
.products-area {
    min-height: 500px;
}

.loading {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    color: #666;
}

.no-products {
    text-align: center;
    padding: 50px;
    font-size: 16px;
    color: #999;
}

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

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.product-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    cursor: pointer;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-count {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.favorite-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: #333;
}

.favorite-icon:hover {
    transform: scale(1.1);
}

.favorite-icon.active {
    color: #ff0000;
    transform: scale(1.1);
}

.product-info {
    padding: 15px;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.product-price {
    font-size: 20px;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 8px;
}

.product-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.product-details {
    font-size: 13px;
    color: #555;
    margin-bottom: 15px;
}

.product-details div {
    margin-bottom: 5px;
}

.ask-question-btn,
.details-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-align: center;
    text-decoration: none;
    transition: background 0.3s;
}

.ask-question-btn:hover,
.details-btn:hover {
    background: #4f46e5;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.page-btn {
    padding: 8px 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.page-btn:hover {
    background: #f0f0f0;
}

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

/* Modal Gallery */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-gallery {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 1100px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin: auto;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s, background 0.2s;
}

.close-modal:hover {
    background: #cc0000;
    transform: rotate(90deg);
}

.gallery-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.gallery-main {
    width: 100%;
    height: 500px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 100%;
}

.gallery-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gallery-info h2 {
    font-size: 24px;
    color: #333;
    margin: 0;
}

.gallery-price {
    font-size: 28px;
    font-weight: bold;
    color: #007bff;
}

.gallery-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
}

.gallery-details div {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.gallery-details div:last-child {
    border-bottom: none;
}

.gallery-description {
    background: #fff3cd;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.gallery-description h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #856404;
}

.gallery-description p {
    margin: 0;
    color: #856404;
    line-height: 1.6;
}

.gallery-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.buy-btn,
.ask-btn {
    width: 100%;
    padding: 12px;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

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

.buy-btn:hover {
    background: #218838;
}

.ask-btn {
    background: #6366f1;
    color: white;
}

.ask-btn:hover {
    background: #4f46e5;
}

.gallery-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
}

.gallery-thumbs img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.gallery-thumbs img:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.gallery-thumbs img.active {
    opacity: 1;
    border-color: #007bff;
    transform: scale(1.05);
}

/* Footer */
.footer {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 20px;
}

.footer-section h4 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #fff;
}

.footer-section p {
    font-size: 14px;
    margin-bottom: 8px;
    color: #bdc3c7;
}

.footer-social {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.footer-social a {
    display: block;
    width: 35px;
    height: 35px;
    transition: transform 0.3s;
}

.footer-social a:hover {
    transform: scale(1.1);
}

.footer-social img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Mobile Filters Toggle Button */
.mobile-filters-toggle {
    display: none;
}

/* Adaptive Styles */
@media (max-width: 1024px) {
    .catalog-layout {
        grid-template-columns: 200px 1fr;
        gap: 20px;
    }

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

@media (max-width: 768px) {
    .mobile-filters-toggle {
        display: block;
        width: 100%;
        padding: 12px 20px;
        background: #007bff;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 15px;
        transition: background 0.3s;
    }

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

    .catalog-layout {
        grid-template-columns: 1fr;
    }

    .filters-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 999;
        background: white;
        padding: 20px;
        padding-bottom: 60px;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        overscroll-behavior: contain;
    }

    .filters-sidebar.visible {
        transform: translateX(0);
    }

    /* Блокировка скролла основного body когда фильтры открыты */
    body.filters-open {
        overflow: hidden;
        height: 100vh;
        width: 100vw;
        position: fixed;
    }

    .close-filters-btn {
        display: block;
    }

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

    .filter-buttons {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .header-top {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        gap: 10px;
        padding: 12px 0;
        align-items: center;
    }

    .logo {
        grid-column: 1;
        grid-row: 1;
        gap: 8px;
    }

    .logo img {
        height: 45px !important;
    }

    .logo-text {
        font-size: 16px;
    }

    .header-description {
        grid-column: 2;
        grid-row: 1;
        font-size: 11px;
        padding: 0 10px;
        text-align: center;
    }

    .social-links {
        grid-column: 3;
        grid-row: 1 / 3;
        flex-direction: column;
        gap: 6px;
        align-items: flex-end;
    }

    .social-icons {
        gap: 10px;
    }

    .social-icon {
        width: 30px;
        height: 30px;
    }

    .social-hours {
        font-size: 10px;
        white-space: nowrap;
    }

    .search-bar {
        flex-direction: column;
        padding: 10px 0;
    }

    .search-button {
        width: 100%;
    }

    .tags-section {
        padding: 10px 0;
    }

    .tags-label {
        font-size: 12px;
    }

    .tag-btn {
        padding: 5px 12px;
        font-size: 11px;
    }

    .favorites-link {
        padding: 8px 0;
    }

    .favorites-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .product-image {
        height: 200px;
    }

    .gallery-content {
        grid-template-columns: 1fr;
    }

    .gallery-main {
        height: 300px;
    }

    .modal-overlay {
        padding: 10px;
        align-items: flex-start;
    }

    .modal-gallery {
        padding: 20px;
        margin: 20px auto;
        max-height: none;
        width: 100%;
        border-radius: 8px;
    }

    .gallery-main {
        height: 250px;
    }

    .gallery-thumbs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .close-modal {
        width: 35px;
        height: 35px;
        font-size: 24px;
        top: 10px;
        right: 10px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        max-width: 100%;
    }

    .container {
        padding: 0 10px;
    }

    .filter-group h3 {
        font-size: 14px;
    }

    .filter-option {
        font-size: 13px;
    }

    .header {
        margin-bottom: 12px;
    }

    .header-top {
        padding: 10px 0;
        gap: 8px;
    }

    .logo img {
        height: 35px !important;
    }

    .logo-text {
        font-size: 14px;
    }

    .header-description {
        font-size: 10px;
        padding: 0 5px;
    }

    .social-icon {
        width: 28px;
        height: 28px;
    }

    .social-hours {
        font-size: 9px;
    }

    .product-title {
        font-size: 14px;
    }

    .product-price {
        font-size: 18px;
    }

    .product-details {
        font-size: 12px;
    }

    .filters-sidebar {
        padding: 15px;
    }

    .catalog-layout {
        gap: 15px;
    }

    .pagination {
        gap: 3px;
        margin-top: 20px;
        flex-wrap: wrap;
    }

    .page-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .footer {
        padding: 30px 0 15px;
        margin-top: 30px;
    }

    .footer-section h4 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .footer-section p {
        font-size: 13px;
    }

    .modal-overlay {
        padding: 5px;
    }

    .modal-gallery {
        padding: 15px;
        margin: 10px auto;
        border-radius: 6px;
    }

    .gallery-content {
        gap: 15px;
        margin-bottom: 15px;
    }

    .gallery-main {
        height: 200px;
        border-radius: 6px;
    }

    .gallery-info h2 {
        font-size: 18px;
    }

    .gallery-price {
        font-size: 22px;
    }

    .gallery-details {
        padding: 12px;
        font-size: 13px;
    }

    .gallery-description {
        padding: 12px;
        font-size: 13px;
    }

    .gallery-thumbs img {
        width: 70px;
        height: 70px;
    }

    .buy-btn,
    .ask-btn {
        padding: 10px;
        font-size: 13px;
    }
}

/* Стили для страницы товара - используем модальный дизайн */
.error-message {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 50px auto;
    max-width: 600px;
}

.error-message h2 {
    font-size: 28px;
    color: #dc3545;
    margin-bottom: 15px;
}

.error-message p {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
}

.back-link {
    display: inline-block;
    padding: 12px 24px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
    font-weight: 500;
}

.back-link:hover {
    background: #0069d9;
}
