/**
 * style.css
 * Thème Professionnel "LinkedIn Inspired"
 */

/* Intégration de la police de caractères */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root { 
    /* Nouvelle Palette de Couleurs "LinkedIn Inspired" */
    --primary-color: #0A66C2; /* Bleu LinkedIn */
    --secondary-color: #1abc9c; /* Turquoise Vif pour l'accent */
    --danger-color: #e74c3c; /* Rouge Doux */
    --warning-color: #f39c12; /* Orange Ambré */
    
    /* Tons neutres */
    --light-bg: #f4f2ee; /* Fond légèrement crème */
    --white: #ffffff; 
    --dark-gray: #1d2226; /* Texte principal (quasi noir) */
    --light-gray: #5E5E5E; /* Texte secondaire / Icônes inactives */
    --border-color: #e0e0e0; /* Bordures subtiles */

    /* Effets et Dimensions */
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.06); /* Ombre plus douce */
    --header-height: 52px; 
    --nav-height: 52px; 
    --border-radius: 8px; /* Rayon de bordure standard */

    /* Couleurs pour le planning */
    --shift-morning-bg: #f39c1233; /* Orange transparent */
    --shift-afternoon-bg: #0A66C233; /* Bleu transparent */
    --shift-night-bg: #2c3e5033; /* Gris/bleu nuit transparent */
    --shift-day-bg: #1abc9c33; /* Turquoise transparent */
    --shift-off-bg: #e74c3c33; /* Rouge transparent */

    /* Couleurs pour les rôles */
    --role-admin-color: #8e44ad; /* Violet Améthyste */
    --role-technician-color: var(--warning-color); /* Orange Ambré (réutilisation) */
    --role-storekeeper-color: var(--secondary-color); /* Turquoise Vif (réutilisation) */
    
    /* Couleurs pour les formations */
    --success-color: #27ae60; /* Vert pour terminé */
    --current-video-bg: #e3f2fd; /* Bleu clair pour vidéo actuelle */
    
    /* Couleurs pour les KPI avancés */
    --kpi-oee-color: #0A66C2;
    --kpi-cost-color: #f39c12;
    --kpi-failure-color: #e74c3c;
    --kpi-preventive-color: #27ae60;
}

/* Styles pour les filtres optimisés */
.searching {
    opacity: 0.7;
    background-color: #f8f9fa !important;
    border-color: var(--primary-color) !important;
}

.searching::placeholder {
    color: var(--primary-color) !important;
    font-weight: 500;
}

.filter-section-compact .section-title h3 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-active-badge {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Amélioration des indicateurs de chargement */
#filter-loading-indicator {
    animation: fadeIn 0.2s ease-in;
}

/* Styles pour les filtres de date */
.filter-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.filter-row .form-group {
    flex: 1;
    min-width: 150px;
}

.filter-row .form-group.compact {
    flex: 0 0 auto;
    min-width: 120px;
}

/* Indicateur de filtres actifs */
.filter-active-badge button:hover {
    background: rgba(255,255,255,0.3) !important;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

body.dark-mode { 
    --primary-color: #0A66C2;
    --secondary-color: #1abc9c;
    --light-bg: #1d2226; 
    --white: #2a2f33; 
    --dark-gray: #eef3f8; 
    --light-gray: #a0a0a0; 
    --border-color: #404040; 
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.2); 

    /* Couleurs pour le planning en mode sombre */
    --shift-morning-bg: #f39c1255;
    --shift-afternoon-bg: #0A66C255;
    --shift-night-bg: #2c3e5077;
    --shift-day-bg: #1abc9c55;
    --shift-off-bg: #e74c3c55;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    -webkit-tap-highlight-color: transparent; 
}

body { 
    background-color: var(--light-bg); 
    color: var(--dark-gray); 
    padding-bottom: calc(var(--nav-height) + 20px); 
    transition: background-color 0.3s, color 0.3s; 
    font-size: 14px;
    font-weight: 400;
}

.page-container { 
    padding: 15px; 
    padding-top: calc(var(--header-height) + 15px); 
}

.app-header { 
    position: fixed; top: 0; left: 0; 
    width: 100%; 
    height: var(--header-height); 
    background-color: var(--white); 
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 15px; 
    z-index: 1000; 
    transition: background-color 0.3s, border-color 0.3s; 
}

.app-header h1 { 
    font-size: 18px; 
    font-weight: 600;
    color: var(--primary-color);
    display: flex; 
    align-items: center; 
    gap: 10px; 
}

.header-logo {
    width: 28px;
    height: 28px;
}


.header-actions { display: flex; align-items: center; gap: 20px; }
.header-actions i { font-size: 20px; cursor: pointer; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--light-gray); transition: color 0.2s; }
.header-actions i:hover { color: var(--primary-color); }


.bottom-nav { 
    position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height); 
    background-color: var(--white); display: flex; justify-content: space-around; 
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); 
    border-top: 1px solid var(--border-color);
    z-index: 1000; transition: background-color 0.3s, border-color 0.3s; 
}
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--light-gray); text-decoration: none; flex-grow: 1; transition: color 0.2s; font-size: 10px; text-align: center; position: relative; font-weight: 500;}
.nav-item i { font-size: 20px; } 
.nav-item span { margin-top: 5px; } 
.nav-item.active { color: var(--primary-color); font-weight: 600; }

.refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
}

.refresh-btn:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

.refresh-btn:active {
    transform: scale(0.95);
}

.refresh-btn i {
    animation: none;
    transition: transform 0.3s ease;
}

.refresh-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.notification-dot { position: absolute; top: 2px; right: calc(50% - 25px); width: 8px; height: 8px; background-color: var(--danger-color); border-radius: 50%; display: none; }
.page-content { display: none; } 
.page-content.active { display: block; animation: fadeIn 0.4s; } 
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.card { 
    background-color: var(--white); 
    border-radius: var(--border-radius); 
    padding: 15px; 
    margin-bottom: 15px; 
    box-shadow: var(--shadow); 
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, transform 0.2s, border-color 0.3s; 
}
#profile .card {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; margin-bottom: 15px; }
.section-title > div { display: flex; align-items: center; gap: 8px; }

.btn { 
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px; 
    border-radius: var(--border-radius); 
    border: none; 
    background-color: var(--primary-color); 
    color: #FFF; 
    font-weight: 500; 
    cursor: pointer; 
    text-align: center; 
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s; 
    font-size: 14px; 
}
.btn.btn-secondary { background-color: var(--secondary-color); }
.btn-small { padding: 8px 12px; font-size: 12px; }
.btn:disabled { background-color: var(--light-gray); cursor: not-allowed; opacity: 0.7; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.btn:active { transform: translateY(0px) scale(0.98); } 
.btn-full { width: 100%; } 
.btn-danger { background-color: var(--danger-color); }

.fab { 
    position: fixed; 
    bottom: calc(var(--nav-height) + 20px); right: 20px; 
    width: 56px; height: 56px; 
    background-color: var(--primary-color);
    color: white; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 24px; 
    box-shadow: 0 6px 20px rgba(10, 102, 194, 0.4); 
    cursor: pointer; z-index: 999; 
    transition: transform 0.2s;
}
.fab:hover { transform: scale(1.1) rotate(15deg); }

/* Barre de recherche masquée - remplacée par le panneau de recherche latéral */
.search-bar { 
    display: none; /* Masquée car remplacée par le panneau de recherche latéral */
}

.item-list { list-style: none; } 
.list-item { display: flex; align-items: center; padding: 15px 5px; border-bottom: 1px solid var(--border-color); transition: background-color 0.2s; } 
.list-item-clickable { cursor: pointer; } 
.list-item-clickable:hover { background-color: var(--light-bg); }
.list-item:last-child { border-bottom: none; }

/* Styles pour les playlists de formation */
.current-video { 
    background-color: var(--current-video-bg) !important; 
    border-left: 4px solid var(--primary-color);
    padding-left: 11px;
}

/* === STYLES POUR KPI AVANCÉS === */
.kpi-subtitle {
    margin-top: 4px;
    font-size: 0.75rem;
    opacity: 0.8;
}

.kpi-subtitle small {
    color: var(--light-gray);
    font-weight: 400;
}

.kpi-oee .kpi-value {
    color: var(--kpi-oee-color) !important;
}

.kpi-cost .kpi-value {
    color: var(--kpi-cost-color) !important;
}

.kpi-failure-rate .kpi-value {
    color: var(--kpi-failure-color) !important;
}

.kpi-preventive .kpi-value {
    color: var(--kpi-preventive-color) !important;
}

/* Amélioration de la grille KPI pour plus d'éléments */
.kpi-grid-pro {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.kpi-column {
    text-align: center;
    padding: 12px;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.kpi-column:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.kpi-value {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--light-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Styles pour les graphiques de tendance */
.trend-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .trend-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Styles pour les rapports automatiques */
.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.report-frequency {
    font-weight: 500;
    color: var(--dark-gray);
}

.report-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.report-status:contains("Activé") {
    background: var(--success-color);
    color: white;
}

.report-status:contains("Désactivé") {
    background: var(--light-gray);
    color: var(--white);
}
.video-row { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 10px; 
    align-items: center;
}
.video-row input { 
    flex: 1; 
    margin: 0; 
}
.videos-group { 
    margin-bottom: 15px; 
}
.item-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; margin-right: 15px; flex-shrink: 0; }
.bg-blue { background-color: var(--primary-color); } 
.bg-green { background-color: var(--secondary-color); } 
.bg-orange { background-color: var(--warning-color); } 
.bg-purple { background-color: #8e44ad; } 
.bg-grey { background-color: #bdc3c7; }
.bg-training { background-color: #34495e; }
.item-info { flex-grow: 1; min-width: 0; } 
.item-title { font-weight: 600; font-size: 15px; color: var(--dark-gray);} 
.item-subtitle { font-size: 13px; color: var(--light-gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-details { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.detail-badge { background-color: var(--light-bg); color: var(--light-gray); padding: 4px 8px; border-radius: var(--border-radius); font-size: 11px; font-weight: 500; }
.item-actions { display: flex; gap: 12px; align-items: center; flex-wrap: nowrap; } 
.item-actions .action-icon { font-size: 16px; color: var(--light-gray); cursor: pointer; transition: color 0.2s, transform 0.2s; } 
.item-actions .action-icon:hover { color: var(--primary-color); transform: scale(1.2); }
.item-actions-grid { display: grid; grid-template-columns: repeat(2, auto); gap: 4px 8px; justify-content: end; font-size: 11px; margin-right: 10px; text-align: right;}
.item-action-icons { display: flex; gap: 16px; }
.action-icon-delete { color: var(--danger-color) !important; }
.action-icon-delete:hover { color: #c0392b !important; }

#parts .list-item .item-title { font-size: 13px; }
#parts .list-item .item-subtitle { font-size: 11px; }
#parts .item-actions-grid { grid-template-columns: 1fr; gap: 2px; margin-right: 5px; }

@media (min-width: 768px) {
    #parts .item-actions-grid {
        grid-template-columns: repeat(4, auto);
    }
}


.status-badge { padding: 4px 10px; border-radius: 15px; font-size: 11px; font-weight: 600; color: #fff; }
.status-planned { background-color: var(--primary-color); } .status-progress { background-color: var(--warning-color); } .status-completed { background-color: var(--secondary-color); } 
.status-low-stock { background-color: var(--warning-color); } 
.status-ok-stock { background-color: var(--secondary-color); color: white; }
.status-info { background-color: #ecf0f1; color: var(--dark-gray); white-space: nowrap; }
body.dark-mode .status-info { background-color: #3a536b; color: #ecf0f1;}

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.3s; backdrop-filter: blur(5px); }
.modal.active { opacity: 1; pointer-events: auto; } 
.modal-content { background-color: var(--white); padding: 25px; border-radius: 12px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; transform: scale(0.9); transition: transform 0.3s; border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0,0,0,0.1);}
.modal.active .modal-content { transform: scale(1); } 
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 20px; font-weight: 600; } 
.close-modal { font-size: 28px; cursor: pointer; color: var(--light-gray); line-height: 1; transition: transform 0.2s;}
.close-modal:hover { transform: rotate(90deg); color: var(--danger-color); }

.form-group { margin-bottom: 15px; } 
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; }

/* Styles compacts pour les filtres */
.filter-compact .form-group { margin-bottom: 8px; }
.filter-compact .form-group label { 
    margin-bottom: 4px; 
    font-size: 12px; 
    font-weight: 600; 
    color: var(--text-secondary);
}
.filter-compact .form-control { 
    padding: 8px 10px; 
    font-size: 13px; 
    height: 36px;
}

.form-control { 
    width: 100%; padding: 12px; 
    border: 1px solid var(--border-color); 
    border-radius: var(--border-radius); 
    font-size: 14px; 
    background-color: var(--light-bg); 
    color: var(--dark-gray); 
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.2);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px 12px; padding-right: 2.5rem;}


input[readonly].form-control { background-color: #eee; color: #777; cursor: not-allowed; }
body.dark-mode input[readonly].form-control { background-color: #3a3a3a; color: #aaa; }

.loading-message { text-align: center; padding: 40px; color: var(--light-gray); }

#auth-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--light-bg); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.auth-box { width: 90%; max-width: 350px; padding: 30px; background-color: var(--white); border-radius: 12px; box-shadow: var(--shadow); text-align: center; }

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.auth-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.auth-box h2 { 
    margin-bottom: 20px; 
    color: var(--dark-gray);
    font-weight: 500;
    font-size: 20px;
}
.auth-error { color: var(--danger-color); margin-top: 10px; font-size: 14px; height: 20px; }
.auth-toggle-link { margin-top: 15px; font-size: 14px; color: var(--primary-color); cursor: pointer; font-weight: 500; }
#signup-form { display: none; }
.app-container { display: none; }

.parts-search-results-log, .parts-search-results { max-height: 150px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: var(--border-radius); margin-top: 5px; background-color: var(--white); z-index: 10; position: absolute; width: 100%;}
.parts-search-results-log div, .parts-search-results div { padding: 10px; cursor: pointer; }
.parts-search-results-log div:hover, .parts-search-results div:hover { background-color: var(--light-bg); }

.used-part-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.used-part-item span { flex-grow: 1; }
.used-part-item input { width: 70px; }
.used-part-item button { background: none; border: none; color: var(--danger-color); font-size: 18px; cursor: pointer; }

.filter-toggle { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

.kpi-grid-pro { 
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-around;
    align-items: center;
}
.kpi-gauge-container, .kpi-column {
    flex-basis: 120px;
    flex-grow: 1;
    text-align: center;
}
.kpi-grid-3-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    align-items: center;
}

.kpi-gauge-container { position: relative; width: 80px; height: 80px; margin: 0 auto; }
.kpi-gauge-value { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 18px; font-weight: bold; color: var(--primary-color)}
.kpi-column { text-align: center; }
.kpi-column .kpi-value { font-size: 16px; font-weight: 700; color: var(--dark-gray);}
.kpi-column .kpi-label { font-size: 10px; color: var(--light-gray); text-transform: uppercase; }
.kpi-highlight {
    background-color: var(--light-bg);
    padding: 10px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}
body.dark-mode .kpi-highlight {
    background-color: #3a536b;
}


.detail-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.detail-table th, .detail-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border-color); }
.detail-table th { font-size: 12px; color: var(--light-gray); font-weight: 500; }

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

.auth-separator { display: flex; align-items: center; text-align: center; color: var(--light-gray); margin: 20px 0; }
.auth-separator::before, .auth-separator::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
.auth-separator:not(:empty)::before { margin-right: .25em; }
.auth-separator:not(:empty)::after { margin-left: .25em; }

.btn-google { background-color: var(--white); color: var(--dark-gray); border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px;}
.btn-google:hover { background-color: var(--light-bg); }

#loader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--light-bg); display: flex; justify-content: center; align-items: center; z-index: 10000;}
.spinner { border: 4px solid var(--border-color); border-top: 4px solid var(--primary-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#consignes-card .consignes-content { white-space: pre-wrap; background-color: var(--light-bg); padding: 15px; border-radius: var(--border-radius); min-height: 50px; }
#consignes-card textarea { resize: vertical; }

.pagination-controls { text-align: center; margin-top: 20px; }

#connection-status { width: 12px; height: 12px; border-radius: 50%; transition: background-color 0.5s; }
.connection-dot-online { background-color: var(--secondary-color); }
.connection-dot-offline { background-color: var(--light-gray); }

.dashboard-grid, .parts-top-grid, .network-top-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 15px; 
}

.date-filter-grid-condensed {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: end;
}
.date-filter-grid-condensed .form-group {
    margin-bottom: 0;
}

/* Nouveaux styles pour filtres compacts et professionnels */
.filter-row {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.filter-row .form-group {
    margin-bottom: 0;
    min-width: 140px;
    flex: 1;
}

.filter-row .form-group.compact {
    min-width: 100px;
    flex: 0 0 auto;
}

.filter-row .btn {
    height: 36px;
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
}

.filter-section-compact {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.filter-section-compact .section-title {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.filter-section-compact .section-title h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.filter-toggle-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.filter-toggle-compact input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.filter-toggle-compact label {
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    cursor: pointer;
}


.dashboard-grid > .card {
    margin-bottom: 0;
}

.chart-container-wrapper {
    position: relative;
    height: 90px; 
}

#update-bar {
    display: none;
    position: fixed;
    bottom: calc(var(--nav-height) + 15px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--dark-gray);
    color: var(--white);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 2000;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
#update-bar #update-reload {
    background-color: var(--warning-color);
}

.advanced-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 15px;
}

.schedule-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.schedule-table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
}
.schedule-table th, .schedule-table td {
    border: 1px solid var(--border-color);
    padding: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-table th {
    background-color: var(--light-bg);
    font-weight: 600;
}
.schedule-table td:first-child {
    text-align: left;
    font-weight: 500;
    background-color: var(--light-bg);
    width: 120px;
    padding-left: 8px;
}

.schedule-actions-header, .schedule-actions-cell {
    width: 60px;
}

.schedule-actions-cell .action-icon {
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s, transform 0.2s;
}

.schedule-actions-cell .action-icon:hover {
    transform: scale(1.2);
}

.schedule-cell {
    padding: 0 !important;
    position: relative;
    transition: background-color: 0.3s;
}
.shift-select {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
    color: var(--dark-gray);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 8px 4px;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    text-align-last: center;
}
body.dark-mode .shift-select {
    color: var(--dark-gray);
}
select:focus {
    outline: none;
}

.schedule-cell.shift-M { background-color: var(--shift-morning-bg); }
.schedule-cell.shift-A { background-color: var(--shift-afternoon-bg); }
.schedule-cell.shift-N { background-color: var(--shift-night-bg); }
.schedule-cell.shift-J { background-color: var(--shift-day-bg); }
.schedule-cell.shift-C { background-color: var(--shift-off-bg); }

#schedule-actions {
    margin-top: 15px;
    display: none;
}

/* Couleurs pour les rôles dans le planning */
.schedule-table .role-admin { color: var(--role-admin-color); font-weight: 600; }
.schedule-table .role-technician { color: var(--role-technician-color); font-weight: 500; }
.schedule-table .role-storekeeper { color: var(--role-storekeeper-color); font-weight: 500; }

.profile-item[data-action]:hover .item-icon {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.profile-item[data-action]:hover .item-title {
    color: var(--primary-color);
}
.profile-item .item-arrow {
    transition: transform 0.3s ease;
}
.profile-item[data-action]:hover .item-arrow {
    transform: translateX(5px);
}

/* Styles pour la To-Do List */
.add-todo-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
#todo-list-items .list-item {
    padding: 10px 5px;
}
#todo-list-items .item-info {
    margin-left: 15px;
}
.todo-item-text {
    flex-grow: 1;
    cursor: pointer;
}
.todo-item-text.completed {
    text-decoration: line-through;
    color: var(--light-gray);
}
.todo-checkbox {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* --- Styles pour le jeu de suites logiques (MODIFIÉ) --- */
.bg-logic { background-color: #9b59b6; }

.logical-suite-intro {
    text-align: center;
    color: var(--light-gray);
    margin-bottom: 20px;
}

.logical-suite-menu .list-item { cursor: pointer; }
.logical-suite-puzzle-area { text-align: center; margin-bottom: 20px; }

#logical-suite-puzzle {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 20px 0;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
}

.qcm-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px auto;
    max-width: 400px;
}
.qcm-option {
    background-color: var(--white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.qcm-option:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
}
.qcm-option.correct { background-color: var(--secondary-color); color: white; border-color: var(--secondary-color); }
.qcm-option.incorrect { background-color: var(--danger-color); color: white; border-color: var(--danger-color); }

#logical-suite-feedback {
    margin-top: 15px;
    font-size: 14px;
    min-height: 40px;
}

.feedback-success { color: var(--secondary-color); font-weight: 600; }
.feedback-error { color: var(--danger-color); font-weight: 600; }

.logical-suite-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.quiz-header { margin-bottom: 20px; }
#quiz-question-counter { font-size: 12px; color: var(--light-gray); }
.quiz-progress-bar-container { width: 100%; background-color: var(--border-color); border-radius: 5px; height: 8px; margin-top: 5px; overflow: hidden; }
.quiz-progress-bar { height: 100%; width: 0%; background-color: var(--primary-color); transition: width 0.3s; }

.quiz-results-summary { text-align: center; }
.final-score-display { font-size: 48px; font-weight: 700; color: var(--primary-color); margin: 10px 0; }

/* *** NOUVEAUX STYLES POUR L'HISTORIQUE ET NIVEAUX *** */
#logical-suite-history {
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--light-bg);
}
body.dark-mode #logical-suite-history {
    background-color: #3a4145; /* Slightly different for contrast */
}
.results-login-prompt, .results-none {
    text-align: center;
    color: var(--light-gray);
    padding: 10px 0;
}
.results-table {
    width: 100%;
    border-collapse: collapse;
}
.results-table th, .results-table td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
}
.results-table th {
    font-weight: 500;
}
.score-badge {
    padding: 3px 8px;
    border-radius: 12px;
    color: white;
    font-size: 11px;
    font-weight: 600;
}
.score-high { background-color: var(--secondary-color); }
.score-medium { background-color: var(--warning-color); }
.score-low { background-color: var(--danger-color); }

.test-category-block {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.test-category-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.test-category-block h4 {
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.level-selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.level-btn {
    position: relative;
    padding-right: 28px; /* Space for icon */
}
.level-btn:disabled {
    background-color: var(--light-gray) !important;
    border-color: var(--light-gray) !important;
    opacity: 0.6;
}
.level-locked, .level-passed {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}
.level-locked { color: var(--danger-color); }
.level-passed { color: var(--secondary-color); }

/* Améliorations pour l'affichage des interventions */
.intervention-ot-number {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 2px;
    opacity: 0.8;
}

.intervention-equipment {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.downtime-highlight {
    background-color: var(--warning-color) !important;
    color: white !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    padding: 4px 8px !important;
}

.downtime-highlight i {
    margin-right: 4px;
}

/* Amélioration des badges de détails pour les interventions */
.item-details .detail-badge {
    background-color: var(--light-bg);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 4px;
    display: inline-block;
}

.item-details .detail-badge i {
    margin-right: 4px;
    font-size: 11px;
}

/* Mise en évidence du type d'intervention */
.item-icon.bg-orange {
    background: linear-gradient(135deg, var(--warning-color), #ff9500);
}

.item-icon.bg-blue {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
}

/* Indicateur de statut pour les équipements en panne */
.item-icon {
    position: relative;
}

.equipment-status-indicator {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background-color: var(--danger-color);
    border-radius: 50%;
    border: 2px solid var(--white);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.item-icon.has-active-intervention {
    border: 2px solid var(--danger-color);
}

/* Amélioration de la lisibilité générale des interventions */
.list-item[data-type="interventions"] .item-content {
    padding: 12px 16px;
}

.list-item[data-type="interventions"] .item-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
}

.list-item[data-type="interventions"] .item-subtitle {
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 8px;
}

/* Amélioration de l'espacement des détails */
.list-item[data-type="interventions"] .item-details {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

/* Styles pour la modal des détails d'équipement améliorée */
.equipment-info-section {
    background: var(--light-bg);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 20px;
}

.equipment-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.equipment-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.equipment-info-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.equipment-info-item span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.equipment-stats-section {
    margin-bottom: 20px;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.equipment-stats-section h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.equipment-stats-section h4 i {
    color: var(--primary-color);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
    border-radius: 4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Onglets */
.equipment-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    gap: 4px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: var(--light-bg);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-content {
    min-height: 300px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Résumés */
.interventions-summary,
.parts-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
}

.summary-item.corrective {
    background-color: rgba(255, 152, 0, 0.1);
    color: var(--warning-color);
}

.summary-item.preventive {
    background-color: rgba(10, 102, 194, 0.1);
    color: var(--primary-color);
}

.summary-item i {
    font-size: 12px;
}

/* Liste des pièces consommées */
.parts-consumed-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.part-consumed-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    align-items: center;
}

.part-info .part-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.part-info .part-reference {
    font-size: 12px;
    color: var(--text-secondary);
}

.part-details {
    text-align: center;
}

.part-details .part-quantity {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 16px;
}

.part-details .part-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.part-intervention {
    text-align: right;
}

.part-intervention .part-ot {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.part-intervention .part-tech {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Section d'analyse */
.analytics-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.analytics-section h5 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.progress-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-item label {
    min-width: 80px;
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--light-bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.progress-fill.corrective {
    background: var(--warning-color);
}

.progress-fill.preventive {
    background: var(--primary-color);
}

.progress-item span {
    min-width: 30px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.cost-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.cost-item:last-child {
    border-bottom: none;
}

.cost-item label {
    font-size: 13px;
    color: var(--text-secondary);
}

.cost-item span {
    font-weight: 600;
    color: var(--text-primary);
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 40px 20px;
}

/* Styles pour les paramètres de notifications */
.notifications-section {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.notifications-section h4 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-setting {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

.setting-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.setting-label input[type="number"],
.setting-label input[type="email"] {
    width: 200px;
    margin-left: auto;
}

.setting-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    margin-left: 30px;
}

/* Styles pour l'historique des alertes */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    color: var(--text-secondary);
}

.alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alert-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.alert-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.alert-time {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.alert-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.alert-status.sent {
    background: var(--success-color);
    color: white;
}

.alert-status.failed {
    background: var(--danger-color);
    color: white;
}

/* Couleur pour bg-purple */
.bg-purple {
    background: linear-gradient(135deg, #6f42c1, #5a32a3);
}

/* Styles pour les niveaux d'alertes */
.alert-level {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.level-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.level-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.level-info {
    flex: 1;
}

.level-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.level-description {
    font-size: 12px;
    color: var(--text-secondary);
}

.level-settings {
    margin-left: 44px;
}

.level-settings input {
    width: 100%;
}

/* Styles pour les alertes dans l'historique */
.alert-responsible {
    border-left: 4px solid var(--warning-color);
}

.alert-manager {
    border-left: 4px solid #ffc107;
}

.alert-director {
    border-left: 4px solid var(--danger-color);
}

.alert-recipient {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    opacity: 0.8;
}

/* Styles pour les notifications mobiles */
.mobile-info {
    margin-top: 16px;
    padding: 12px;
    background: #e8f5e8;
    border: 1px solid #4caf50;
    border-radius: var(--border-radius);
}

.mobile-info h5 {
    margin: 0 0 8px 0;
    color: #2e7d32;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-info ol {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.mobile-info li {
    margin-bottom: 4px;
}

.notification-status {
    margin-top: 12px;
    padding: 8px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.permission-status {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.status-success {
    color: var(--success-color);
}

.status-warning {
    color: var(--warning-color);
}

.status-error {
    color: var(--danger-color);
}

/* Styles pour l'interface simplifiée */
.alert-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-top: 12px;
}

.alert-icon-simple {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.alert-text {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 2px;
}

.alert-description {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Styles pour les interventions urgentes */
.urgent-intervention {
    border-left: 4px solid var(--danger-color) !important;
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.05), transparent) !important;
    animation: urgent-pulse 3s infinite;
}

@keyframes urgent-pulse {
    0%, 100% {
        background: linear-gradient(90deg, rgba(220, 53, 69, 0.05), transparent);
    }
    50% {
        background: linear-gradient(90deg, rgba(220, 53, 69, 0.1), transparent);
    }
}

.urgent-intervention .item-icon {
    border: 2px solid var(--danger-color) !important;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.3);
}

.urgent-intervention .item-title {
    font-weight: 700 !important;
    color: var(--danger-color) !important;
}

.urgent-intervention .downtime-highlight {
    animation: urgent-blink 1.5s infinite;
}

@keyframes urgent-blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.7;
    }
}

/* Styles pour le bouton d'effacement d'historique */
#clear-logical-history-btn {
    margin-left: auto;
    font-size: 12px;
    padding: 6px 12px;
}

#clear-logical-history-btn:hover {
    background-color: var(--danger-color-dark);
}


@media (min-width: 768px) {
    .advanced-filter-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .filter-row {
        flex-wrap: nowrap;
    }
    
    .filter-row .form-group {
        min-width: 160px;
    }
    
    .filter-row .form-group.compact {
        min-width: 120px;
    }
}

@media (max-width: 767px) {
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-row .form-group {
        min-width: auto;
        flex: none;
    }
    
    .filter-row .btn {
        width: 100%;
        margin-top: 8px;
    }
    
    .filter-section-compact {
        padding: 12px;
    }
}


@media (min-width: 992px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr); 
        grid-auto-rows: auto;
    }
     .dashboard-grid > .card {
        display: flex;
        flex-direction: column;
    }

    .network-top-grid { 
        grid-template-columns: 1fr 1fr; 
        align-items: stretch; 
    }
     .parts-top-grid > div, 
     .network-top-grid > div { 
        display: flex; 
        flex-direction: column; 
    }
    .parts-top-grid > div .card, .network-top-grid > div .card { 
        margin-bottom: 15px; 
        flex-grow: 1; 
    }
    .parts-top-grid > div .card:last-child, .network-top-grid > div .card:last-child { 
        margin-bottom: 0; 
    }
    .parts-top-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Responsive pour la page d'accueil */
@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr); 
        grid-auto-rows: auto;
        gap: 20px;
    }
    
    .dashboard-grid > .card {
        display: flex;
        flex-direction: column;
    }
    
    .chart-container-wrapper {
        height: 200px;
    }
}

@media (min-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
    
    .chart-container-wrapper {
        height: 300px;
    }
}

/* Mobile responsive */
@media (max-width: 767px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .chart-container-wrapper {
        height: 150px;
    }
    
    .page-container {
        padding: 10px;
        padding-top: calc(var(--header-height) + 10px);
    }
    
    .card {
        margin-bottom: 15px;
    }
}

/* Ajustements pour les graphiques */
.chart-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
}

/* KPI responsive */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 767px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

/* ===== STYLES AMÉLIORÉS POUR LA GESTION DES RÔLES ===== */

/* Styles améliorés pour la gestion des rôles */
#member-management-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e3f2fd;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#member-management-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

#member-management-card .section-title {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1976d2 100%);
    color: white;
    margin: -15px -15px 0 -15px;
    padding: 20px;
    font-weight: 600;
    font-size: 18px;
    position: relative;
    overflow: hidden;
}

#member-management-card .section-title::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

#member-management-card .section-title i {
    font-size: 20px;
    margin-right: 12px;
    opacity: 0.9;
}

.roles-management-content {
    padding: 20px;
}

.roles-description {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.roles-description p {
    margin: 0;
    color: #424242;
    font-size: 14px;
    line-height: 1.5;
    font-style: italic;
}

#member-roles-list {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 20px;
}

#member-roles-list::-webkit-scrollbar {
    width: 6px;
}

#member-roles-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#member-roles-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

#member-roles-list::-webkit-scrollbar-thumb:hover {
    background: #1976d2;
}

#member-roles-list .list-item {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    margin-bottom: 10px;
    border-radius: 10px;
    padding: 16px 20px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#member-roles-list .list-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

#member-roles-list .list-item:hover {
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%);
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

#member-roles-list .list-item:hover::before {
    transform: scaleY(1);
}

#member-roles-list .list-item:last-child {
    margin-bottom: 0;
}

