/* HTML Chart Fallbacks */
.html-chart {
    display: block !important;
    width: 100% !important;
    min-height: 300px !important;
    margin: 0 auto !important;
    font-family: Arial, sans-serif;
}

/* Horizontal bar chart */
.html-chart-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    gap: 8px;
    position: relative;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Dark mode styling */
.dark-mode .html-chart-container {
    background-color: rgba(30, 41, 59, 0.9);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* Enhanced styling for Feature Influence fallback */
.html-feature-influence {
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.dark-mode .html-feature-influence {
    background-color: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.html-chart-row {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
}

.html-chart-label {
    flex: 0 0 120px;
    font-size: 12px;
    text-align: right;
    padding-right: 10px;
    color: var(--text-color, #e2e8f0);
}

body:not(.dark-mode) .html-chart-label {
    color: var(--light-text-color, #333333);
}

.html-chart-bar-container {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.1);
    height: 25px;
    border-radius: 4px;
    overflow: hidden;
}

body:not(.dark-mode) .html-chart-bar-container {
    background-color: rgba(0, 0, 0, 0.05);
}

.html-chart-bar {
    height: 100%;
    background-color: #4f46e5;
    display: flex;
    align-items: center;
    padding-left: 10px;
    color: white;
    font-size: 12px;
    font-weight: bold;
    transition: width 1s ease-in-out;
}

.html-chart-value {
    margin-left: 5px;
    font-weight: bold;
    color: white;
}

/* Vertical bar chart */
.html-chart-container.vertical {
    flex-direction: row;
    justify-content: space-around;
    align-items: flex-end;
    height: calc(100% - 30px);
}

.html-chart-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.html-chart-bar-container.vertical {
    width: 60px;
    height: 250px;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: flex-end;
    border-radius: 4px;
    overflow: hidden;
}

body:not(.dark-mode) .html-chart-bar-container.vertical {
    background-color: rgba(0, 0, 0, 0.05);
}

.html-chart-bar.vertical {
    width: 100%;
    transition: height 1s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5px;
}

/* Grouped bar chart */
.html-chart-container.grouped {
    flex-direction: row;
    justify-content: space-around;
    height: calc(100% - 50px);
}

.html-chart-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.html-chart-group-label {
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 12px;
    color: var(--text-color, #e2e8f0);
}

body:not(.dark-mode) .html-chart-group-label {
    color: var(--light-text-color, #333333);
}

.html-chart-column.grouped {
    margin: 0 2px;
}

.html-chart-value.small {
    font-size: 10px;
}

/* Legend for charts */
.html-chart-legend {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

/* Feature influence specific styles */
.html-chart-title {
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    color: #4f46e5;
}

.dark-mode .html-chart-title {
    color: #818cf8;
}

.html-chart-bars {
    margin: 15px 0;
}

.html-chart-bar-zero {
    width: 2px;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    margin: 0 2px;
}

.dark-mode .html-chart-bar-zero {
    background-color: rgba(255, 255, 255, 0.5);
}

.html-chart-positive-bar {
    height: 20px;
    background-color: #4f46e5;
    border-radius: 0 4px 4px 0;
}

.html-chart-negative-bar {
    height: 20px;
    background-color: #ef4444;
    border-radius: 4px 0 0 4px;
    margin-left: auto;
}

.html-feature-influence .html-chart-legend {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 0;
    gap: 20px;
}

.html-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.html-legend-color {
    width: 15px;
    height: 15px;
    border-radius: 4px;
}

.html-legend-color.positive {
    background-color: #4f46e5;
}

.html-legend-color.negative {
    background-color: #ef4444;
}

.html-legend-text {
    font-size: 13px;
    color: #1f2937;
}

.dark-mode .html-legend-text {
    color: #e5e7eb;
}

.html-chart-analysis {
    margin-top: 25px;
    padding: 15px;
    background-color: rgba(243, 244, 246, 0.7);
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #4f46e5;
}

.dark-mode .html-chart-analysis {
    background-color: rgba(31, 41, 55, 0.7);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #818cf8;
}

.html-chart-analysis h4 {
    color: #4f46e5;
    margin-bottom: 10px;
    font-weight: 600;
}

.dark-mode .html-chart-analysis h4 {
    color: #818cf8;
}

.html-chart-analysis ul {
    padding-left: 20px;
    margin: 0;
}

.html-chart-analysis li {
    margin-bottom: 5px;
    color: #1f2937;
    font-size: 13px;
}

.dark-mode .html-chart-analysis li {
    color: #e5e7eb;
}

.html-chart-legend-item {
    display: flex;
    align-items: center;
    margin: 0 10px;
}

.html-chart-legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    margin-right: 5px;
}

.html-chart-legend-label {
    font-size: 12px;
    color: var(--text-color, #e2e8f0);
}

body:not(.dark-mode) .html-chart-legend-label {
    color: var(--light-text-color, #333333);
}
