/* ============================================================================
 * CSX.UZ Catalog — Microsoft style additions
 * ============================================================================ */

/* --- Filter tabs --- */
.filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-default);
    padding-bottom: 0;
}
.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 100ms, border-color 100ms;
}
.filter-tab:hover {
    color: var(--text-primary);
    text-decoration: none;
}
.filter-tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.filter-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.filter-tab--active .filter-tab__count {
    background: var(--accent-bg);
    color: var(--accent);
}

/* --- Product grid --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* --- Product card --- */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 150ms, transform 150ms;
}
.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.product-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.product-card__name {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}
.product-card__name a { color: var(--text-primary); }
.product-card__name a:hover { color: var(--accent); text-decoration: none; }
.product-card__version {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    padding: 3px 8px;
    background: var(--bg-hover);
    border-radius: var(--radius);
}

.product-card__desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 16px 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-default);
}

.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-default);
}

/* --- Product detail page --- */
.product-header { margin-bottom: 24px; }
.product-header__meta {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}
.product-header__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.product-desc {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
}

.feature-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}
.feature-list li { margin-bottom: 4px; }

.product-cta {
    text-align: center;
    padding: 32px 0;
    margin-top: 24px;
    border-top: 1px solid var(--border-default);
}

/* --- Gallery --- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.gallery__item {
    position: relative;
    display: block;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 150ms;
}
.gallery__item:hover { box-shadow: var(--shadow-md); }
.gallery__item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}
.gallery__caption {
    display: block;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-subtle);
}

.gallery--admin .gallery__item--admin { position: relative; }
.gallery__delete {
    position: absolute;
    top: 6px; right: 6px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--error);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    padding: 0;
    opacity: 0;
    transition: opacity 120ms;
}
.gallery__item--admin:hover .gallery__delete { opacity: 1; }

/* --- Mobile --- */
@media (max-width: 768px) {
    .product-grid { grid-template-columns: 1fr; }
    .filter-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .filter-tab { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
    .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .product-header__meta { flex-direction: column; gap: 4px; }
    .product-header__actions { flex-direction: column; align-items: stretch; }
}
