:root {
    --aqi-green: #09a94b;
    --aqi-red: #ef4444;
    --aqi-blue: #3b82f6;
    --aqi-header-bg: rgba(0, 4, 12, 0.7);
    --aqi-header-text: #e0e6ed;
    --aqi-header-muted: #9fafc6;
    --aqi-header-border: rgba(255, 255, 255, 0.1);
    --aqi-header-card-bg: linear-gradient(180deg, #272f3b, #0d1117);
    --aqi-header-card-border: rgba(255, 255, 255, 0.1);
    --aqi-header-subbar-bg: #02060b;
}

body {
    background-color: var(--aqi-bg);
    color: var(--aqi-header-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root[data-theme="light"] {
    --aqi-header-bg: rgba(255, 255, 255, 0.88);
    --aqi-header-text: #0f172a;
    --aqi-header-muted: #475569;
    --aqi-header-border: rgba(15, 23, 42, 0.12);
    --aqi-header-card-bg: linear-gradient(180deg, #ffffff, #edf4fb);
    --aqi-header-card-border: rgba(15, 23, 42, 0.14);
    --aqi-header-subbar-bg: #f3f8ff;
}

/* --- 1. FIXED HEADER GROUP (Nav + Eco Ticker) --- */
.fixed-header-group {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

/* --- 2. APP NAVIGATION BAR --- */
.app-nav {
    background: var(--aqi-header-bg);
    border-bottom: 1px solid var(--aqi-header-border);
    height: 80px;
    position: relative;
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
}

/* Center Logo (Locked in Place) */
.nav-center-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 102;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
}

/* --- 3. UNIFIED TICKER ANIMATION LOGIC --- */
@keyframes scrollIndices {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.ticker-wrapper,
.eco-ticker-wrapper {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.ticker-content,
.eco-ticker-content {
    display: inline-flex;
    align-items: center;
    width: max-content;
}

.ticker-content {
    animation: scrollIndices 40s linear infinite;
    animation-play-state: paused;
}

.eco-ticker-content {
    animation: scrollIndices 500s linear infinite;
    animation-play-state: paused;
}

.ticker-wrapper:hover .ticker-content,
.eco-ticker-wrapper:hover .eco-ticker-content {
    animation-play-state: running;
}

/* --- 4. LEFT TICKER (Gainers/Losers) --- */
.left-ticker {
    flex: 1;
    margin-right: 40px;
    mask-image: linear-gradient(to right, black 85%, transparent);
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    padding: 0 15px;
    border-right: 1px solid var(--aqi-header-border);
    height: 30px;
}

.ticker-label {
    font-weight: 900;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
    margin-right: 8px;
    text-transform: uppercase;
}

.label-gainers {
    color: var(--aqi-green);
}

.label-losers {
    color: var(--aqi-red);
}

.ticker-symbol {
    color: var(--aqi-header-text);
    font-weight: 700;
    font-size: 0.85rem;
    margin-right: 5px;
}

.ticker-price {
    color: var(--aqi-header-muted);
    font-size: 0.8rem;
}

.ticker-change {
    font-size: 0.8rem;
    margin-left: 4px;
    font-weight: 700;
}

/* --- 5. RIGHT TICKER (Indices) --- */
.right-ticker {
    flex: 1;
    margin-left: 40px;
    mask-image: linear-gradient(to left, black 85%, transparent);
}

.index-card {
    background: var(--aqi-header-card-bg);
    border: 1px solid var(--aqi-header-card-border);
    border-radius: 6px;
    padding: 6px 12px;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    margin: 0 8px;
    transition: border-color 0.3s;
}

.index-card:hover {
    border-color: var(--aqi-blue);
}

.idx-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
}

.idx-name {
    color: var(--aqi-blue);
    text-transform: uppercase;
    display: flex;
    gap: 4px;
}

.idx-bottom {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 2px;
}

.idx-price {
    color: var(--aqi-header-text);
    font-size: 1rem;
    font-weight: 900;
    font-family: monospace;
}

.idx-points {
    color: var(--aqi-header-muted);
    font-size: 0.75rem;
}

/* --- 6. ECONOMIC TICKER BAR (Bottom) --- */
.eco-ticker-bar {
    height: 32px;
    background: var(--aqi-header-subbar-bg);
    display: flex;
    align-items: center;
}

.eco-label {
    background: var(--aqi-green);
    color: black;
    font-weight: 900;
    font-size: 0.65rem;
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    letter-spacing: 1px;
    z-index: 5;
    flex-shrink: 0;
}

.eco-ticker-wrapper {
    flex: 1;
    height: 100%;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.eco-item {
    display: inline-flex;
    align-items: center;
    padding: 0 25px;
    font-size: 0.75rem;
    font-family: 'Segoe UI', sans-serif;
}

.eco-flag {
    font-size: 1rem;
    margin-right: 8px;
}

.eco-time {
    color: var(--aqi-header-muted);
    font-weight: 700;
    margin-right: 10px;
}

.eco-name {
    color: var(--aqi-header-text);
    font-weight: 600;
    margin-right: 8px;
}

.eco-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 8px;
}

/* --- 7. RESPONSIVE & UTILS --- */
.text-green {
    color: var(--aqi-green) !important;
}

.text-red {
    color: var(--aqi-red) !important;
}

@media (max-width: 768px) {
    .app-nav {
        height: 70px;
    }

    .index-card {
        min-width: 160px;
    }

    .ticker-label {
        font-size: 0.7rem;
    }
}
