/* The Charts Dashboard Styles */
:root {
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.wml-the-charts-wrapper {
    width: 100%;
    margin-bottom: 2rem;
    overflow-x: hidden; /* Prevent horizontal scroll on the container */
    
    /* Default variables if not set in sidebar */
    --card-bg: #1e293b;
    --card-text: #f8fafc;
}

/* Dashboard Grid - Bulletproof Variable Based Logic */
.wml-the-charts-wrapper .wml-the-charts-grid {
    display: grid;
    /* Default to 3 columns if the variable is missing */
    grid-template-columns: repeat(var(--wml-grid-cols, 3), 1fr);
    gap: 20px;
}

/* Chart Container Card */
.wml-the-charts-wrapper .wml-the-charts-card {
    background-color: var(--card-bg);
    color: var(--card-text);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    min-width: 0; /* CRITICAL: Allows grid item to shrink below content size */
    overflow: hidden; /* Keep chart inside bounds */
}

.wml-the-charts-wrapper .wml-the-charts-card:hover {
    transform: translateY(-2px);
}

.wml-the-charts-wrapper .chart-container {
    position: relative;
    height: 100%;
    width: 100%;
    min-height: 0; /* Help internal scaling */
}

.wml-the-charts-wrapper canvas {
    display: block;
    max-width: 100% !important;
    width: 100% !important;
}