/* ========================================
   Chart Styles - Premium Theme Integration
   ======================================== */

/* Chart Section Container */
.chart-section {
    padding: var(--space-xl, 40px) var(--space-md, 16px);
    background: var(--color-bg, #f5f5f5);
}

.chart-section-title {
    color: var(--color-primary, #0a1942);
    font-family: var(--font-heading, 'Cormorant Garamond', serif);
    font-size: clamp(24px, 4vw, 44px);
    font-weight: 700;
    text-align: center;
    margin-bottom: clamp(20px, 4vw, 40px);
    position: relative;
}

.chart-section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent, #d4af37), var(--color-accent-light, #e8c547));
    margin: var(--space-md, 16px) auto 0;
    border-radius: 2px;
}

/* Chart Wrapper */
#chart-wrapper {
    flex: 1;
    position: relative;
    background: var(--color-bg-card, #ffffff);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-md, 0 4px 15px rgba(0, 0, 0, 0.15));
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}

/* Gold accent top border - disabled */
#chart-wrapper::before {
    display: none;
}

@media (min-width: 768px) {
    #chart-wrapper {
        height: 500px;
    }
}

@media (min-width: 1024px) {
    #chart-wrapper {
        height: 600px;
    }
}

#chart-container {
    width: 100%;
    height: 100%;
    min-height: 300px;
}

/* Legend - Premium Styling */
#legend {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 20;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: var(--color-text, #333);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 16px;
    border-radius: var(--radius-md, 8px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-sm, 0 2px 10px rgba(0, 0, 0, 0.1));
}

.legend-label {
    font-weight: bold;
    color: var(--color-text-light, #666);
    margin-left: 8px;
}

.legend-value {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Hide TradingView attribution */
#chart-container a {
    display: none !important;
}

/* Loading Spinner Overlay */
#chart-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-family: var(--font-body, 'Montserrat', sans-serif);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#chart-spinner::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

#chart-spinner.visible {
    display: block;
}

/* Loading State */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--color-text-light, #666);
    font-family: var(--font-body, 'Montserrat', sans-serif);
}

.chart-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--color-accent, #d4af37);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #chart-wrapper {
        background: var(--color-bg-card, #161b22);
        border-color: rgba(212, 175, 55, 0.15);
    }

    #legend {
        background: rgba(22, 27, 34, 0.95);
        color: var(--color-text, #e6edf3);
        border-color: rgba(212, 175, 55, 0.2);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #legend {
        top: 8px;
        left: 8px;
        font-size: 11px;
        padding: 6px 10px;
    }

    #chart-wrapper {
        border-radius: 0;
        margin: 0 -16px;
        width: calc(100% + 32px);
    }
}