/* ═══════════════════════════════════════════════════════════════
   UpMobile Theme - Independent Product Card
   ═══════════════════════════════════════════════════════════════
   
   این فایل به صورت کاملاً مستقل طراحی شده است تا در هر نقطه از سایت
   (فروشگاه، صفحه اصلی، آرشیوها و...) که کارت محصول فراخوانی شود،
   ظاهری یکپارچه و مدرن داشته باشد.
   
   @package UpMobile
   @version 2.0.0
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   ۱. کانتینر اصلی کارت (Card Container)
   ═══════════════════════════════════════════════════════════ */
.up-p-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    padding: 12px;
    border: 1px solid #f0f0f5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.up-p-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(72, 55, 243, 0.1);
    border-color: rgba(72, 55, 243, 0.2);
}

/* ═══════════════════════════════════════════════════════════
   ۲. تصویر محصول (Product Image)
   ═══════════════════════════════════════════════════════════ */
.up-p-card__img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f9fafc;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    padding: 10px;
    position: relative;
}

.up-p-card__img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.up-p-card:hover .up-p-card__img img {
    transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════════════
   ۳. محتوای کارت (Card Content)
   ═══════════════════════════════════════════════════════════ */
.up-p-card__content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

/* --- عنوان محصول (در دسکتاپ کامل، بدون بریدگی) --- */
.up-p-card__title {
    font-size: 13.5px;
    font-weight: 700;
    color: #222 !important;
    line-height: 1.6;
    text-decoration: none;
    transition: color 0.2s;
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset !important;
    min-height: auto !important;
}

.up-p-card__title:hover {
    color: #4837F3 !important;
}

/* ═══════════════════════════════════════════════════════════
   ۴. قیمت محصول (Product Price)
   ═══════════════════════════════════════════════════════════ */
.up-p-card__price {
    font-size: 15px;
    font-weight: 900;
    color: #222;
    font-family: inherit;
    margin-top: auto; /* هول دادن به پایین برای هم‌ترازی کارت‌ها */
}

.up-p-card__price ins,
.up-p-card__price .woocommerce-Price-amount {
    text-decoration: none !important;
    color: #222 !important;
}

.up-p-card__price del {
    font-size: 11px;
    color: #999;
    font-weight: 500;
    text-decoration: line-through;
    display: block;
    margin-bottom: 3px;
}

/* ═══════════════════════════════════════════════════════════
   ۵. کادر اقساط ۳ بعدی (Installment Box)
   ═══════════════════════════════════════════════════════════ */
.up-p-card__installment {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(145deg, #f0f2f9, #ffffff);
    border: 1px solid #e6e8f5;
    border-radius: 10px;
    padding: 10px;
    font-size: 13px; /* سایز خوانا در دسکتاپ */
    font-weight: 800;
    color: #4837F3;
    box-shadow: inset 2px 2px 5px rgba(72, 55, 243, 0.05), 0 2px 5px rgba(0,0,0,0.02);
    text-decoration: none;
    transition: all 0.3s;
}

.up-p-card__installment:hover {
    box-shadow: inset 2px 2px 5px rgba(72, 55, 243, 0.1), 0 4px 10px rgba(72, 55, 243, 0.15);
    transform: translateY(-2px);
}

.up-p-card__installment svg {
    width: 16px;
    height: 16px;
    stroke: #4837F3;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   ۶. دکمه افزودن به سبد خرید (Add to Cart Button)
   ═══════════════════════════════════════════════════════════ */
.up-p-card__btn-wrap {
    margin-top: 5px;
    width: 100%;
}

.up-p-card__btn-wrap .button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    padding: 12px 15px !important;
    background: linear-gradient(135deg, #6b5bff, #4837F3) !important;
    color: #fff !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    text-decoration: none !important;
    border: none !important;
    margin: 0 !important;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 6px 15px rgba(72, 55, 243, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.up-p-card__btn-wrap .button:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 25px rgba(72, 55, 243, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.up-p-card__btn-wrap .button:active {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(72, 55, 243, 0.3) !important;
}

/* مخفی کردن دکمه مشاهده سبد که ووکامرس بعد از افزودن اضافه می کند */
.up-p-card__btn-wrap .button.added_to_cart {
    display: none !important;
}

/* حالت Loading هنگام ارسال درخواست AJAX */
.up-p-card__btn-wrap .button.loading {
    opacity: 0.7;
    pointer-events: none;
}
.up-p-card__btn-wrap .button.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: up-p-card-spin 0.8s linear infinite;
}

@keyframes up-p-card-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════
   ۷. ریسپانسیو (موبایل)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    
    /* کوچک‌تر شدن کلی کارت */
    .up-p-card {
        padding: 10px;
        border-radius: 12px;
    }

    /* محدود کردن عنوان به ۲ خط در موبایل */
    .up-p-card__title {
        font-size: 12px;
        line-height: 1.5;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        min-height: 36px !important;
    }

    /* قیمت */
    .up-p-card__price {
        font-size: 14px;
    }

    /* کوچک‌تر شدن کادر اقساط */
    .up-p-card__installment {
        font-size: 11px;
        padding: 8px;
        gap: 4px;
    }
    .up-p-card__installment svg {
        width: 14px;
        height: 14px;
    }

    /* کوچک‌تر شدن دکمه خرید */
    .up-p-card__btn-wrap .button {
        font-size: 12px !important;
        padding: 9px 10px !important;
        border-radius: 10px !important;
    }
}