/**
 * Currency Ticker Styles
 * Includes RTL support, animations, and responsive design
 */

/* ==========================================================================
   Ticker Wrapper
   ========================================================================== */

/* Custom JS scroll - simple structure */
.currency-ticker-wrapper {
    width: 100%;
    background: #000000;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    z-index: 99;
    height: 40px;
    display: flex;
    align-items: center;
    direction: ltr; /* Force LTR so content flows left-to-right */
}

.currency-ticker-track {
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
}

.ticker-content {
    display: inline-flex;
    white-space: nowrap;
    animation: scroll-ticker 50s linear infinite;
    will-change: transform;
    direction: ltr;
}

/* Pause animation on hover */
.currency-ticker-wrapper:hover .ticker-content {
    animation-play-state: paused;
}

/* Drag cursor */
.currency-ticker-wrapper {
    cursor: grab;
    user-select: none;
}

.currency-ticker-wrapper:active {
    cursor: grabbing;
}

/* 
 * 4 identical copies = each copy is 25% of total width.
 * Animate from 0% to -25% (shift by 1 copy).
 * At -25%, we see copy 2 which looks identical to copy 1 at 0%.
 * Loop is seamless. Duration 30s for smooth scroll.
 */
@keyframes scroll-ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-25%);
    }
}

/* ==========================================================================
   Ticker Content
   ========================================================================== */


.ticker-item {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    padding: 0 2rem;
    border-right: 1px solid #333333;
}

.ticker-item:first-child {
    border-right: none;
}

.ticker-code {
    opacity: 0.6;
    font-size: 12px;
    margin-right: 4px;
}



.ticker-item:last-child::after {
    content: none;
}

/* Currency-specific colors - all white */
.ticker-gold {
    color: #ffffff;
}

.ticker-usd {
    color: #ffffff;
}

.ticker-eur {
    color: #ffffff;
}

.ticker-gbp {
    color: #ffffff;
}

/* ==========================================================================
   Trend Arrows
   ========================================================================== */

.trend-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    margin-right: 0.25rem;
    line-height: 1;
}

.trend-up {
    color: #00ff88;
}

.trend-down {
    color: #ff4757;
}

.trend-neutral {
    color: #ffffff;
}

/* ==========================================================================
   Error State
   ========================================================================== */

.currency-ticker-error {
    background: #2a2a3e;
}

.currency-ticker-message {
    width: 100%;
    text-align: center;
    color: #ff4757;
    font-size: 14px;
    padding: 0 1rem;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablets */
@media screen and (max-width: 768px) {
    .currency-ticker-wrapper {
        height: 50px;
    }
    
    .ticker-item {
        font-size: 16px;
        padding: 0 1.5rem;
    }
    
    .currency-ticker-track {
        animation-duration: 42s;
    }
}

/* Mobile */
@media screen and (max-width: 480px) {
    .currency-ticker-wrapper {
        height: 45px;
    }
    
    .ticker-item {
        font-size: 14px;
        padding: 0 1.25rem;
    }
    
    .trend-arrow {
        font-size: 14px;
    }
    
    .currency-ticker-track {
        animation-duration: 33s;
    }
    
    /* Disable hover pause on mobile */
    .currency-ticker-wrapper:hover .currency-ticker-track {
        animation-play-state: running;
    }
}

/* Very small mobile */
@media screen and (max-width: 375px) {
    .currency-ticker-track {
        animation-duration: 31s;
    }
    
    .ticker-item {
        font-size: 13px;
        padding: 0 1rem;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .currency-ticker-track {
        animation: none;
    }
    
    .currency-ticker-track {
        overflow-x: auto;
        scroll-behavior: smooth;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .currency-ticker-wrapper {
        background: #000;
        border-bottom: 2px solid #fff;
    }
    
    .ticker-item {
        color: #fff;
    }
    
    .trend-up {
        color: #0f0;
    }
    
    .trend-down {
        color: #f00;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .currency-ticker-wrapper {
        display: none;
    }
}

/* ==========================================================================
   RTL Support Enhancements
   ========================================================================== */

[dir="ltr"] .ticker-item {
    border-right: none;
    border-left: 1px solid #4a4a5e;
}

[dir="ltr"] .ticker-item:first-child {
    border-left: none;
}

[dir="ltr"] .ticker-item::after {
    margin-right: 1rem;
    margin-left: -0.5rem;
}

[dir="ltr"] .trend-arrow {
    margin-right: 0;
    margin-left: 0.25rem;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.currency-ticker-wrapper.loading .currency-ticker-track {
    opacity: 0.5;
}

.currency-ticker-wrapper.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

