/* Styles généraux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    display: flex;
    min-height: 100vh;
    background-color: #f5f7fa;
    color: #222;
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100vh;
    background-color: #1e2a36;
    color: #ffffff;
    padding: 20px 0;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar h2 {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid #34495e;
    color: #ffffff;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    padding: 10px 20px;
    margin-bottom: 5px;
}

.sidebar ul li a {
    color: #ffffff;
    text-decoration: none;
    display: block;
    transition: 0.3s;
}

.sidebar ul li a:hover {
    color: #3498db;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Contenu principal */
.content {
    flex: 1;
    padding: 20px;
    margin-left: 250px;
}

h1 {
    color: #1a2530;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #d0d0d0;
    font-weight: bold;
}

.welcome-message {
    font-size: 18px;
    color: #2980b9;
    margin-bottom: 20px;
    font-weight: 500;
}

/* Tableaux */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #d0d0d0;
    color: #000000;
}

th {
    background-color: #e6e6e6;
    font-weight: bold;
    color: #1a2530;
}

tr:hover {
    background-color: #e6f2ff;
}

/* Boutons */
button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
    font-weight: 600;
}

button.edit {
    background-color: #2980b9;
    color: white;
    margin-right: 5px;
}

button.delete {
    background-color: #c0392b;
    color: white;
}

button.validate {
    background-color: #27ae60;
    color: white;
    min-width: 100px;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

button[onclick*="location"] {
    background-color: #27ae60;
    color: white;
    padding: 10px 15px;
    font-weight: bold;
    margin-bottom: 15px;
}

/* Formulaires */
.form-container {
    background-color: white;
    padding: 25px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: -10px;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    font-weight: normal !important;
    margin-bottom: 0 !important;
    cursor: pointer;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #1a2530;
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 16px;
    color: #333;
    background-color: #fff;
}

.form-input:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.2);
    outline: none;
}

.btn-primary {
    background-color: #2980b9;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #21618c;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dashboard-card {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-card h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 18px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}

.stat-label {
    font-weight: bold;
    color: #333;
}

.stat-value {
    font-weight: bold;
    color: #1a2530;
}

.alert-list, .upcoming-list {
    list-style: none;
}

.alert-list li, .upcoming-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}

.date-alert {
    color: #c0392b;
    font-weight: bold;
}

.dashboard-card.alert {
    border-left: 4px solid #e74c3c;
}

/* Badges de statut */
.status-badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    display: inline-block;
    font-weight: 600;
}

.operationnel { 
    background: #c6e6c6;
    color: #0d4d0d;
    border: 1px solid #0d4d0d;
}

.degrade { 
    background: #ffe7b3;
    color: #664d00;
    border: 1px solid #664d00;
}

.hors-service { 
    background: #f5c2c7;
    color: #58151c;
    border: 1px solid #58151c;
}

/* Filtre */
.filtre-container {
    margin: 20px 0;
    display: flex;
    gap: 15px;
}

.filtre-container select {
    padding: 8px 12px;
    border: 2px solid #3498db;
    border-radius: 6px;
    width: 250px;
}

/* Styles pour les contrôles techniques */
.deadline-overdue {
    background-color: #ffcccc !important; /* Fond rouge pour les contrôles en retard */
    font-weight: bold;
}

.deadline-approaching {
    background-color: #fff3cd !important; /* Fond jaune pour les échéances proches */
}

.controles-table tr.deadline-overdue td {
    border-bottom: 1px solid #ffaaaa;
}

.controles-table tr.deadline-approaching td {
    border-bottom: 1px solid #f5e79e;
}

/* Styles spécifiques pour la liste des contrôles */
.controles-table td {
    color: #000000 !important; /* Force le noir pour tous les textes */
    font-weight: normal;
}

.controles-table .date {
    color: #000000 !important; /* Force le noir pour les dates */
    font-weight: normal;
}

table.controles-list tr {
    background-color: #ffffff;
    border-left: 4px solid #4caf50;
}

table.controles-list tr:nth-child(odd):not(.deadline-approaching):not(.deadline-overdue) {
    background-color: #f5f5f5;
}

table.controles-list tr:hover {
    background-color: #e3f2fd;
}

/* Styles pour le bouton de version */
.version-button {
    margin-top: auto;
    padding: 20px 0 10px 0;
    text-align: center;
}

#version-btn {
    background-color: #1e2a36;
    color: #ffffff;
    border: 1px solid #34495e;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.3s ease;
}

#version-btn:hover {
    background-color: #34495e;
    transform: scale(1.05);
}