.roles-actions {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

#update-roles-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1976d2 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
    position: relative;
    overflow: hidden;
}

#update-roles-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#update-roles-btn:hover {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(25, 118, 210, 0.4);
}

#update-roles-btn:hover::before {
    left: 100%;
}

#update-roles-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

#update-roles-btn i {
    margin-right: 8px;
    font-size: 14px;
}

/* Animation d'apparition pour la carte */
#member-management-card {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive pour la gestion des rôles */
@media (max-width: 768px) {
    .roles-management-content {
        padding: 15px;
    }
    
    .roles-description {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    #member-roles-list {
        max-height: 250px;
    }
    
    #member-roles-list .list-item {
        padding: 12px 15px;
    }
    
    #update-roles-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
}

/* ===== STYLES POUR LA PAGINATION DES INTERVENTIONS D'ÉQUIPEMENT ===== */

.interventions-container {
    margin-top: 15px;
}

.interventions-filters {
    margin-bottom: 15px;
}

.filters-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    align-items: end;
}

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

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--white);
    color: var(--text-color);
    transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.filter-group input::placeholder {
    color: var(--light-gray);
    font-style: italic;
}

.pagination-info {
    text-align: center;
    color: var(--light-gray);
    font-size: 14px;
    margin-bottom: 10px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.pagination-controls .btn {
    padding: 8px 16px;
    font-size: 14px;
}

.pagination-controls .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

/* Responsive pour la pagination */
@media (max-width: 768px) {
    .filters-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .pagination-controls .btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Styles pour l'indicateur réseau */
.network-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-right: 8px;
    cursor: pointer;
}

.network-indicator i {
    margin: 0;
}

.network-online {
    background-color: #28a745;
    color: white;
    border: 2px solid #28a745;
}

.network-offline {
    background-color: #dc3545;
    color: white;
    border: 2px solid #dc3545;
}

.network-offline i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Styles pour les interventions hors ligne */
.intervention-offline {
    border-left: 4px solid #ff6b35;
    background-color: #fff3cd;
}

.intervention-offline .item-badge {
    background-color: #ff6b35;
    color: white;
}

.offline-indicator-badge {
    background-color: #ff6b35;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Styles pour les notifications hors ligne */
.offline-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    padding: 12px;
    text-align: center;
    z-index: 10000;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sync-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #28a745, #34ce57);
    color: white;
    padding: 12px;
    text-align: center;
    z-index: 10001;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Mode sombre pour les indicateurs réseau */
[data-theme="dark"] .network-online {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

[data-theme="dark"] .network-offline {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* Indicateur de chargement pour la recherche */
#intervention-search.searching {
    background-color: #f8f9fa;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(10, 102, 194, 0.2);
}

#intervention-search.searching::placeholder {
    color: var(--primary-color);
    font-style: italic;
}

/* Animation de chargement */
@keyframes searchPulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

#intervention-search.searching {
    animation: searchPulse 1.5s ease-in-out infinite;
}

/* ===== STYLES POUR LA FENÊTRE MODALE DE RECHERCHE ===== */

/* Bouton de recherche dans le header */
#search-modal-btn {
    font-size: 20px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--light-gray);
    transition: color 0.2s, transform 0.2s;
    margin-right: 8px;
}

