/*
 * products.css — layout и компоненты страниц продуктов.
 * Типографика CKEditor-контента вынесена в ck_content.css.
 */

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

/* ===== Карточка продукта ===== */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.product-image-placeholder {
    width: 100%;
    height: 180px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 2rem;
}
.product-image-placeholder::after {
    content: '📦';
}

.product-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.product-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.product-info h3 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s;
}
.product-info h3 a:hover {
    color: var(--primary);
}

.product-short {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    flex: 1;
    line-height: 1.5;
}

.product-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.product-category,
.product-configs {
    background: var(--bg-secondary);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

/* ===== Цена ===== */
.product-price-block {
    margin-top: auto;
}
.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.price-restricted {
    background: var(--bg-secondary);
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    text-align: center;
}
.price-text {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}
.price-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}
.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* ===== Фильтры ===== */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}
.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.filter-group > span {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}
.filter-btn {
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid var(--border-light);
    transition: var(--transition);
    white-space: nowrap;
}
.filter-btn.active,
.filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== Детальная страница ===== */
.product-detail {
    max-width: 800px;
    margin: 0 auto;
}

.product-header {
    margin-bottom: 1.5rem;
}
.product-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.product-meta-detail {
    display: flex;
    gap: 0.75rem;
    color: var(--text-light);
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.product-detail-image {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

/* Контент CKEditor — max-width задан на .product-detail, не здесь */
.product-description {
    margin-bottom: 2rem;
}

/* ===== Блок цены (детальная) ===== */
.product-price-block-detail {
    margin: 2rem 0;
    text-align: center;
}
.product-price-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
    margin-bottom: 1rem;
}

.price-restricted-detail {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}
.price-restricted-detail p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.product-back {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* ===== Пагинация ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}
.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.pagination .current {
    background: var(--primary);
    color: white;
    font-weight: 600;
    border-color: var(--primary);
}
.pagination .disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* ===== Адаптивность ===== */
@media (max-width: 768px) {
    .product-header h1 {
        font-size: 1.6rem;
    }
    .product-price-large {
        font-size: 1.6rem;
    }
}
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    .price-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .filters-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.product-card {
    cursor: pointer;
}