/* ================================
   LIVE PRICE TICKER
   ================================ */

.price-ticker-wrapper {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 2px solid var(--color-primary);
    position: sticky;
    top: 72px;
    z-index: 999;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.price-ticker-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 12px 0;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch; /* للتمرير السلس على الموبايل */
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) rgba(255, 255, 255, 0.1);
}

.price-ticker-container:active {
    cursor: grabbing;
}

/* تخصيص شريط التمرير */
.price-ticker-container::-webkit-scrollbar {
    height: 4px;
}

.price-ticker-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.price-ticker-container::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 2px;
}

.price-ticker-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary);
}

.price-ticker {
    display: flex;
    align-items: center;
    gap: 40px;
    animation: scroll 40s linear infinite;
    white-space: nowrap;
    will-change: transform;
}

/* إيقاف التمرير عند التفاعل مع الشريط */
.price-ticker-wrapper:hover .price-ticker,
.price-ticker-container.dragging .price-ticker {
    animation-play-state: paused;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.ticker-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 197, 142, 0.2);
}

.ticker-icon {
    font-size: 1.5rem;
    min-width: 30px;
    text-align: center;
}

.ticker-icon.gold {
    color: #FFD700;
}

.ticker-icon.forex {
    color: #00C58E;
}

.ticker-icon.crypto {
    color: #F7931A;
}

.ticker-icon.oil {
    color: #8B4513;
}

.ticker-icon.stock {
    color: #4A90E2;
}

.ticker-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ticker-symbol {
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.ticker-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.ticker-change {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ticker-change.positive {
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
}

.ticker-change.negative {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.ticker-change i {
    font-size: 0.75rem;
}

/* Animation للتمرير */
@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Loading State */
.ticker-item.loading {
    opacity: 0.5;
    pointer-events: none;
}

.ticker-item.loading .ticker-price::after {
    content: '...';
    animation: loading 1.5s infinite;
}

/* Live Indicator */
.ticker-item.live-indicator {
    background: rgba(0, 255, 0, 0.05);
    border-color: rgba(0, 255, 0, 0.3);
    animation: pulse-live 2s ease-in-out infinite;
}

.ticker-item.live-indicator .ticker-icon {
    animation: blink-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
    }
}

@keyframes blink-live {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes loading {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Dark Mode Support */
body.dark-mode .price-ticker-wrapper {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    border-bottom-color: var(--color-primary);
}

body.dark-mode .ticker-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .ticker-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .price-ticker-wrapper {
        top: 65px;
    }
    
    .price-ticker-container {
        padding: 10px 0;
    }
    
    .ticker-item {
        gap: 8px;
        padding: 6px 12px;
    }
    
    .ticker-icon {
        font-size: 1.2rem;
        min-width: 25px;
    }
    
    .ticker-symbol {
        font-size: 0.85rem;
    }
    
    .ticker-price {
        font-size: 0.95rem;
    }
    
    .ticker-change {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    .price-ticker-wrapper {
        top: 60px;
    }
    
    .ticker-item {
        padding: 5px 10px;
        gap: 6px;
    }
    
    .ticker-content {
        gap: 1px;
    }
    
    .ticker-symbol {
        font-size: 0.8rem;
    }
    
    .ticker-price {
        font-size: 0.9rem;
    }
}

/* Pulse animation for price updates */
@keyframes priceUpdate {
    0% {
        background: rgba(0, 197, 142, 0.3);
    }
    100% {
        background: rgba(255, 255, 255, 0.05);
    }
}

.ticker-item.price-updated {
    animation: priceUpdate 0.5s ease;
}