#search-modal-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Panneau de recherche latéral */
#searchModal {
    position: fixed;
    top: 0;
    left: -400px; /* Caché par défaut */
    width: 400px;
    height: 100vh;
    background-color: var(--white);
    border-right: 2px solid var(--border-color);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 100; /* Z-index plus bas pour ne pas bloquer l'interaction */
    transition: left 0.3s ease-in-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#searchModal.active {
    left: 0; /* Visible quand ouvert */
}

.search-modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #f4f2ee; /* Couleur de fond de la page principale */
    max-height: calc(100vh - 20px); /* Prendre en compte les marges */
    margin: 44px 0 10px 0; /* Marge en haut augmentée de ~9mm (44px) */
}

/* Header de la fenêtre modale */
#searchModal .modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1976d2 100%);
    color: white;
    margin: 0;
    padding: 20px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#searchModal .modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

#searchModal .modal-title i {
    font-size: 16px;
    opacity: 0.9;
}

#searchModal .close-modal {
    color: white;
    font-size: 20px;
    opacity: 0.8;
    transition: opacity 0.2s, background-color 0.2s;
    background: none;
    border: none;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
}

#searchModal .close-modal:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
}

/* Corps du panneau de recherche */
#searchModalBody {
    flex: 1;
    padding: 0;
    background-color: #f4f2ee; /* Couleur de fond de la page principale */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important pour le flex */
}

