/**
 * InvestlyToday Stock Ticker Styles
 * 
 * A sleek, financial-grade scrolling ticker that matches
 * the InvestlyToday brand aesthetic.
 */

/* ============================================
   CSS Custom Properties (Theme Variables)
   ============================================ */
:root {
    --investly-ticker-bg-dark: rgba(15, 20, 25, 0.95);
    --investly-ticker-bg-light: rgba(248, 250, 252, 0.98);
    --investly-ticker-text-dark: #e8eaed;
    --investly-ticker-text-light: #1e2a3a;
    --investly-ticker-green: #00e676;
    --investly-ticker-green-glow: rgba(0, 230, 118, 0.6);
    --investly-ticker-red: #ff5252;
    --investly-ticker-red-glow: rgba(255, 82, 82, 0.6);
    --investly-ticker-muted-dark: rgba(255, 255, 255, 0.5);
    --investly-ticker-muted-light: rgba(0, 0, 0, 0.5);
    --investly-ticker-height: 36px;
    --investly-ticker-font: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ============================================
   Base Ticker Wrapper
   ============================================ */
.investly-ticker-wrapper {
    width: 100%;
    max-width: 100%;
    height: var(--investly-ticker-height);
    overflow: hidden;
    position: relative;
    font-family: var(--investly-ticker-font);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: var(--investly-ticker-height);
    user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
}

/* Dark Theme (Default) */
.investly-ticker--dark {
    background: var(--investly-ticker-bg-dark);
    color: var(--investly-ticker-text-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Light Theme */
.investly-ticker--light {
    background: var(--investly-ticker-bg-light);
    color: var(--investly-ticker-text-light);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* ============================================
   Ticker Track (Scrolling Container)
   ============================================ */
.investly-ticker-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.investly-ticker-content {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: investly-scroll var(--ticker-speed, 30s) linear infinite;
    will-change: transform;
}

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

/* ============================================
   Scroll Animation
   ============================================ */
@keyframes investly-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ============================================
   Individual Stock Item
   ============================================ */
.investly-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 24px;
    height: var(--investly-ticker-height);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: background-color 0.2s ease;
}

.investly-ticker--light .investly-ticker-item {
    border-right-color: rgba(0, 0, 0, 0.06);
}

.investly-ticker-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.investly-ticker--light .investly-ticker-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* ============================================
   Status Indicator (Green/Red Dot)
   ============================================ */
.investly-ticker-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.investly-ticker-indicator.investly-ticker-up {
    background: var(--investly-ticker-green);
    box-shadow: 0 0 8px var(--investly-ticker-green-glow),
                0 0 16px var(--investly-ticker-green-glow);
    animation: pulse-green 2s ease-in-out infinite;
}

.investly-ticker-indicator.investly-ticker-down {
    background: var(--investly-ticker-red);
    box-shadow: 0 0 8px var(--investly-ticker-red-glow),
                0 0 16px var(--investly-ticker-red-glow);
    animation: pulse-red 2s ease-in-out infinite;
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 8px var(--investly-ticker-green-glow),
                    0 0 16px var(--investly-ticker-green-glow);
    }
    50% {
        box-shadow: 0 0 12px var(--investly-ticker-green-glow),
                    0 0 24px var(--investly-ticker-green-glow);
    }
}

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 8px var(--investly-ticker-red-glow),
                    0 0 16px var(--investly-ticker-red-glow);
    }
    50% {
        box-shadow: 0 0 12px var(--investly-ticker-red-glow),
                    0 0 24px var(--investly-ticker-red-glow);
    }
}

/* ============================================
   Stock Symbol
   ============================================ */
.investly-ticker-symbol {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.investly-ticker--dark .investly-ticker-symbol {
    color: #ffffff;
}

.investly-ticker--light .investly-ticker-symbol {
    color: #1e2a3a;
}

/* ============================================
   Stock Price
   ============================================ */
.investly-ticker-price {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.investly-ticker--dark .investly-ticker-price {
    color: rgba(255, 255, 255, 0.85);
}

.investly-ticker--light .investly-ticker-price {
    color: rgba(30, 42, 58, 0.85);
}

/* ============================================
   Change Percentage
   ============================================ */
.investly-ticker-change {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.investly-ticker-change.investly-ticker-up {
    color: var(--investly-ticker-green);
    background: rgba(0, 230, 118, 0.12);
}

.investly-ticker-change.investly-ticker-down {
    color: var(--investly-ticker-red);
    background: rgba(255, 82, 82, 0.12);
}

/* ============================================
   Loading State
   ============================================ */
.investly-ticker-loading {
    padding: 0 20px;
    color: var(--investly-ticker-muted-dark);
    font-style: italic;
    animation: loading-pulse 1.5s ease-in-out infinite;
}

.investly-ticker--light .investly-ticker-loading {
    color: var(--investly-ticker-muted-light);
}

@keyframes loading-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ============================================
   Error State
   ============================================ */
.investly-ticker-error {
    padding: 0 20px;
    color: var(--investly-ticker-red);
    font-size: 11px;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    :root {
        --investly-ticker-height: 32px;
    }
    
    .investly-ticker-wrapper {
        font-size: 11px;
    }
    
    .investly-ticker-item {
        padding: 0 16px;
        gap: 5px;
    }
    
    .investly-ticker-indicator {
        width: 6px;
        height: 6px;
    }
    
    .investly-ticker-change {
        font-size: 10px;
        padding: 1px 4px;
    }
}

@media (max-width: 480px) {
    :root {
        --investly-ticker-height: 28px;
    }
    
    .investly-ticker-wrapper {
        font-size: 10px;
    }
    
    .investly-ticker-item {
        padding: 0 12px;
        gap: 4px;
    }
}

/* ============================================
   Breakdance / WordPress Compatibility
   ============================================ */

/* Reset any inherited styles */
.investly-ticker-wrapper *,
.investly-ticker-wrapper *::before,
.investly-ticker-wrapper *::after {
    box-sizing: border-box;
}

/* Inherit parent width - you control sizing in the editor */
.investly-ticker-wrapper {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Remove default link styling if ticker items become links */
.investly-ticker-item a {
    color: inherit;
    text-decoration: none;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .investly-ticker-wrapper {
        display: none;
    }
}
