/* ============================================================
   CATALOG
   ============================================================ */

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    padding: 0;
}

@media (max-width: 992px) {
    .catalog-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .catalog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.product-card,
.product-card *,
.add-btn,
.cat-btn {
    -webkit-tap-highlight-color: transparent !important;
    user-select: none;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
}


/* ============================================================
   PRODUCT IMAGE
   ============================================================ */

.product-image-wrap {
    width: 100%;
    height: 135px;
    position: relative;
    overflow: hidden;
    background: #ffffff;
}

.product-img {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: contain;
    padding: 6px;

    display: block;

    /*
     * Пока изображение загружается,
     * пользователь видит только белый фон.
     */
    opacity: 0;

    transition:
        opacity 0.18s ease;
}

.product-image-wrap--loaded .product-img {
    opacity: 1;
}


/* ============================================================
   PRODUCT WITHOUT IMAGE
   ============================================================ */

/*
 * Если в прайсе вообще нет image_url,
 * image-зона не создаётся.
 *
 * Карточка становится компактной.
 */
.product-card--no-image {
    min-height: 0;
}


/*
 * Небольшой ненавязчивый fallback
 * для товара без фотографии.
 *
 * Это не отдельная большая image-зона.
 */
.product-image-fallback {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;

    margin-bottom: 6px;
    padding: 3px 7px;

    border-radius: 5px;

    background: var(--bg-color);
    color: var(--text-muted);

    font-size: 0.62rem;
    font-weight: 500;

    line-height: 1;
}


/* ============================================================
   PRODUCT INFO
   ============================================================ */

.product-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.product-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-in-stock {
    background: #dcfce7;
    color: #166534;
}

.badge-on-order {
    background: #e0f2fe;
    color: #0369a1;
}

.product-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.25;
    min-height: 2.5em;
    display: block;
    overflow: visible;
    color: var(--text-color);
}

.product-brand {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.price-block {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
}

.product-price {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-color);
}

.product-old-price {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: line-through;
}


/* ============================================================
   ADD TO CART
   ============================================================ */

.add-btn {
    width: 100%;
    padding: 8px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;

    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.add-btn:hover {
    box-shadow:
        0 5px 14px
        rgba(0, 166, 81, 0.20);
}

.add-btn:active {
    transform:
        translateY(1px);
}

.add-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}


/* ============================================================
   PRODUCT QUANTITY
   ============================================================ */

.ozon-qty-control {
    display: flex;
    align-items: center;
    justify-content: space-between;

    background: var(--bg-color);

    border: 1px solid
        var(--primary-color);

    border-radius:
        var(--radius-md);

    overflow: hidden;

    width: 100%;
    height: 34px;
}

.ozon-qty-btn {
    width: 34px;
    height: 100%;

    background:
        var(--primary-color);

    color: #ffffff;

    border: none;

    font-size: 1.1rem;
    font-weight: 700;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}

.ozon-qty-val {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-color);
}


/* ============================================================
   CATALOG MOBILE
   ============================================================ */

@media (max-width: 580px) {

    .catalog-grid {
        grid-template-columns:
            repeat(2, 1fr);

        gap: 8px;
    }

    .product-image-wrap {
        height: 120px;
    }

    .product-img {
        padding: 6px;
    }

    .product-info {
        padding: 8px;
    }

    .product-title {
        font-size: 0.78rem;
        min-height: 2.4em;
    }

    .product-price {
        font-size: 0.95rem;
    }

    .add-btn {
        padding: 8px;
        font-size: 0.8rem;
    }

    .product-image-fallback {
        font-size: 0.6rem;
        padding: 3px 6px;
    }
}