/**
 * Product Ticker Styles
 * دعم RTL والحركة السلسة
 */

/* الحاوي الرئيسي */
.product-ticker-container {
    width: 100%;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border: 2px solid #3498db;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin: 20px 0;
    min-height: 60px;
}

/* الغلاف الداخلي */
.product-ticker-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* المحتوى المتحرك */
.product-ticker-content {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-fill-mode: forwards;
    will-change: transform;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    padding: 15px 0;
}

/* عنصر المنتج */
.product-ticker-item {
    display: inline-flex;
    align-items: center;
    margin: 0 30px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.product-ticker-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* صورة المنتج */
.product-ticker-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3498db;
    margin-left: 10px;
    transition: transform 0.3s ease;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease;
}

.product-ticker-image.loaded {
    opacity: 1;
}

.product-ticker-item:hover .product-ticker-image {
    transform: scale(1.1);
}

/* اسم المنتج */
.product-ticker-title {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin: 0 10px;
    transition: color 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.product-ticker-title:hover {
    color: #3498db;
    text-decoration: none;
}

/* سعر المنتج */
.product-ticker-price {
    color: #f39c12;
    font-weight: bold;
    font-size: 13px;
    background: rgba(243, 156, 18, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    margin-right: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* الحركة للاتجاه العادي (LTR) */
.product-ticker-container.ltr .product-ticker-content {
    animation-name: tickerLTR;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

@keyframes tickerLTR {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* الحركة للاتجاه المعكوس (RTL) */
.product-ticker-container.rtl .product-ticker-content {
    animation-name: tickerRTL;
    direction: rtl;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

.product-ticker-container.rtl .product-ticker-image {
    margin-right: 10px;
    margin-left: 0;
}

.product-ticker-container.rtl .product-ticker-price {
    margin-left: 10px;
    margin-right: 0;
}

@keyframes tickerRTL {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(50%);
    }
}

/* سرعات مختلفة */
.product-ticker-container.speed-slow .product-ticker-content {
    animation-duration: 80s;
}

.product-ticker-container.speed-normal .product-ticker-content {
    animation-duration: 50s;
}

.product-ticker-container.speed-fast .product-ticker-content {
    animation-duration: 30s;
}

/* تأثيرات إضافية */
.product-ticker-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(44, 62, 80, 0.8) 0%, 
        transparent 10%, 
        transparent 90%, 
        rgba(44, 62, 80, 0.8) 100%);
    pointer-events: none;
    z-index: 1;
}

/* إيقاف الحركة عند التمرير */
.product-ticker-container:hover .product-ticker-content {
    animation-play-state: paused;
}

/* تصميم متجاوب */
@media (max-width: 768px) {
    .product-ticker-item {
        margin: 0 15px;
        padding: 6px 12px;
    }
    
    .product-ticker-image {
        width: 30px;
        height: 30px;
    }
    
    .product-ticker-title {
        font-size: 12px;
        margin: 0 8px;
    }
    
    .product-ticker-price {
        font-size: 11px;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
    .product-ticker-container {
        min-height: 50px;
    }
    
    .product-ticker-content {
        padding: 10px 0;
    }
    
    .product-ticker-item {
        margin: 0 10px;
        padding: 4px 8px;
    }
    
    .product-ticker-image {
        width: 25px;
        height: 25px;
    }
    
    .product-ticker-title {
        font-size: 11px;
        margin: 0 5px;
    }
    
    .product-ticker-price {
        font-size: 10px;
        padding: 2px 4px;
    }
}

/* تحسينات للطباعة */
@media print {
    .product-ticker-container {
        display: none;
    }
}

/* تحسينات الوصولية */
.product-ticker-container:focus-within .product-ticker-content {
    animation-play-state: paused;
}

.product-ticker-title:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* مؤشر التحميل */
.product-ticker-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    color: #ecf0f1;
    font-size: 14px;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.product-ticker-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.product-ticker-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(236, 240, 241, 0.3);
    border-top: 2px solid #ecf0f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* تحسينات الأداء */
.product-ticker-content {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

.product-ticker-item {
    will-change: transform;
    backface-visibility: hidden;
}