/* --- 1. תגיות מוצר: הגדרות כלליות --- */
.product-grid-item, 
.product-element-top { 
    overflow: visible !important; 
}

/* אפקט ניאון כחול עוצמתי למסגרת המוצר - רק אם הוא מוצר חדש */
.product-grid-item:has(.product-label.new) {
    /* שילוב של מספר שכבות צל ליצירת עומק וזוהר חזק יותר */
    box-shadow: 
        0 0 15px rgba(0, 74, 173, 0.8),  /* הילה קרובה חזקה */
        0 0 15px rgba(0, 74, 173, 0.6),  /* הילה בינונית */
        0 0 50px rgba(0, 74, 173, 0.4),  /* הילה רחבה */
        inset 0 0 10px rgba(0, 74, 173, 0.3) !important; /* תוספת זוהר פנימי קל */
    
    border: 3px solid #004aad !important; /* מסגרת מעט עבה יותר כדי להדגיש את הניאון */
    border-radius: 8px; /* אופציונלי: עיגול פינות מרכך את הניאון */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* תוספת לתיקון מסגרת שלמה למוצרים רגילים (שאינם חדשים) */
.product-grid-item:not(:has(.product-label.new)) {
    border: 1px solid #e1e1e1; /* מסגרת בסיסית ושלמה לכל מוצר */
    border-radius: 8px;
}

.product-grid-item {
    padding: 10px; /* ריווח פנימי למניעת חיתוך התוכן */
    background-color: #fff;
    box-sizing: border-box; /* מוודא שהמסגרת לא חורגת מגבולות האלמנט */
    overflow: hidden !important; /* תוספת קריטית - חותך תוכן שחורג מהפינות המעוגלות */
}

/* הדגשת הניאון במעבר עכבר - אפקט "הדלקה" עז יותר */
.product-grid-item:has(.product-label.new):hover {
    box-shadow: 
        0 0 20px rgba(0, 74, 173, 1), 
        0 0 40px rgba(0, 74, 173, 0.8), 
        0 0 80px rgba(0, 74, 173, 0.6),
        inset 0 0 15px rgba(0, 74, 173, 0.5) !important;
    transform: translateY(-5px); /* קפיצה קטנה למעלה שמוסיפה למראה הדיגיטלי */
}

.product-grid-item .product-labels {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    display: block;
    pointer-events: none;
    z-index: 25;
}

/* --- 2. תווית NEW: עיצוב ואנימציה --- */
.product-grid-item .product-labels .product-label.new {
    position: absolute !important;
    top: -32px;
    left: 3%;
    transform: translateX(-50%);
    width: fit-content;
    padding: 8px 40px;
    font-size: 20px;
    font-weight: bold;
    white-space: nowrap;
    background-color: #004aad;
    color: #ffffff;
    overflow: hidden;
    pointer-events: auto;
    /* צל לתווית שמתכתב עם מסגרת המוצר */
    box-shadow: 0 0 20px #004aad; /* צל מעט חזק יותר לתווית */
    border: 1px solid rgba(255, 255, 255, 0.5); /* גבול לבן בולט יותר לתווית */
}

/* אפקט הברק */
.product-grid-item .product-labels .product-label.new::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -100%;
    width: 40%;
    height: 200%;
    background: rgba(255, 255, 255, 0.6); /* ברק לבן חזק יותר */
    transform: rotate(30deg);
    animation: digital-shine 2.5s infinite; /* אנימציה מעט מהירה יותר */
}

@keyframes digital-shine {
    0% { left: -100%; }
    20%, 100% { left: 150%; }
}

/* --- 3. תוויות אחרות (מבצע וכו') --- */
.product-grid-item .product-labels .product-label:not(.new) {
    position: relative !important;
    display: table;
    margin: 0 0 5px 10px;
    left: 0;
    transform: none;
}

/* --- 4. סרגל משלוח חינם (RTL) --- */
.wd-free-shipping-bar {
    direction: rtl;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* --- 5. התאמות לנייד --- */
@media (max-width: 768px) {
    .product-grid-item .product-labels .product-label.new {
        font-size: 14px;
        padding: 5px 20px;
        top: -22px;
    }
    /* בנייד נחליש מעט את הניאון כדי לא להכביד על המעבד */
    .product-grid-item:has(.product-label.new) {
        box-shadow: 0 0 15px rgba(0, 74, 173, 0.5), inset 0 0 5px rgba(0, 74, 173, 0.2) !important;
    }
}

/* --- 6. מחיר וסיומת מע"מ --- */
.woocommerce-price-suffix {
    display: block !important;
    font-size: 0.75em !important;
    margin-top: 2px !important;
    color: #777 !important;
}

/* מכולה ראשית - ריכוז כל התתי-קטגוריות למרכז המסך */
.sub-categories-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* מרכז את כל הקוביות למרכז הדף */
    gap: 20px;
    padding: 20px auto;
    max-width: 100%;
    margin: 0 auto;
}

/* עיצוב פריט קטגוריה בודד */
.sub-category-item {
    flex: 0 1 calc(20% - 20px); /* במחשב: 5 פריטים בשורה */
    min-width: 150px;           /* מונע מהם להיות קטנים מדי */
    display: flex;
    flex-direction: column;
    align-items: center;        /* מרכז את התמונה והטקסט בתוך הקוביה */
    text-align: center;         /* מרכז את הכותרת */
    margin-bottom: 20px;
    text-decoration: none;
}

/* עיצוב התמונה - שמירה על אחידות וניקיון */
.sub-category-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;        /* יוצר ריבוע אחיד לכל התמונות */
    object-fit: contain;        /* שומר על פרופורציות המוצר בתמונה */
    background-color: #f2f2f2;  /* רקע אפור בהיר מאוד */
    border-radius: 5px;
    border: none;               /* ללא מסגרות */
    margin-bottom: 10px;
}

/* כותרת הקטגוריה - ממורכזת לחלוטין */
.sub-category-item .category-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
    margin: 0 auto;            /* מוודא שהכותרת במרכז */
    width: 90%;                /* מונע מהטקסט להיצמד לקצוות */
}

/* התאמה למובייל (טלפונים וחלק מהטאבלטים) */
@media (max-width: 768px) {
    .sub-categories-grid {
        gap: 10px;             /* צמצום רווחים במובייל */
        padding: 10px;
    }

    .sub-category-item {
        flex: 0 1 calc(45% - 10px); /* 2 פריטים בשורה במובייל למראה ברור */
        min-width: 130px;
    }

    .sub-category-item .category-title {
        font-size: 13px;       /* הקטנה קלה של הטקסט למסכים קטנים */
    }
}