/* Conteneur scrollable pour le contenu */
.search-modal-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
    min-height: 0; /* Important pour le flex */
    max-height: calc(100vh - 180px); /* Prendre en compte header + actions + marges */
}

/* Améliorer le scroll */
.search-modal-content-wrapper::-webkit-scrollbar {
    width: 6px;
}

.search-modal-content-wrapper::-webkit-scrollbar-track {
    background: var(--light-gray);
}

.search-modal-content-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.search-modal-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Styles pour le contenu de recherche */
.search-modal-section {
    margin-bottom: 15px;
    padding: 15px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-modal-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-color);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-modal-section h4 i {
    color: var(--primary-color);
}

.search-modal-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-modal-filter-row {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

.search-modal-filter-row .form-group {
    flex: 1;
    min-width: 120px;
}

.search-modal-filter-row .form-group.compact {
    min-width: 100px;
}


.search-modal-search-bar {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: var(--white);
}

.search-modal-search-bar:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 15px 20px;
    background-color: var(--white);
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.search-modal-actions .btn {
    min-width: 100px;
    flex: 1;
}

/* Ajustement du contenu principal quand le panneau est ouvert */
body.search-panel-open .page-container {
    margin-left: 400px;
    width: calc(100vw - 400px);
    max-width: calc(100vw - 400px);
    transition: margin-left 0.3s ease-in-out;
    overflow-x: hidden;
}

/* Ajustement des graphiques quand le panneau de recherche est ouvert */
body.search-panel-open .dashboard-grid {
    width: calc(100vw - 420px);
    max-width: calc(100vw - 420px);
    transition: width 0.3s ease-in-out;
    overflow: hidden;
    padding-right: 20px;
    box-sizing: border-box;
}

body.search-panel-open .chart-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

body.search-panel-open .chart-container canvas {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
}

/* Ajustement des conteneurs de graphiques spécifiques */
body.search-panel-open .chart-container-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

body.search-panel-open .card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    margin-right: 0;
}

