/* ====================== PRODUCT CARD ====================== */

.product-card {
    background: #fff;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    border: 2px solid transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: .3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.product-card-link {
    text-decoration: none !important;
    color: inherit !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ====================== IMAGE BOX ====================== */

.img-box {
    height: 180px;
    padding: 10px;
    display: flex;
    align-items: flex-end;           /* Опускает фото к нижнему краю */
    justify-content: center;
    position: relative;
    background: #ffffff;
    overflow: hidden;
}

.main-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: .3s ease;
    transform: translateY(15px);
}

.main-img.is-loaded {
    opacity: 1;
    transform: translateY(0);
}

/* ====================== VENDOR BADGE ====================== */

.vendor-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 60px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    z-index: 2;
    pointer-events: none;
}

.vendor-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 1px #fff);
}

/* ====================== UNIVERSAL BADGES ====================== */

.badge-container {
    position: absolute;
    bottom: 0px;
    right: 10px;
    z-index: 10;
    display: flex;
    flex-direction: row-reverse;
    gap: 4px;
}

.universal-badge {
    min-width: 32px;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    white-space: nowrap;
}

/* Мобильная версия бейджей */
@media (max-width: 768px) {
    .universal-badge {
        padding: 5px 5px;
        font-size: 11px;
        transform: translateY(-5px);
    }
}

/* ====================== NAME ====================== */

.name {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.35;
    height: 3em;                    /* 3 строки */
    margin-bottom: 10px;
    color: #333;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}


/* ====================== RATING & REVIEWS ====================== */

.rating-mini-row {
    margin-top: -8px;
    margin-bottom: 6px;
    line-height: 1;
}

.rating-stars {
    color: #ffc107;
    font-size: 0.65rem;
}

.rating-stars i {
    margin-right: 1px;
}

.reviews-mini {
    font-size: 0.65rem;
    opacity: 0.7;
}

/* ====================== PRICE ====================== */

.price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
}

.price-block {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.old-price-wrapper {
    font-size: 0.85rem;
    line-height: 1;
    margin-bottom: 2px;
    color: #888;
}

.price-tag {
    font-size: 1.25rem;
    font-weight: 800;
    color: #2d3436;
    white-space: nowrap;
}


/* Discount badge inline */
.discount-badge-inline {
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 800;
    min-height: 34px;
    margin-left: 2px; /* Додатковий мікро-контроль відступу */
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* ====================== BUTTONS ====================== */
.btn-buy {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border: none;
    border-radius: 10px;
    background: #f0f4f8;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s ease;
}

.btn-buy:hover:not(:disabled) {
    background: var(--primary) !important;
    color: #fff !important;
}

.btn-buy.added {
    background: #28a745 !important;
    color: #fff !important;
}

.wishlist-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #c7c5c6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: .2s ease;
}

.wishlist-btn:hover {
    transform: scale(1.1);
    background: #fff;
}

.wishlist-btn.active {
    background: #ff4757;
    color: #fff;
}

.wishlist-btn.active i {
    font-weight: 900;
}

/* ====================== LOADING SKELETON ====================== */

.img-box.loading {
    background: #f4f9ff;
    position: relative;
    overflow: hidden;
}

/* Капля */
.img-box.loading::before {
    content: "";
    position: absolute;
    width: 6px;
    height: 10px;
    background: #2563eb;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: drop-animation 1.4s ease-in infinite;
    z-index: 2;
}

/* Волна */
.img-box.loading::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    top: 55%;
    left: 50%;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.4);
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    animation: ripple-animation 1.4s ease-out infinite;
    z-index: 1;
}

@keyframes drop-animation {
    0%   { top: 5%; opacity: 0; }
    30%  { opacity: 1; }
    80%  { top: 55%; opacity: 1; transform: translateX(-50%) scaleY(1.1); }
    100% { top: 55%; opacity: 0; transform: translateX(-50%) scaleY(0.6); }
}

@keyframes ripple-animation {
    0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(4); opacity: 0; }
}

/* Скрываем контент во время загрузки */
.img-box.loading .vendor-badge,
.img-box.loading .badge-container,
.img-box.loading .main-img {
    opacity: 0 !important;
    visibility: hidden;
}