/**
 * EV Battery Supply Chain Charts Styles
 * Responsive, accessible styles for all chart components
 */

/* Base chart container styles */
.chart-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid #e5e7eb;
    max-width: 100%;
    overflow: hidden;
}

/* Chart headers */
.chart-header {
    margin-bottom: 24px;
    text-align: left;
}

.chart-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.chart-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

/* Milestone badges */
.chart-milestones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.milestone-badge {
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Risk summary for mineral dependencies */
.risk-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.risk-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
}

.risk-badge.high-risk {
    background: #fee2e2;
    color: #dc2626;
}

.risk-badge.avg-dependency {
    background: #fef3c7;
    color: #d97706;
}

/* Investment insights */
.investment-insights {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.insight-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 140px;
}

.insight-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
}

.insight-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
}

.insight-value.primary {
    color: #7c3aed;
    font-size: 1.25rem;
}

/* Chart legends */
.chart-legend {
    margin-top: 20px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.legend-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #374151;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 8px;
    display: inline-block;
}

.legend-color.dashed {
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        currentColor 2px,
        currentColor 4px
    );
    background-size: 8px 2px;
}

/* Chart footers */
.chart-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-source {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0;
    font-style: italic;
}

.view-source-link {
    font-size: 0.875rem;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.view-source-link:hover {
    background: #eff6ff;
    text-decoration: underline;
}

/* Placeholder styles */
.chart-placeholder {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 24px;
    margin-bottom: 32px;
    border: 2px dashed #d1d5db;
    text-align: center;
}

.placeholder-content {
    padding: 40px 20px;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.placeholder-content h4 {
    color: #374151;
    margin: 0 0 16px 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.placeholder-content p {
    color: #6b7280;
    margin: 8px 0;
    font-size: 0.875rem;
}

.placeholder-content p strong {
    color: #374151;
    font-weight: 600;
}

.error-details {
    color: #dc2626 !important;
    font-style: italic;
    background: #fee2e2;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 12px !important;
}

/* Dashboard specific styles */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
                'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
                sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f9fafb;
    min-height: 100vh;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 48px;
    padding: 32px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    margin: 0 -20px 48px -20px;
}

.dashboard-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 16px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dashboard-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
}

.dashboard-description {
    margin-top: 24px;
    padding: 0 20px;
    color: #1f2937;
    text-align: center;
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 32px;
}

.dashboard-description p {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Chart grid layout */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

/* Specific chart type styles */
.market-dominance-chart .chart-title {
    color: #dc2626;
}

.india-production-chart .chart-title {
    color: #059669;
}

.mineral-dependencies-chart .chart-title {
    color: #7c2d12;
}

.investment-acceleration-chart .chart-title {
    color: #7c3aed;
}

/* Responsive design */
@media (min-width: 768px) {
    .dashboard-container {
        padding: 40px;
    }
    
    .dashboard-header {
        margin: 0 -40px 48px -40px;
    }
    
    .charts-grid {
        grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    }
    
    .chart-footer {
        flex-wrap: nowrap;
    }
}

@media (min-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .view-source-link {
        transition: none;
    }
}

/* Focus styles for accessibility */
.view-source-link:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .chart-container {
        box-shadow: none;
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    .view-source-link {
        display: none;
    }
    
    .dashboard-header {
        background: #667eea !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
}