/*===================================================================================
 * FILE: hub-trend-product-brand.css
 * PURPOSE: Style product brand logo in WooCommerce cards and single product page
 * VERSION: 2.0.0 - Added clickable brand links and enhanced interactions
 *----------------------------------------------------------------------------------*/

/* الحاوية الرئيسية للعلامة التجارية */
.product-brand-logo-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px !important;
    justify-content: center;
    flex-wrap: wrap;
}

/* نص "Brand" */
.product-brand-logo-wrapper .brand-label {
    color: #415161;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* عنصر العلامة التجارية الفردي */
.brand-item {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

/* حاوية العلامة التجارية مع التلميح */
.brand-tooltip-container {
    position: relative;
    display: inline-block;
}

/* 🔗 رابط العلامة التجارية */
.brand-link {
    display: inline-block;
    /* text-decoration: none; */
    border: none;
    background: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    /* padding: 0px; */
}

.brand-link:hover,
.brand-link:focus {
    transform: translateY(-2px);
    background: rgba(65, 81, 97, 0.05);
    outline: none;
}

.brand-link:focus-visible {
    outline: 2px solid #3a8bbb;
    outline-offset: 2px;
}

/* شعار العلامة التجارية */
.brand-tooltip-container img.brand-logo {
    max-height: 35px;
    max-width: 90px;
    width: auto !important;
    height: auto;
    object-fit: contain;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 3px;
    box-shadow: none !important;
    display: block;
}

/* تأثيرات Hover للشعار */
.brand-link:hover img.brand-logo,
.brand-link:focus img.brand-logo {
    transform: scale(1.08);
    filter: brightness(1.1);
}

/* التلميح */
.brand-tooltip {
    visibility: hidden;
    opacity: 0;
    width: 220px;
    background-color: #415161;
    color: #fff;
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 8px;
    padding: 8px 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* السهم الصغير للتلميح */
.brand-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #415161 transparent transparent transparent;
}

/* إظهار التلميح عند Hover */
.brand-tooltip-container:hover .brand-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* تحسينات للصفحة المفردة */
.single-product .product-brand-logo-wrapper {
    justify-content: center;
    margin: 0px 0;
    gap: 10px;
}

.single-product .brand-label {
    font-size: 14px;
    color: #2c3e50;
}

.single-product .brand-tooltip-container img.brand-logo {
    max-height: 35px;
    max-width: 90px;
}

/* تحسينات لبطاقات المنتجات */
.woocommerce-loop-product__footer .product-brand-logo-wrapper {
    margin: 8px 0 4px 0;
    gap: 6px;
}

.woocommerce-loop-product__footer .brand-label {
    font-size: 12px;
}

.woocommerce-loop-product__footer .brand-tooltip-container img.brand-logo {
    max-height: 35px;
    max-width: 90px;
}

/* تحسينات للجوال */
@media (max-width: 768px) {
    .product-brand-logo-wrapper {
        gap: 6px;
        margin: 6px 0;
    }
    
    .brand-label {
        font-size: 12px;
    }
    
    .brand-tooltip-container img.brand-logo {
        max-height: 35px;
        max-width: 90px;
    }
    
    .brand-tooltip {
        width: 180px;
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .single-product .product-brand-logo-wrapper {
        justify-content: center;
        margin-top: 0px;
        margin-bottom: 0px;
    }
}

/* تحسينات للأجهزة التي تلمس فقط */
@media (hover: none) and (pointer: coarse) {
    .brand-tooltip {
        display: none; /* إخفاء التلميح على الأجهزة التي لا تدعم hover */
    }
    
    .brand-link:active img.brand-logo {
        transform: scale(0.95);
    }
}

/* دعم تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
    .brand-link,
    .brand-tooltip-container img.brand-logo,
    .brand-tooltip {
        transition: none;
    }
    
    .brand-link:hover,
    .brand-link:focus {
        transform: none;
    }
}

/* حالات خاصة للروابط */
.brand-link[aria-describedby] {
    position: relative;
}

/* تحسينات للوصول */
.brand-link:focus {
    box-shadow: 0 0 0 2px #3a8bbb, 0 0 0 4px rgba(58, 139, 187, 0.3);
}

/* تأثير النقر النشط */
.brand-link:active {
    transform: scale(0.95);
}

/* تحسينات للشعارات ذات الخلفيات البيضاء */
.brand-logo[src*="white"] {
    background: #f8f9fa;
    padding: 3px;
    border-radius: 4px;
}

/* دعم RTL */
.rtl .product-brand-logo-wrapper {
    direction: rtl;
}

.rtl .brand-tooltip {
    left: auto;
    right: 50%;
    transform: translateX(50%) translateY(5px);
}

.rtl .brand-tooltip::after {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

.rtl .brand-tooltip-container:hover .brand-tooltip {
    transform: translateX(50%) translateY(0);
}

/* تحسينات للأرشيف (صفحة العلامة التجارية) */
.tax-product_brand .product-brand-logo-wrapper {
    justify-content: center;
    margin: 5px 0;
}

.tax-product_brand .brand-tooltip-container img.brand-logo {
    max-height: 35px;
    max-width: 90px;
}

/* تأثيرات تحميل سلسة */
.brand-logo {
    opacity: 0;
    animation: brandLogoFadeIn 0.5s ease forwards;
}

@keyframes brandLogoFadeIn {
    to {
        opacity: 1;
    }
}

/* حالة عدم وجود صورة */
.brand-item:not(:has(img)) {
    display: none;
}