/* ===== Section 03: Market Intelligence - COMPLETE FIX ===== */
.market-intelligence {
    background: var(--bg-darker);
    padding: 10px 10px;
    border-radius: 8px;
    margin-bottom: 50px;
    border: 1px solid var(--border-color);
}

.mi-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.mi-header span { 
    font-size: 0.7rem; 
    color: var(--text-grey); 
    letter-spacing: 2px;
    font-weight: 600;
}

.mi-header .last-updated {
    display: block;
    font-size: 0.65rem;
    color: var(--text-grey);
    opacity: 0.7;
    margin-top: 5px;
}

.refresh-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-grey);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Horizontal Slider ===== */
.ticker-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ticker-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 5px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    flex: 1;
    min-width: 0;
}

.ticker-container::-webkit-scrollbar {
    height: 4px;
}

.ticker-container::-webkit-scrollbar-track {
    background: transparent;
}

.ticker-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.ticker-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue);
}

/* Slider Arrows */
.slider-arrow {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-grey);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s;
    flex-shrink: 0;
    z-index: 2;
}

.slider-arrow:hover:not(:disabled) {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    transform: scale(1.05);
}

.slider-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Ticker Card */
.ticker-item {
    min-width: 180px;
    max-width: 180px;
    padding: 12px 14px;
    background: rgba(17, 26, 43, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    cursor: pointer;
}

.ticker-item:hover {
    border-color: var(--primary-blue);
    background: rgba(17, 26, 43, 0.9);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.ticker-info {
    flex: 1;
    min-width: 0;
}

.ticker-label {
    font-size: 0.65rem;
    color: var(--text-grey);
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ticker-unit {
    font-size: 0.55rem;
    opacity: 0.65;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.ticker-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ticker-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.5px;
    line-height: 1;
}

.ticker-change {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ticker-change.up {
    color: var(--success);
}

.ticker-change.down {
    color: var(--danger);
}

.ticker-change i {
    font-size: 0.65rem;
}

/* Graph on RIGHT side */
.ticker-graph-wrapper {
    flex-shrink: 0;
    width: 65px;
    height: 30px;
    display: flex;
    align-items: center;
}

.ticker-graph {
    width: 100%;
    height: 100%;
}

/* Badges */
.fallback-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.52rem;
    color: var(--accent-gold);
    opacity: 0.9;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.12);
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Live from API — green */
.fallback-badge.live {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
}

/* Estimated daily price — amber */
.fallback-badge.est {
    color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.12);
}


/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: var(--text-grey);
    text-align: center;
    min-height: 120px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state .api-note {
    margin-top: 12px;
    font-size: 0.68rem;
    opacity: 0.7;
    max-width: 200px;
}

/* API Status Bar */
.api-status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-grey);
}

.status-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-grey);
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: var(--success);
    animation: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-indicator.error {
    background: var(--danger);
    animation: none;
}

.status-indicator.warning {
    background: var(--accent-gold);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.api-key-status {
    margin-left: auto;
    font-size: 0.68rem;
    opacity: 0.8;
}

/* Error State */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--danger);
    text-align: center;
    min-height: 120px;
}

.error-state i {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.8;
}

.error-state .retry-btn {
    margin-top: 15px;
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.error-state .retry-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 1200px) {
    .ticker-item {
        min-width: 220px;
        max-width: 220px;
    }
    
    .ticker-graph-wrapper {
        width: 90px;
        height: 38px;
    }
    
    .ticker-price {
        font-size: 1.45rem;
    }
}

@media (max-width: 768px) {
    .mi-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .ticker-container {
        gap: 12px;
    }
    
    .ticker-item {
        min-width: 200px;
        max-width: 200px;
        padding: 15px 18px;
    }
    
    .ticker-graph-wrapper {
        width: 80px;
        height: 34px;
    }
    
    .ticker-price {
        font-size: 1.35rem;
    }
    
    .slider-arrow {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .ticker-item {
        min-width: 180px;
        max-width: 180px;
        padding: 14px 16px;
    }
    
    .ticker-graph-wrapper {
        width: 70px;
        height: 30px;
    }
    
    .ticker-price {
        font-size: 1.25rem;
    }
    
    .ticker-change {
        font-size: 0.8rem;
    }
}