/* Product card — Sprint 11 .pc2 redesign */

.tm-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tm-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* ────── Image area — 1:1 aspect ratio ────── */
.tm-card-image-link {
    display: block;
    text-decoration: none;
}

.tm-card-image {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--tm-bg-alt);
    border-radius: 4px;
}

.tm-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.tm-card-img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--wp--preset--color--bg-alt) 0%, var(--wp--preset--color--border) 100%);
}

.tm-product-card:hover .tm-card-img {
    transform: scale(1.03);
}

/* ────── Badge top-left only ────── */
.tm-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 5px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    z-index: 2;
    border-radius: 2px;
}

.tm-card-badge.badge-bestseller { background: var(--tm-accent); }
.tm-card-badge.badge-new        { background: var(--tm-text); }
.tm-card-badge.badge-sale       { background: var(--tm-success); }

/* ────── Info area ────── */
.tm-card-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 14px 4px 8px;
    gap: 8px;
}

/* ────── Meta row: категория | флаг+страна ────── */
.tm-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tm-text-muted);
    min-width: 0;
}

.tm-card-cat {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.tm-card-country {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    max-width: 50%;
    overflow: hidden;
}

.tm-card-flag-img {
    width: 16px;
    height: auto;
    flex-shrink: 0;
    display: block;
}

.tm-card-country-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ────── Title ────── */
.tm-card-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.2;
    margin: 0;
    color: var(--tm-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tm-card-name a {
    color: inherit;
    text-decoration: none;
}

.tm-card-name a:hover {
    color: var(--tm-accent);
}

/* ────── Stars — reserved slot, gold color, не сдвигает layout ────── */
.tm-card-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 18px;
    font-size: 13px;
    line-height: 1;
}

.tm-card-stars .tm-star-full,
.tm-card-stars .tm-star-half {
    color: #DAA520;
}

.tm-card-stars .tm-star-empty {
    color: #E5E0D5;
}

.tm-card-rating-text {
    margin-left: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--tm-text-muted);
}

/* ────── Stars base (used outside card: product-summary) ────── */
.tm-stars {
    display: inline-flex;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--wp--preset--color--accent);
    line-height: 1;
}

.tm-star-empty {
    color: var(--wp--preset--color--text-light);
}

/* ────── Bottom row — price + add (margin-top: auto pin to bottom) ────── */
.tm-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
}

.tm-card-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.tm-card-price .woocommerce-Price-amount,
.tm-card-price > bdi {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 26px;
    font-weight: 600;
    color: var(--tm-accent);
    line-height: 1;
}

.tm-card-price del .woocommerce-Price-amount,
.tm-card-price del > bdi {
    font-size: 14px;
    color: var(--tm-text-light);
    text-decoration: line-through;
    font-weight: 400;
}

.tm-card-price ins .woocommerce-Price-amount,
.tm-card-price ins > bdi {
    font-size: 26px;
    color: var(--tm-accent);
    text-decoration: none;
}

.tm-card-unit {
    font-size: 12px;
    font-weight: 400;
    color: var(--tm-text-muted);
}

.tm-card-add {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--wp--preset--color--text);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: background 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tm-card-add:hover {
    background: var(--wp--preset--color--accent);
}

.tm-card-add:active {
    transform: scale(0.92);
}

.tm-card-add.tm-loading {
    opacity: 0.6;
    cursor: wait;
}

/* ────── Out of stock state ────── */
.tm-product-card.out-of-stock .tm-card-image {
    opacity: 0.65;
}

.tm-product-card.out-of-stock .tm-card-name {
    color: var(--wp--preset--color--text-muted);
}

/* ────── Mobile ────── */
@media (max-width: 768px) {
    .tm-card-name {
        font-size: 15px;
    }

    .tm-card-price .woocommerce-Price-amount,
    .tm-card-price > bdi {
        font-size: 22px;
    }

    .tm-card-meta {
        font-size: 10px;
    }

    .tm-card-country {
        max-width: 45%;
    }
}