/* Marge de sécurité pour éviter tout débordement */
body.search-panel-open {
    overflow-x: hidden;
}

body.search-panel-open .page-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Forcer le redimensionnement des graphiques Chart.js */
body.search-panel-open .chart-container {
    position: relative;
    height: 300px;
}

body.search-panel-open .chart-container canvas {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Overlay pour mobile - seulement sur mobile */
.search-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

/* Sur desktop, pas d'overlay - les deux panneaux restent actifs */
@media (min-width: 769px) {
    .search-panel-overlay {
        display: none !important;
    }
}

/* Sur mobile, afficher l'overlay seulement quand nécessaire */
@media (max-width: 768px) {
    body.search-panel-open .search-panel-overlay {
        display: block;
    }
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    #searchModal {
        width: 100%;
        left: -100%;
        z-index: 1001; /* Z-index plus élevé que l'overlay */
    }
    
    #searchModal.active {
        left: 0;
    }
    
    body.search-panel-open .page-container {
        margin-left: 0;
    }
    
    /* Sur mobile, pas d'overlay sombre qui bloque */
    .search-panel-overlay {
        display: none !important;
    }
    
    /* Ajuster le contenu du panneau pour mobile */
    .search-modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .search-modal-content-wrapper {
        padding: 15px;
        max-height: calc(100vh - 120px);
    }
}

.search-modal-section:last-child {
    margin-bottom: 0;
}

.search-modal-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--light-bg);
}

.search-modal-section h4 i {
    color: var(--primary-color);
    font-size: 14px;
}

/* Barre de recherche dans la modale */
.search-modal-search-bar {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    background-color: var(--white);
    color: var(--dark-gray);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-modal-search-bar:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.2);
}

/* Filtres dans la modale */
.search-modal-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.search-modal-filter-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.search-modal-filter-row .form-group {
    flex: 1;
    min-width: 150px;
}

.search-modal-filter-row .form-group.compact {
    flex: 0 0 auto;
    min-width: 120px;
}

.search-modal-filter-row .btn {
    height: 36px;
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
}

/* Actions de la modale */
.search-modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.search-modal-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
}

/* Responsive pour la modale de recherche */
@media (max-width: 768px) {
    .search-modal-content {
        width: 98%;
        max-height: 95vh;
    }
    
    #searchModalBody {
        padding: 20px;
        max-height: calc(95vh - 70px);
    }
    
    .search-modal-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-modal-filter-row .form-group {
        min-width: auto;
    }
    
    .search-modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-modal-actions .btn {
        width: 100%;
    }
}

/* Animation d'apparition pour la modale */
#searchModal {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


