/* === БАЗОВЫЕ СТИЛИ === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --accent-color: #23a355;
    --accent-hover: #1e88e5;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #3a3a3a;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* === HEADER === */
.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-color);
    text-decoration: none;
}

.search-box {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-hover);
    z-index: 1000;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-item a {
    text-decoration: none;
    color: var(--text-primary);
    display: block;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--bg-secondary);
}

/* === LAYOUT === */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    margin: 30px 0;
}

/* === SIDEBAR === */
.sidebar {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.categories-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item a {
    display: block;
    padding: 8px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
}

.category-item a:hover,
.category-item.active a {
    background: var(--accent-color);
    color: white;
}

.subcategory {
    list-style: none;
    margin-left: 15px;
    margin-top: 5px;
}

.subcategory li {
    margin: 3px 0;
}

.subcategory a {
    font-size: 14px;
    padding: 6px 10px;
}

/* === MAIN CONTENT === */
.main-content {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-group input {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 120px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-large {
    padding: 15px 30px;
    font-size: 16px;
}

/* === PRODUCTS GRID === */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    background: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.product-card a {
    text-decoration: none;
    color: var(--text-primary);
}

.product-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.product-card h3 {
    padding: 15px 15px 10px;
    font-size: 16px;
    line-height: 1.4;
}

.product-card .price {
    padding: 0 15px 15px;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-color);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* === PAGINATION === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.page-link,
.page-current {
    padding: 10px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}

.page-link {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.page-link:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.page-current {
    background: var(--accent-color);
    color: white;
}

/* === PRODUCT PAGE === */
.breadcrumbs {
    padding: 20px 0;
    color: var(--text-secondary);
}

.breadcrumbs a {
    color: var(--accent-color);
    text-decoration: none;
}

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

.product-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.product-gallery .main-image {
    width: 100%;
    height: 500px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

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

.thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.thumbnail:hover {
    border-color: var(--accent-color);
}

.product-info h1 {
    font-size: 32px;
    margin-bottom: 20px;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.product-price .price {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-color);
}

.in-stock,
.out-stock {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.in-stock {
    background: #e8f5e9;
    color: #2e7d32;
}

.out-stock {
    background: #ffebee;
    color: #c62828;
}

.product-options {
    margin-bottom: 25px;
}

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.option-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
}

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

.product-description,
.product-attributes {
    margin-top: 30px;
}

.product-description h3,
.product-attributes h3 {
    margin-bottom: 15px;
    font-size: 20px;
}

.description-text {
    line-height: 1.8;
    color: var(--text-secondary);
}

.attributes-table {
    width: 100%;
    border-collapse: collapse;
}

.attributes-table tr {
    border-bottom: 1px solid var(--border-color);
}

.attributes-table td {
    padding: 12px;
}

.attributes-table td:first-child {
    width: 40%;
    color: var(--text-secondary);
}

.related-products {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.related-products h2 {
    margin-bottom: 20px;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .product-page {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .product-card img {
        height: 180px;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .filter-group input {
        width: 100%;
    }
}