/* -- بطاقات الاختيار -- */
.im-variation-cards-wrapper {
    display: flex;
    gap: 20px; /* زيادة الفراغ بين البطاقات */
    margin: 30px 0;
    flex-wrap: wrap; /* باش البطاقات يتكاو فلاطات صغار */
    font-family: 'Cairo', sans-serif; /* تطبيق خط القاهرة */
}

.im-variation-card {
    flex: 1; /* باش البطاقات ياخدو مساحة متساوية */
    background: #ffffff; /* خلفية بيضاء افتراضية */
    border: 1px solid #e0e0e0; /* حدود خفيفة */
    border-radius: 16px; /* حواف دائرية أكثر */
    padding: 25px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    text-align: center;
    display: flex; /* لترتيب المحتوى داخلياً */
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); /* ظل خفيف */
    overflow: hidden; /* لإخفاء أي جزء خارج عن البطاقة (مثل الـ badge) */
}

/* تاثير الهوفر (Hover Effect) */
.im-variation-card:hover {
    transform: translateY(-5px); /* البطاقة تطلع شوية الفوق */
    box-shadow: 0 8px 25px rgba(0,0,0,0.1); /* الظل يكبر */
}

/* البطاقة النشطة (المختارة) */
.im-variation-card.active {
    border-color: #007bff; /* لون حدود أزرق */
    background: linear-gradient(135deg, #e6f3ff, #f0f8ff); /* تدرج أزرق فاتح */
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 1; /* باش تبان فوق البطاقات الأخرى */
}

/* البادج (Tag) "الأكثر طلباً" */
.im-badge {
    position: absolute;
    top: 0; /* يبدا من الفوق */
    right: 0; /* ويلصق على اليمين */
    background: linear-gradient(45deg, #007bff, #0056b3); /* تدرج أزرق غامق */
    color: white;
    font-size: 0.85em;
    font-weight: 700;
    padding: 8px 15px;
    border-bottom-left-radius: 16px; /* حواف دائرية فالتحت ديال اليسار */
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
/* إخفاء الايقونة الافتراضية ديال التحديد */
.im-card-select-icon {
    display: none; 
    margin-top: 15px;
    font-size: 1.5em;
    color: #007bff; /* لون الأيقونة أزرق */
}
/* اظهار ايقونة التحديد فقط في البطاقة النشطة */
.im-variation-card.active .im-card-select-icon {
    display: block; 
}


/* -- المحتوى الداخلي للبطاقة -- */
.im-card-title {
    font-size: 1.35em;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.im-card-price {
    font-size: 1.8em; /* ثمن كبير وواضح */
    font-weight: 800; /* غليظ بزاف */
    color: #000; /* أسود للثمن */
    margin-top: auto; /* يدفع الثمن للأسفل */
}

/* -- الأزرار (أضف للسلة، الشراء المباشر، واتساب) -- */
.im-btn {
    font-family: 'Cairo', sans-serif;
    background: #000; /* أسود كما طلبت */
    color: #fff;
    border: none;
    padding: 14px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: block; /* باش ياخد العرض كامل */
    width: 100%;
    text-align: center;
    transition: background 0.3s ease, transform 0.2s ease;
}

.im-btn:hover {
    background: #333; /* لون أغمق شوية عند الهوفر */
    transform: translateY(-2px);
    color: #fff;
}

/* أزرار الواتساب */
.im-whatsapp-btn {
    background: #25d366; /* لون واتساب أخضر */
    margin-top: 10px;
}
.im-whatsapp-btn:hover {
    background: #1da851;
}

/* الأزرار داخل منطقة الدفع (لو كنا كنستعملو [im_payment_buttons]) */
.im-payment-buttons-wrapper .im-btn {
    margin-bottom: 10px; /* فراغ بين الأزرار */
}
/* ... (CSS السابق) ... */

/* تنسيق منطقة الصورة داخل البطاقة */
.im-card-image-wrapper {
    margin-bottom: 15px;
    height: 120px; /* ارتفاع ثابت لتوحيد البطاقات */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.im-card-img {
    max-height: 100%; /* الصورة لا تتجاوز ارتفاع المنطقة */
    width: auto; /* العرض يتناسب تلقائياً */
    max-width: 100%;
    object-fit: contain; /* يحافظ على أبعاد الصورة كاملة داخل الإطار */
    transition: transform 0.3s ease;
}

/* تأثير زووم خفيف على الصورة عند الهوفر */
.im-variation-card:hover .im-card-img {
    transform: scale(1.05);
}

.im-variation-card {
    background: #ffffff;
    border: 2px solid #f0f0f0; /* حدود أغلظ قليلاً */
    border-radius: 20px; /* تدوير أكثر للحواف مثل التصميم المطلوب */
    padding: 20px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 10px 30px -15px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* تأثير الهوفر */
.im-variation-card:hover {
    transform: translateY(-8px);
    border-color: #e0e0e0;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15);
}

/* البطاقة النشطة */
.im-variation-card.active {
    border-color: #000; /* أسود للبطاقة المختارة */
    background: #fff;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

/* منطقة الصورة */
.im-card-image-wrapper {
    background: #f8f9fa; /* خلفية رمادية خفيفة للصورة */
    margin: -20px -20px 15px -20px; /* تمديد الخلفية لتغطي الرأس */
    padding: 20px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f0f0f0;
}
.im-card-img {
    max-height: 100%;
    width: auto;
    mix-blend-mode: multiply; /* حيلة لدمج خلفية الصورة البيضاء مع الخلفية الرمادية */
}

/* النصوص والأسعار */
.im-card-title {
    font-size: 1.1em;
    font-weight: 800;
    color: #2d3436;
    margin: 10px 0;
}
.im-card-price {
    font-size: 1.4em;
    color: #000;
    font-weight: 900;
    letter-spacing: -1px;
}

/* البادج */
.im-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #000;
    color: #fff;
    font-size: 0.75em;
    padding: 5px 12px;
    border-radius: 12px;
    font-weight: bold;
    z-index: 2;
}

/* -- شبكة البطاقات المتجاوبة (3 في السطر) -- */
.im-variation-cards-wrapper {
    display: grid;
    /* قلصنا العرض الأدنى لـ 150px للسماح بظهور 3 بطاقات في المساحات الضيقة */
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap:6px; /* تقليص الفراغ قليلاً */
    margin: 25px 0;
    font-family: 'Cairo', sans-serif;
}

/* -- تصميم البطاقة الأساسي -- */
.im-variation-card {
    background: #ffffff;
    border: 2px solid #ececec;
    border-radius: 12px;
    padding: 8px; /* تقليص الحواشي الداخلية */
    cursor: pointer;
    position: relative;
    transition: all 0.25s ease-in-out;
    text-align: center;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* تأثير الهوفر */
.im-variation-card:hover {
    border-color: #d0d0d0;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

/* -- البطاقة النشطة (المختارة) - مهم جداً لتعويض علامة الصح -- */
.im-variation-card.active {
    border-color: #000000; /* حدود سوداء واضحة */
    background-color: #f8f9fa; /* خلفية رمادية خفيفة جداً للتمييز */
    box-shadow: 0 0 0 1px #000000 inset; /* حيلة لجعال الحدود تبدو أسمك داخلياً */
}

/* -- منطقة الصورة -- */
.im-card-image-wrapper {
    height: 100px; /* تصغير ارتفاع الصورة */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.im-card-img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}
.im-variation-card:hover .im-card-img {
    transform: scale(1.08); /* تكبير خفيف عند الهوفر */
}

/* -- النصوص والأسعار -- */
.im-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.im-card-title {
    font-size: 1em; /* تصغير الخط قليلاً */
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.3;
}
.im-card-price {
    font-size: 1.1em;
    font-weight: 800;
    color: #000;
}

/* -- بادج "الأكثر مبيعاً" الاحترافي -- */
.im-badge {
    position: absolute;
    top: 8px;
    left: 8px; /* وضعناها على اليسار لعدم تغطية زر الحذف إذا وجد مستقبلاً */
    background: #000;
    color: #fff;
    font-size: 0.7em;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px; /* فراغ بين الأيقونة والنص */
}
.im-badge i {
    color: #ff9f43; /* لون برتقالي لأيقونة النار */
    font-size: 1.1em;
}

/* تحسينات لأجهزة الموبايل الصغيرة جداً */
@media (max-width: 480px) {
    .im-variation-cards-wrapper {
        grid-template-columns: repeat(2, 1fr); /* إجبار بطاقتين في السطر للموبايل */
    }
    .im-card-title { font-size: 0.9em; }
    .im-card-price { font-size: 1em; }
}
.im-scarcity-timer {
    background: #fff4e6; /* خلفية برتقالية فاتحة */
    color: #d35400;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 0.95em;
}
.im-scarcity-timer i { font-size: 1.2em; }
.im-date-highlight {
    font-weight: 800;
    text-decoration: underline;
}
.im-social-proof-wrapper {
    display: flex;
    flex-direction: column; /* أو row إذا بغيتيهم في سطر واحد */
    gap: 5px;
    margin-bottom: 20px;
}
.im-stars {
    color: #f1c40f; /* لون ذهبي للنجوم */
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 2px;
}
.im-rating-number {
    color: #333;
    font-weight: bold;
    margin-right: 8px;
    font-size: 0.9em;
}
.im-proof-text {
    color: #666;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}
.im-benefit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 1.05em;
    color: #2c3e50;
}
.im-benefit-item i {
    font-size: 1.3em;
    flex-shrink: 0; /* باش الأيقونة متصغرش إلا كان النص طويل */
}

/* -- قسم الضمانات الذكية -- */
.im-guarantees-wrapper {
    display: flex;
    justify-content: space-between; /* توزيع متساوي */
    align-items: center;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee; /* خط فاصل خفيف من الفوق */
    font-family: 'Cairo', sans-serif;
}

.im-guarantee-item {
    display: flex;
    flex-direction: column; /* الأيقونة فوق النص */
    align-items: center;
    text-align: center;
    flex: 1;
    color: #555;
    font-size: 0.9em;
}

.im-guarantee-item i {
    font-size: 1.8em;
    color: #333; /* لون الأيقونة غامق شوية */
    margin-bottom: 8px;
    opacity: 0.8;
}

/* في الموبايل، ممكن نصغرو الخط شوية باش يجيو مقادين */
@media (max-width: 480px) {
    .im-guarantees-wrapper { gap: 5px; }
    .im-guarantee-item { font-size: 0.8em; }
    .im-guarantee-item i { font-size: 1.5em; }
}


/* إجبار أزرار الدفع على الظهور */
.im-payment-buttons-container {
    display: block !important;
    width: 100%;
    margin-top: 15px;
    clear: both;
    z-index: 10;
    position: relative;
}

/* تصحيح خاص لـ PayPal Smart Buttons إذا كانت مخفية */
.im-payment-buttons-container #ppc-button,
.im-payment-buttons-container .paypal-buttons,
.im-payment-buttons-container #wc-stripe-payment-request-wrapper,
.im-payment-buttons-container #wc-stripe-payment-request-button {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
}