/* Crypto Market Indicators Styles - Fixed Version 2.0 */

/* CSS Variables with better theme detection */
.crypto-indicators-wrapper {
    /* Default Dark Theme Colors */
    --indicator-text-primary: #ffffff;
    --indicator-text-secondary: #8f9bb3;
    --indicator-text-value: #ffffff;
    --indicator-border: rgba(255, 255, 255, 0.1);
    --indicator-hover-bg: rgba(255, 255, 255, 0.03);
    --indicator-hover-border: rgba(255, 255, 255, 0.15);
}

/* Light Theme Detection - Multiple selectors for compatibility */
body.light-mode .crypto-indicators-wrapper,
body[data-theme="light"] .crypto-indicators-wrapper,
body.theme-light .crypto-indicators-wrapper,
body.light-theme .crypto-indicators-wrapper,
html[data-theme="light"] .crypto-indicators-wrapper,
html.light-theme .crypto-indicators-wrapper,
.light-theme .crypto-indicators-wrapper,
.theme-light .crypto-indicators-wrapper,
/* Common WP theme classes */
body.white-background .crypto-indicators-wrapper,
body.bg-white .crypto-indicators-wrapper,
body.background-white .crypto-indicators-wrapper,
body.has-white-background-color .crypto-indicators-wrapper,
/* Elementor */
.elementor-kit-light .crypto-indicators-wrapper,
/* Divi */
.et-white-background .crypto-indicators-wrapper,
/* Astra */
.ast-theme-transparent-header .crypto-indicators-wrapper,
/* GeneratePress */
.generate-theme-light .crypto-indicators-wrapper,
/* JS Applied Classes */
.crypto-indicators-wrapper.theme-light-detected {
    --indicator-text-primary: #1f2937 !important;
    --indicator-text-secondary: #6b7280 !important;
    --indicator-text-value: #111827 !important;
    --indicator-border: rgba(0, 0, 0, 0.15) !important;
    --indicator-hover-bg: rgba(0, 0, 0, 0.05) !important;
    --indicator-hover-border: rgba(0, 0, 0, 0.25) !important;
}

/* Background color detection */
body[style*="background-color: white"] .crypto-indicators-wrapper,
body[style*="background-color:#fff"] .crypto-indicators-wrapper,
body[style*="background-color:#ffffff"] .crypto-indicators-wrapper,
body[style*="background-color: #fff"] .crypto-indicators-wrapper,
body[style*="background-color: #ffffff"] .crypto-indicators-wrapper,
body[style*="background-color: rgb(255"] .crypto-indicators-wrapper,
body[style*="background: white"] .crypto-indicators-wrapper,
body[style*="background:#fff"] .crypto-indicators-wrapper,
body[style*="background:#ffffff"] .crypto-indicators-wrapper,
body[style*="background: #fff"] .crypto-indicators-wrapper,
body[style*="background: #ffffff"] .crypto-indicators-wrapper {
    --indicator-text-primary: #1f2937 !important;
    --indicator-text-secondary: #6b7280 !important;
    --indicator-text-value: #111827 !important;
    --indicator-border: rgba(0, 0, 0, 0.15) !important;
    --indicator-hover-bg: rgba(0, 0, 0, 0.05) !important;
    --indicator-hover-border: rgba(0, 0, 0, 0.25) !important;
}

/* Main container styles */
.crypto-indicators-wrapper {
    width: 100%;
    max-width: 100%;
    background: transparent;
    padding: 30px 0;
    margin: 40px 0 30px 0;
    overflow: hidden;
    border-radius: 0;
}

.crypto-indicators-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 0 30px;
    width: 100%;
}

.indicator-card {
    background: transparent;
    border-radius: 16px;
    padding: 20px 24px;
    width: 100%;
    border: 1px solid var(--indicator-border);
    transition: all 0.3s ease;
    cursor: pointer;
}

.indicator-card:hover {
    background: var(--indicator-hover-bg);
    border-color: var(--indicator-hover-border);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.indicator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* FIXED: Labels now use same color as values */
.crypto-indicators-wrapper .indicator-label {
    font-size: 13px;
    color: var(--indicator-text-value) !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crypto-indicators-wrapper .indicator-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--indicator-text-value) !important;
    margin-bottom: 8px;
    line-height: 1;
}

