/**
 * Smart CTA WooCommerce — استایل کارت فرانت‌اند
 * جهت از [dir="rtl"/"ltr"] (که PHP از is_rtl() می‌نویسد) خوانده می‌شود؛
 * هیچ direction ثابتی در این فایل نیست.
 */

.cta-wrapper.card-style {
    /* رنگ‌ها و مقادیر تکرارشونده به‌صورت CSS Custom Property، برای نگهداری آسان‌تر */
    --cta-primary: #004A42;
    --cta-primary-hover-bg: #ffde5a;
    --cta-card-bg: #f7f7f7;
    --cta-border-color: #ccc;
    --cta-title-color: #333;
    --cta-muted-text: #777;
    --cta-accent-text: #d9534f;
    --cta-sale-price: #555;
    --cta-original-price: #aaa;
    --cta-disabled-bg: #ccc;
    --cta-disabled-text: #666;
    --cta-btn-text: #ffffff;

    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--cta-card-bg);
    border: 1px solid var(--cta-border-color);
    border-radius: 12px;
    max-width: 320px;
    margin: 20px auto;
    overflow: hidden;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .05);
    text-align: center;
    position: relative;
}
.cta-wrapper[dir="rtl"] { direction: rtl; }
.cta-wrapper[dir="ltr"] { direction: ltr; }

.cta-image-wrap { width: 100%; margin-bottom: 15px; background-color: var(--cta-card-bg); }
.cta-image-wrap a { display: block; }
.cta-image-wrap img { width: 100%; height: auto; object-fit: cover; border-radius: 12px 12px 0 0; display: block; }

.cta-content { padding: 0 15px; width: 100%; box-sizing: border-box; background-color: var(--cta-card-bg); }

.cta-custom-title { font-size: 14px; color: var(--cta-accent-text); font-weight: bolder; margin-bottom: 5px; }
.cta-custom-desc { font-size: 12px; color: var(--cta-muted-text); padding-bottom: 15px; border-bottom: 1px solid var(--cta-border-color); }

.cta-product-name { font-size: 16px !important; color: var(--cta-title-color) !important; font-weight: bold !important; margin: 20px 0 15px; line-height: 1.5; }
.cta-product-name a { color: var(--cta-title-color) !important; text-decoration: none !important; transition: color .3s ease; }
.cta-product-name a:hover { color: var(--cta-primary) !important; }

.cta-price { font-size: 15px; color: var(--cta-muted-text); margin-bottom: 20px; }
.cta-price ins { text-decoration: none; color: var(--cta-sale-price); font-weight: bold; }
.cta-price del { font-size: 13px; color: var(--cta-original-price); margin-inline-end: 5px; }

.cta-action {
    width: 100%;
    padding: 0 15px 20px;
    box-sizing: border-box;
    background-color: var(--cta-card-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.cta-action .added_to_cart {
    font-size: 13px !important;
    color: var(--cta-primary) !important;
    font-weight: bold !important;
    text-decoration: none !important;
    border-bottom: 1px dashed var(--cta-primary);
    transition: all .25s ease;
}
.cta-action .added_to_cart:hover { color: var(--cta-accent-text) !important; border-bottom-color: var(--cta-accent-text); }

.cta-btn svg { display: none !important; }
.cta-btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 40px;
    background-color: var(--cta-primary);
    color: var(--cta-btn-text) !important;
    border-radius: 5px;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    transition: all .25s ease;
    z-index: 1;
    min-height: 35px;
    border: none;
}
.cta-btn span { display: inline-block; transition: transform .25s ease; transform: translateY(0); }
/* آیکون سبد خرید که هنگام هاور از پایین ظاهر می‌شود — کاملاً عمودی (translateY)،
   پس به جهت RTL/LTR وابسته نیست و نیازی به تغییر برای حالت LTR ندارد. */
.cta-btn::after {
    content: '';
    width: 24px;
    height: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, 150%);
    transition: transform .25s ease, background-color .25s ease;
    background-color: #000;
    -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 fill=%22none%22 viewBox=%220 0 24 24%22 stroke=%22black%22 stroke-width=%222%22%3E%3Cpath stroke-linecap=%22round%22 stroke-linejoin=%22round%22 d=%22M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z%22/%3E%3C/svg%3E');
    mask-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 fill=%22none%22 viewBox=%220 0 24 24%22 stroke=%22black%22 stroke-width=%222%22%3E%3Cpath stroke-linecap=%22round%22 stroke-linejoin=%22round%22 d=%22M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z%22/%3E%3C/svg%3E');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}
.cta-btn:hover { background-color: var(--cta-primary-hover-bg); }
.cta-btn:hover span { transform: translateY(-250%); }
.cta-btn:hover::after { transform: translate(-50%, -50%); }

.cta-btn-disabled { background-color: var(--cta-disabled-bg) !important; color: var(--cta-disabled-text) !important; cursor: not-allowed; box-shadow: none; }

.cta-woo-grid-layout { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; width: 100%; margin: 30px 0; }
.cta-woo-grid-layout .cta-wrapper.card-style { margin: 0 !important; flex: 1 1 300px; max-width: 320px; height: 100%; }
.cta-woo-grid-layout p, .cta-woo-grid-layout br { display: none; }
