/* ============================================
   HISTORIQUE DE PRODUCTION - Design Moderne
   ============================================ */

/* Statistiques Container */
.stats-container {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 200px;
    padding: 20px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFB 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    border-left: 4px solid #0078D4;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0078D4 0%, #005A9E 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #605E5C;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #323130;
    line-height: 1;
}

/* Badges de statut */
.statut-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: linear-gradient(135deg, #0078D4 0%, #00B4D8 100%);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.statut-empty {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #E1E4E8;
    color: #605E5C;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.avancement-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: linear-gradient(135deg, #107C10 0%, #0E6B0E 100%);
    color: white;
}

.history-content {
    padding: 24px;
    background: linear-gradient(135deg, #F8FAFB 0%, #FFFFFF 100%);
    min-height: 600px;
}

/* Section Graphiques */
.charts-section {
    margin-bottom: 32px;
    padding: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #E1E4E8;
}

.section-header h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: #323130;
}

.section-description {
    margin: 0;
    font-size: 13px;
    color: #605E5C;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    margin-top: 24px;
}

/* Chaque graphique prend toute la largeur */
.charts-grid .chart-container {
    width: 100%;
    max-width: 100%;
}

.chart-container {
    background: #FAFAFA;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    min-height: 450px;
    height: 450px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0078D4, #00B4D8, #10B981);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-container:hover::before {
    opacity: 1;
}

.chart-container:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    background: #FFFFFF;
}

.chart-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #E1E4E8;
}

.chart-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #323130;
}

.chart-container canvas {
    max-height: 400px !important;
    min-height: 400px !important;
    height: 400px !important;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 20px;
}

.chart-container canvas:hover {
    transform: scale(1.01);
}

/* Améliorer la visibilité des labels d'axes dans Chart.js */
.chart-container canvas {
    filter: contrast(1.1);
}

/* Agrandir les graphiques pour la situation des OF */
#ofSituationCharts .chart-container {
    min-height: 550px !important;
    height: 550px !important;
    padding: 30px !important;
}

#ofSituationCharts .chart-container canvas {
    max-height: 480px !important;
    min-height: 480px !important;
    height: 480px !important;
    padding: 25px !important;
}

/* Améliorer l'espacement pour les labels d'axes */
#ofSituationCharts .chart-container {
    overflow: visible !important;
}

#ofSituationCharts .chart-container canvas {
    margin-bottom: 20px;
}

.history-header {
    margin-bottom: 28px;
    padding: 24px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFB 100%);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 5px solid #0078D4;
}

.history-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 800;
    color: #323130;
}

.history-hint {
    margin: 0;
    font-size: 14px;
    color: #605E5C;
    line-height: 1.6;
}

/* Filtres */
.history-filters {
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #323130;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group label i {
    color: #0078D4;
    font-size: 14px;
}

.filter-group .form-input {
    padding: 10px 12px;
    border: 1px solid #E1E4E8;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s;
}

.filter-group .form-input:focus {
    outline: none;
    border-color: #0078D4;
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

.filter-actions {
    display: flex;
    gap: 8px;
    grid-column: span 2;
}

.filter-actions .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.filter-actions .btn-primary {
    background: linear-gradient(135deg, #0078D4 0%, #00B4D8 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.3);
}

.filter-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.4);
}

.filter-actions .btn-secondary {
    background: #F3F2F1;
    color: #323130;
}

.filter-actions .btn-secondary:hover {
    background: #E1E4E8;
}

/* Section KPIs */
.history-kpi-section {
    margin-bottom: 24px;
}

.history-kpi-section .kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.history-kpi-section .kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.history-kpi-section .kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.history-kpi-section .kpi-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.history-kpi-section .kpi-card-content {
    flex: 1;
    min-width: 0;
}

.history-kpi-section .kpi-card-title {
    font-size: 12px;
    color: #605E5C;
    margin-bottom: 4px;
    font-weight: 500;
}

.history-kpi-section .kpi-card-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

/* Charts Section */
.history-charts-section {
    margin-bottom: 24px;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chart-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #F3F2F1;
}

.chart-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #323130;
}

.chart-container canvas {
    max-height: 300px;
}

/* Tables Section */
.history-tables-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.table-header {
    padding: 20px;
    background: linear-gradient(135deg, #F8FAFB 0%, #FFFFFF 100%);
    border-bottom: 2px solid #F3F2F1;
}

.table-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #323130;
}

.data-grid-container {
    overflow-x: auto !important;
    overflow-y: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.data-grid {
    width: 100%;
    border-collapse: collapse;
}

.data-grid thead {
    background: linear-gradient(135deg, #323130 0%, #000000 100%);
    color: white;
}

.data-grid th {
    padding: 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.data-grid tbody tr {
    border-bottom: 1px solid #F3F2F1;
    transition: background 0.2s;
}

.data-grid tbody tr:hover {
    background: #F8FAFB;
}

.data-grid td {
    padding: 12px;
    font-size: 13px;
    color: #323130;
}

.quality-badge,
.progress-badge {
    display: inline-block;
    font-size: 11px;
}

/* Pagination */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #F8FAFB;
    border-top: 1px solid #E1E4E8;
    margin-top: 0;
}

.pagination-info {
    font-size: 13px;
    color: #605E5C;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #0078D4;
    background: white;
    border: 1px solid #E1E4E8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn:hover:not(:disabled) {
    background: #0078D4;
    color: white;
    border-color: #0078D4;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #A19F9D;
}

.pagination-btn i {
    font-size: 11px;
}

/* Responsive */
@media (max-width: 1200px) {
    .chart-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .history-content {
        padding: 16px;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        grid-column: span 1;
        flex-direction: column;
    }
    
    .history-kpi-section .kpi-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .chart-container canvas {
        max-height: 250px;
    }
}