.indicator-change {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.indicator-change.positive {
    color: #16c784 !important;
}

.indicator-change.negative {
    color: #ea3943 !important;
}

.indicator-chart {
    height: 50px;
    margin-top: 12px;
    position: relative;
    overflow: hidden;
}

.indicator-chart svg {
    width: 100%;
    height: 100%;
}

.indicator-chart .chart-line {
    fill: none;
    stroke: #16c784;
    stroke-width: 2;
    stroke-linecap: round;
}

.indicator-chart .chart-area {
    fill: url(#chartGradient);
    opacity: 0.3;
}

/* Fear & Greed Gauge */
.fear-greed-gauge {
    position: relative;
    height: 80px;
    margin: 10px 0;
}

.gauge-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(90deg, 
        #ea3943 0%,
        #f6ad55 25%,
        #ffd700 50%,
        #a3d977 75%,
        #16c784 100%
    );
    border-radius: 6px;
}

.gauge-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    transition: width 1s ease;
}

.gauge-value {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: 700;
    color: var(--indicator-text-value) !important;
}

.indicator-status {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    text-transform: capitalize;
}

/* Altseason Meter */
.altseason-meter {
    padding: 10px 0;
}

.meter-value {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--indicator-text-value) !important;
    margin-bottom: 12px;
}

.meter-bar {
    height: 10px;
    background: linear-gradient(90deg, 
        #f7931a 0%,
        rgba(100, 116, 139, 0.3) 50%,
        #627eea 100%
    );
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    margin-bottom: 10px;
}

.meter-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    transition: width 1s ease;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--indicator-text-secondary) !important;
    font-weight: 600;
}

.meter-labels span {
    color: var(--indicator-text-secondary) !important;
}

/* Scrollbar Styling */
.crypto-indicators-wrapper::-webkit-scrollbar {
    height: 6px;
}

.crypto-indicators-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.crypto-indicators-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.crypto-indicators-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 1200px) {
    .crypto-indicators-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .crypto-indicators-wrapper {
        padding: 20px 0;
    }
    
    .crypto-indicators-container {
        grid-template-columns: 1fr;
        padding: 0 15px;
        gap: 15px;
    }
    
    .indicator-card {
        width: 100%;
    }
    
    .indicator-value {
        font-size: 20px;
    }
    
    .indicator-chart {
        height: 40px;
    }
}

@media (max-width: 480px) {
    .crypto-indicators-container {
        padding: 0 10px;
    }
    
    .indicator-value {
        font-size: 18px;
    }
}

/* Loading Animation */
.indicator-value.loading,
.indicator-change.loading {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    color: transparent !important;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* REMOVED the problematic override section that was forcing all text to use text-value color */

/* Forced Theme Classes */
.crypto-indicators-wrapper.force-light {
    --indicator-text-primary: #1f2937 !important;
    --indicator-text-secondary: #6b7280 !important;
    --indicator-text-value: #111827 !important;
    --indicator-border: rgba(0, 0, 0, 0.15) !important;
    --indicator-hover-bg: rgba(0, 0, 0, 0.05) !important;
    --indicator-hover-border: rgba(0, 0, 0, 0.25) !important;
}

.crypto-indicators-wrapper.force-dark {
    --indicator-text-primary: #ffffff !important;
    --indicator-text-secondary: #8f9bb3 !important;
    --indicator-text-value: #ffffff !important;
    --indicator-border: rgba(255, 255, 255, 0.1) !important;
    --indicator-hover-bg: rgba(255, 255, 255, 0.03) !important;
    --indicator-hover-border: rgba(255, 255, 255, 0.15) !important;
}

/* Ensure dark theme detected by JS gets white text */
.crypto-indicators-wrapper.theme-dark-detected .indicator-label,
.crypto-indicators-wrapper.theme-dark-detected .indicator-value,
.crypto-indicators-wrapper.theme-dark-detected .gauge-value,
.crypto-indicators-wrapper.theme-dark-detected .meter-value {
    color: #ffffff !important;
}

/* Ensure light theme detected by JS gets dark text */
.crypto-indicators-wrapper.theme-light-detected .indicator-label,
.crypto-indicators-wrapper.theme-light-detected .indicator-value,
.crypto-indicators-wrapper.theme-light-detected .gauge-value,
.crypto-indicators-wrapper.theme-light-detected .meter-value {
    color: #111827 !important;
}

/* Media query for system color scheme */
@media (prefers-color-scheme: light) {
    .crypto-indicators-wrapper:not(.force-dark) {
        --indicator-text-primary: #1f2937 !important;
        --indicator-text-secondary: #6b7280 !important;
        --indicator-text-value: #111827 !important;
        --indicator-border: rgba(0, 0, 0, 0.15) !important;
        --indicator-hover-bg: rgba(0, 0, 0, 0.05) !important;
        --indicator-hover-border: rgba(0, 0, 0, 0.25) !important;
    }
}