/*
 * Chart Centering Stylesheet
 * This file contains aggressive CSS rules to ensure all charts are centered
 * It should be included in all reports
 */

/* Target inline-styled chart containers in ExecutiveSummary.html */
div[style*="margin: 20px 0; padding: 10px; border:"] {
    margin: 20px auto !important;
    text-align: center !important;
    width: 98% !important;
    max-width: 2000px !important;
}

/* Target all chart images - allow true size display for high-resolution rendering */
img[height][width] {
    display: block !important;
    margin: 0 auto !important;
    /* Remove max-width and height constraints to allow true-size display */
    /* Let the explicit width/height attributes control the display size */
}

/* Target links containing chart images */
a[href*="javascript:"] {
    display: block !important;
    text-align: center !important;
}

/* Target direct chart image links */
a[href*="javascript:"] > img {
    display: inline-block !important;
    margin: 0 auto !important;
}

/* Target chart containers */
.chart-container, 
[class*="chart"], 
div[id*="chart"] {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Target paragraphs containing images */
p:has(img) {
    text-align: center !important;
}

/* Legacy chart containers without semantic class names */
div:has(> img[height][width]),
div:has(> a > img[height][width]) {
    text-align: center !important;
}

/* Chart placeholder styling for error handling */
.chart-placeholder {
    padding: 20px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #666;
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto;
    width: 80%;
    max-width: 800px;
    border-radius: 4px;
}

/* Chart wrapper for improved error handling */
.chart-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

/* Chart legend styling */
.chart-legend {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 0 15px 5px 0;
}

.legend-color {
    width: 20px;
    height: 5px;
    margin-right: 5px;
}

/* Line colors for charts */
.max-line { background-color: #ff0000; }
.avg-line { background-color: #0000ff; }
.min-line { background-color: #00cc00; }
.goal-line { background-color: #ff9900; }