/* Charting Styles */
.charting-container {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.charting-admin-content {
    max-width: 1200px;
    margin: 20px 0;
    font-size: 15px;
    line-height: 1.5;
}

.charting-admin-content h2 {
    margin: 30px 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e5e5;
    color: #23282d;
}

.charting-admin-content h3 {
    margin: 25px 0 15px;
    color: #23282d;
}

.charting-admin-content h4 {
    margin: 20px 0 10px;
    color: #23282d;
}

.charting-example {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.charting-example code {
    display: inline-block;
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-size: 13px;
}

.charting-example pre {
    padding: 15px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
    margin: 10px 0;
}

.charting-example ul {
    margin: 15px 0;
    padding-left: 20px;
}

.charting-example li {
    margin: 8px 0;
}

.charting-example li strong {
    color: #23282d;
}

.charting-live-examples {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 30px;
    margin: 20px 0;
}

.charting-live-examples h3 {
    margin-top: 0;
}

.charting-live-examples > div {
    margin: 30px 0;
}

.charting-live-examples > div:first-child {
    margin-top: 15px;
}

.charting-live-examples > div:last-child {
    margin-bottom: 0;
}

.chart {
    max-width: 100%;
    height: auto;
}

/* Donut Chart Styles */
.charting-donut-chart {
    display: inline-block;
    vertical-align: middle;
    margin: 10px;
    /* Make charts responsive by default */
    width: 100%;
    max-width: 200px;
    height: auto;
    aspect-ratio: 5/6; /* Maintain the 100/120 aspect ratio */
}

/* Responsive scaling for different screen sizes */
@media (max-width: 768px) {
    .charting-donut-chart {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .charting-donut-chart {
        max-width: 120px;
    }
}

/* Container-based scaling - charts will scale with their container */
.charting-donut-chart.responsive {
    width: 100%;
    max-width: none;
    height: auto;
}

/* Ensure SVG scales properly within the container */
.charting-donut-chart svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Initial state for donut */
.charting-donut-chart .donut-circles circle:nth-child(2) {
    stroke-dasharray: 0 251.33; /* 2 * PI * 40 (radius) */
    transition: stroke-dasharray 1s ease-in-out;
}

/* Animation state */
.charting-donut-chart.animate .donut-circles circle:nth-child(2) {
    animation: donut-fill 1s cubic-bezier(0.39, 0.575, 0.565, 1) forwards;
    animation-delay: 0.5s;
}

@keyframes donut-fill {
    0% {
        stroke-dasharray: 0 251.33;
    }
    100% {
        stroke-dasharray: var(--percentage) 251.33;
    }
}

/* Bar Chart Styles */
.charting-bar-chart {
    display: inline-block;
    vertical-align: middle;
    margin: 0px;
    /* Make charts responsive by default */
    width: 100%;
    max-width: 500px;
    height: auto;
}

/* Responsive scaling for different screen sizes */
@media (max-width: 768px) {
    .charting-bar-chart {
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .charting-bar-chart {
        max-width: 300px;
    }
}

/* Container-based scaling - charts will scale with their container */
.charting-bar-chart.responsive {
    width: 100%;
    max-width: none;
    height: auto;
}

/* Ensure SVG scales properly within the container */
.charting-bar-chart svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Initial state for bars */
.charting-bar-chart .animated-bar {
    width: 0;
}

.charting-bar-chart.animate .animated-bar {
    animation: bar-fill 500ms cubic-bezier(0.39, 0.575, 0.565, 1) forwards;
    animation-delay: 300ms;
}

@keyframes bar-fill {
    from {
        width: 0;
    }
    to {
        width: var(--target-width);
    }
}

/* Navigation */
.charting-nav {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 15px 20px;
    margin-bottom: 30px;
}

.charting-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.charting-nav a {
    color: #23282d;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.charting-nav a:hover,
.charting-nav a:focus {
    background: #f5f5f5;
    color: #0073aa;
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Section Styles */
.charting-admin-content section {
    margin: 40px 0;
}

/* Code Examples */
.code-example {
    margin: 15px 0;
}

.code-example code,
.code-example pre {
    display: block;
    padding: 15px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
}

.code-example code:focus,
.code-example pre:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #fff;
}

/* Example Containers */
.charting-example {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.charting-example ul {
    margin: 15px 0;
    padding-left: 20px;
}

.charting-example li {
    margin: 8px 0;
}

.charting-example li strong {
    color: #23282d;
}

/* Live Examples */
.charting-live-examples {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 30px;
    margin: 20px 0;
}

.charting-live-examples h3 {
    margin-top: 0;
}

.charting-live-examples > div {
    margin: 30px 0;
}

.charting-live-examples > div:first-child {
    margin-top: 15px;
}

.charting-live-examples > div:last-child {
    margin-bottom: 0;
}

/* Focus Styles */
a:focus,
button:focus,
[role="button"]:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #fff;
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
    .charting-nav a:focus,
    .code-example code:focus,
    .code-example pre:focus,
    a:focus,
    button:focus,
    [role="button"]:focus {
        outline: 2px solid CanvasText;
    }
    
    .charting-example,
    .charting-live-examples,
    .charting-nav {
        border: 1px solid CanvasText;
    }
} 