/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* EN-TÊTE */
header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 30px 40px;
    border-bottom: 5px solid #3498db;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* KPI CARDS */
.kpi-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
    background: #f8f9fa;
}

.kpi-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-icon {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
}

.kpi-content h3 {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2c3e50;
}

.kpi-trend {
    font-size: 0.9rem;
    margin-top: 5px;
}

.kpi-trend.positive {
    color: #27ae60;
}

.kpi-trend.negative {
    color: #e74c3c;
}

.kpi-period, .kpi-subtext {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 5px;
}

/* CHARTS */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(600px, 1fr));
    gap: 30px;
    padding: 30px;
}

.chart-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.chart-card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* TABLEAU */
.data-section {
    padding: 30px;
    background: #f8f9fa;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h3 {
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 20px;
    border: 2px solid #3498db;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    cursor: pointer;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-export {
    background: #27ae60;
    color: white;
}

.btn-export:hover {
    background: #219653;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-cancel {
    background: #e74c3c;
    color: white;
}

.btn-cancel:hover {
    background: #c0392b;
}

/* TABLE */
.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

thead {
    background: #2c3e50;
    color: white;
}

th {
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.3s ease;
}

tbody tr:hover {
    background: #f8f9fa;
}

td {
    padding: 15px;
}

.status-normal {
    color: #27ae60;
    font-weight: 600;
}

.status-warning {
    color: #f39c12;
    font-weight: 600;
}

.status-alert {
    color: #e74c3c;
    font-weight: 600;
}

.status-critical {
    color: #8b0000;
    font-weight: 700;
    background-color: #ffcccc;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.btn-action {
    background: transparent;
    border: none;
    color: #3498db;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.btn-action:hover {
    color: #2980b9;
}

.btn-action.delete {
    color: #e74c3c;
}

.btn-action.delete:hover {
    color: #c0392b;
}

/* PAGINATION */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
}

.btn-pagination {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-pagination:hover:not(:disabled) {
    background: #3498db;
    color: white;
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-info {
    font-weight: 600;
    color: #2c3e50;
}

/* CALCULS PAR PÉRIODE */
.calculs-section {
    padding: 30px;
    background: white;
}

.calculs-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.periods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.period-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.period-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.period-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.period-time {
    font-size: 0.9rem;
    opacity: 0.9;
}

.period-values {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.period-value {
    text-align: center;
}

.value-label {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.value-number {
    font-size: 1.5rem;
    font-weight: 700;
}

.period-footer {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 10px;
    text-align: center;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 15px;
    padding: 30px;
    overflow-y: auto;
    position: relative;
}

.close-modal {
    float: right;
    font-size: 28px;
    cursor: pointer;
    color: #7f8c8d;
    position: absolute;
    top: 20px;
    right: 20px;
}

.close-modal:hover {
    color: #2c3e50;
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.import-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.import-option {
    padding: 25px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.import-option.active {
    border-color: #3498db;
    background: #ebf5fb;
}

.import-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.import-option i {
    font-size: 40px;
    color: #3498db;
    margin-bottom: 15px;
}

.import-option h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.import-option p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

#import-preview {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

#import-preview h4 {
    color: #2c3e50;
    margin-bottom: 15px;
}

#paste-area {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: monospace;
    resize: vertical;
    margin-top: 10px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .import-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kpi-container {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .periods-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
}