/* Styles pour la popup changelog */
.changelog-popup {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.changelog-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 60%;
    max-width: 600px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close-popup {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-popup:hover {
    color: #555;
}

.changelog-version {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.changelog-version h4 {
    color: #3498db;
    margin-bottom: 10px;
}

.changelog-version ul {
    padding-left: 20px;
}

.changelog-version li {
    margin-bottom: 5px;
}

/* Styles pour la popup de validation */
.validation-popup {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.validation-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close-validation-popup {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-validation-popup:hover {
    color: #555;
}

.validation-content h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    color: #1a2530;
}

.radio-group {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-option label {
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
    color: #000;
}

/* Media Queries pour le responsive */
@media (max-width: 992px) {
    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 10px 0;
    }
    
    .sidebar h2 {
        margin-bottom: 15px;
        padding-bottom: 5px;
    }
    
    .sidebar ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .sidebar ul li {
        padding: 8px 15px;
        margin: 0 5px;
    }
    
    .content {
        margin-left: 0;
        padding: 15px;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .user-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        margin-top: 10px;
    }
    
    .user-name {
        margin-bottom: 0;
    }
    
    .version-button {
        position: absolute;
        top: 10px;
        right: 10px;
        padding: 0;
    }
    
    /* Responsive pour les filtres */
    .filtre-container {
        flex-direction: column;
        margin: 15px 0;
    }
    
    .filtre-container select {
        width: 100%;
    }
    
    .changelog-content {
        width: 85%;
        margin: 15% auto;
    }
    
    /* Affichage de l'overlay quand le menu est actif */
    .sidebar.active + .content + .mobile-menu-overlay {
        display: block;
    }
}

@media (max-width: 768px) {
    /* Ajustements pour les tableaux */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    th, td {
        padding: 10px;
    }
    
    /* Adaptation des cards */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    /* Formulaires */
    .form-container {
        padding: 15px;
    }
    
    button[onclick*="location"] {
        width: 100%;
        margin-bottom: 20px;
        padding: 12px;
    }
    
    /* Fix pour les boutons d'action */
    .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    button.edit, button.delete {
        flex: 1;
        min-width: 80px;
        margin: 0;
    }
    
    .validation-content {
        margin: 20% auto;
        padding: 20px;
        width: 95%;
    }
    
    .radio-group {
        padding: 10px;
    }
    
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    /* Ajustements pour très petits écrans */
    .sidebar ul {
        flex-direction: column;
        align-items: center;
    }
    
    .sidebar ul li {
        width: 100%;
        text-align: center;
        margin: 2px 0;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .form-input, 
    select,
    button.btn-primary {
        font-size: 16px;
        padding: 12px;
        border-radius: 6px;
    }
    
    /* Adaptation des statuts */
    .status-badge {
        display: block;
        text-align: center;
        margin: 5px 0;
    }
    
    /* Style pour les boutons de version */
    #version-btn {
        font-size: 0.7em;
        padding: 4px 8px;
    }
    
    /* Espacement des formulaires */
    .form-group {
        margin-bottom: 15px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .card {
        padding: 15px;
    }
    
    .action-buttons {
        text-align: center;
    }
    
    .action-buttons .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Fix pour iOS */
@supports (-webkit-overflow-scrolling: touch) {
    input[type="text"], 
    input[type="password"],
    input[type="email"],
    input[type="date"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px; /* Évite le zoom automatique sur iOS */
    }
    
    /* Amélioration du scrolling */
    body, .content, .sidebar {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix pour les tableaux */
    table {
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix pour le mode desktop - contrastes améliorés */
@media (min-width: 993px) {
    body {
        line-height: 1.5;
    }
    
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.4;
    }
    
    .dashboard-card h2 {
        font-weight: 700;
        color: #1a2530;
    }
    
    .alert-list li, .upcoming-list li {
        line-height: 1.6;
        color: #333;
    }
    
    table th {
        font-size: 15px;
    }
    
    table td {
        line-height: 1.6;
    }
    
    .form-group label {
        margin-bottom: 10px;
        font-size: 15px;
    }
    
    .form-input {
        padding: 12px;
        border-width: 1px;
    }
    
    .form-input:focus {
        border-width: 2px;
    }
    
    button.edit, button.delete {
        padding: 8px 15px;
        min-width: 100px;
        text-align: center;
    }
    
    .btn-primary {
        padding: 12px 20px;
        font-size: 16px;
        letter-spacing: 0.5px;
    }
}

/* Overlay pour le menu mobile */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
}

/* Renforcement du contraste pour tous les tableaux */
table td {
    color: #000000;
}

/* Style pour tous les tableaux en alternance de couleurs */
table tr:nth-child(odd) {
    background-color: #f5f5f5;
}

table tr:nth-child(even) {
    background-color: #ffffff;
}

/* Renforcement du style noir pour tous les textes dans les listes de contrôles */
.controles-list tr td {
    color: #000000 !important;
}

/* Styles pour le graphique */
.chart-container {
    width: 100%;
    height: 400px;
    margin: 20px 0;
    position: relative;
}

@media (max-width: 768px) {
    .chart-container {
        height: 300px;
    }
}

.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 30px;
}

.card h2 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Styles pour les formulaires de fréquentation */
input[type="week"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.action-buttons {
    margin-bottom: 20px;
    text-align: right;
}

/* Adaptations mobiles pour les graphiques */
@media (max-width: 576px) {
    .chart-container {
        height: 250px;
    }
    
    .card {
        padding: 15px;
    }
    
    .action-buttons {
        text-align: center;
    }
    
    .action-buttons .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Style pour la tuile de graphique dans le tableau de bord */
.dashboard-card.frequency-chart {
    grid-column: span 2;
    padding-bottom: 15px;
}

.dashboard-card .chart-container {
    width: 100%;
    height: 250px;
    margin: 15px 0;
}

.dashboard-card .chart-footer {
    text-align: right;
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px solid #eee;
}

.dashboard-card .chart-link {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.dashboard-card .chart-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.dashboard-card .no-data {
    text-align: center;
    padding: 30px 0;
    color: #7f8c8d;
    font-style: italic;
}

@media (max-width: 992px) {
    .dashboard-card.frequency-chart {
        grid-column: span 1;
    }
    
    .dashboard-card .chart-container {
        height: 200px;
    }
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.form-actions .btn {
    min-width: 100px;
}

.modal-content.confirmation .form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.modal-content.confirmation .form-actions form {
    margin-right: 10px;
}

@media (max-width: 576px) {
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}
