/**
 * CRYPTO TICKER STYLES - Animation Binance Style
 * Flash vert/rouge, animations fluides, effets premium
 */

/* ========== ANIMATIONS KEYFRAMES ========== */
@keyframes priceFlashGreen {
    0% {
        background-color: transparent;
        box-shadow: none;
    }
    20% {
        background-color: rgba(16, 185, 129, 0.35);
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

@keyframes priceFlashRed {
    0% {
        background-color: transparent;
        box-shadow: none;
    }
    20% {
        background-color: rgba(239, 68, 68, 0.35);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

@keyframes priceCountUp {
    0% {
        transform: translateY(8px) scale(0.95);
        opacity: 0;
        color: #10b981;
    }
    50% {
        transform: translateY(-2px) scale(1.05);
        color: #10b981;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes priceCountDown {
    0% {
        transform: translateY(-8px) scale(0.95);
        opacity: 0;
        color: #ef4444;
    }
    50% {
        transform: translateY(2px) scale(1.05);
        color: #ef4444;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(240, 185, 11, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(240, 185, 11, 0.6);
    }
}

@keyframes liveDot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

@keyframes numberRoll {
    0% { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ========== PRIX ANIMÉS ========== */
.crypto-price-live {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    display: inline-block;
    min-width: 90px;
    text-align: right;
    transition: color 0.3s ease;
    position: relative;
    border-radius: 6px;
    padding: 2px 6px;
}

.crypto-price-live.flash-up {
    animation: priceFlashGreen 0.6s ease-out;
    color: #10b981 !important;
}

.crypto-price-live.flash-down {
    animation: priceFlashRed 0.6s ease-out;
    color: #ef4444 !important;
}

.crypto-price-live.counting-up {
    animation: priceCountUp 0.4s ease-out;
}

.crypto-price-live.counting-down {
    animation: priceCountDown 0.4s ease-out;
}

/* ========== BADGE LIVE ========== */
.live-indicator-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    color: #10b981;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.live-indicator-badge .live-dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    animation: liveDot 1.5s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* ========== CHANGEMENT DE PRIX ========== */
.price-change-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.price-change-badge.positive {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.price-change-badge.negative {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.price-change-badge .arrow-icon {
    font-size: 0.9em;
    transition: transform 0.3s ease;
}

.price-change-badge.positive .arrow-icon {
    animation: bounceUp 1s ease-in-out infinite;
}

.price-change-badge.negative .arrow-icon {
    animation: bounceDown 1s ease-in-out infinite;
}

@keyframes bounceUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* ========== CARTES CRYPTO ANIMÉES ========== */
.crypto-card-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.crypto-card-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    border-radius: inherit;
    transition: background 0.3s ease;
    pointer-events: none;
}

.crypto-card-animated.flash-up::before {
    animation: priceFlashGreen 0.6s ease-out;
}

.crypto-card-animated.flash-down::before {
    animation: priceFlashRed 0.6s ease-out;
}

.crypto-card-animated:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* ========== TICKER HORIZONTAL ========== */
.crypto-ticker-horizontal {
    display: flex;
    gap: 30px;
    padding: 15px 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.crypto-ticker-horizontal::-webkit-scrollbar {
    display: none;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ticker-item:hover {
    background: rgba(240, 185, 11, 0.1);
    border-color: rgba(240, 185, 11, 0.3);
}

.ticker-item .symbol {
    font-weight: 800;
    font-size: 1rem;
    color: #FCD535;
}

.ticker-item .price {
    font-weight: 700;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.ticker-item .change {
    font-size: 0.85rem;
    font-weight: 600;
}

.ticker-item .change.up {
    color: #10b981;
}

.ticker-item .change.down {
    color: #ef4444;
}

/* ========== GRILLE MARCHÉ AMÉLIORÉE ========== */
.market-card-premium {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.market-card-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.6s ease;
}

.market-card-premium:hover::after {
    left: 100%;
}

.market-card-premium:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color, #F0B90B);
}

.market-card-premium .price-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.market-card-premium .main-price {
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

.market-card-premium .main-price.rising {
    color: #10b981;
}

.market-card-premium .main-price.falling {
    color: #ef4444;
}

/* ========== MINI SPARKLINE ========== */
.mini-sparkline {
    width: 80px;
    height: 30px;
    display: inline-block;
}

.mini-sparkline svg {
    width: 100%;
    height: 100%;
}

.mini-sparkline .line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mini-sparkline.up .line {
    stroke: #10b981;
}

.mini-sparkline.down .line {
    stroke: #ef4444;
}

.mini-sparkline .area {
    opacity: 0.1;
}

.mini-sparkline.up .area {
    fill: #10b981;
}

.mini-sparkline.down .area {
    fill: #ef4444;
}

/* ========== SECTION TOP CRYPTOS PREMIUM ========== */
#top-cryptos .crypto-price-animated {
    font-size: 1.8rem;
    font-weight: 900;
    display: block;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

#top-cryptos .stagger-item {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#top-cryptos .stagger-item:hover {
    transform: translateY(-8px) scale(1.03);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .crypto-price-live {
        min-width: 70px;
        font-size: 0.95rem;
    }

    .price-change-badge {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    .market-card-premium .main-price {
        font-size: 1.2rem;
    }
}

/* ========== MODE SOMBRE ========== */
:root[data-theme="dark"] .market-card-premium {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .market-card-premium:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] .ticker-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ========== RÉDUCTION MOUVEMENT ========== */
@media (prefers-reduced-motion: reduce) {
    .crypto-price-live,
    .crypto-card-animated,
    .price-change-badge,
    .ticker-item,
    .market-card-premium {
        animation: none !important;
        transition: none !important;
    }

    .live-dot {
        animation: none !important;
    }
}
