/* --- 1. Main Container & Layout --- */
.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    flex: 2;
    max-width: 100%;
    min-width: 0; /* Critical: Stops Chart.js from expanding infinitely */
}

.chart-section {
    position: relative;
    height: 350px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

/* Ensure canvas doesn't add inline padding or trigger growth */
canvas {
    display: block !important;
    max-width: 100% !important;
}

/* --- 2. Header & Controls --- */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.chart-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.range-group {
    background: var(--table-header);
    padding: 4px;
    border-radius: 8px;
    display: flex;
    gap: 2px;
}

.range-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.range-btn.active {
    background: var(--card-bg);
    color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* --- 3. Navigator (Timeline Brush) --- */
.navigator-container {
    height: 60px;
    width: 100%;
    margin-top: 15px;
    position: relative;
    background: var(--table-header);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    user-select: none;
}

.navigator-container::before {
    content: "DRAG TO EXPLORE";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    opacity: 0.2;
    letter-spacing: 2px;
    pointer-events: none;
}

/* Interaction fixes for charts */
#chartNavigator, #marketCapChart {
    touch-action: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* --- 4. Responsive Adjustments --- */
@media (max-width: 600px) {
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .chart-section {
        height: 250px;
    }

    .range-group {
        width: 100%;
    }

    .range-btn {
        flex: 1;
        text-align: center;
    }
}



.profile-chart-section {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
    height: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.profile-chart-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    height: 400px;
    margin-bottom: 30px;
}

@media (max-width: 550px) {
    .profile-chart-section {
        height: 280px;
    }
}

.profile-chart-section {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
    height: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.profile-chart-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    height: 400px;
    margin-bottom: 30px;
}

.controls-wrapper {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}


/* Desktop Polish (Tablets and Up) */
@media (min-width: 768px) {
    .controls-wrapper {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 2rem;
    }
}

@media (max-width: 550px) {
    .profile-chart-section {
        height: 280px;
    }
}

