html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden; /* Hides the scrollbar */
}

#side-panel {
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 15px;
    position: relative; /* Ajout de position relative pour le positionnement absolu des enfants */
}

#map-container {
    height: calc(100vh - 60px);
    margin-top: 3rem;
    padding-right: 30px;
    padding-left: 30px;
    position: relative; /* Ensure the button is positioned relative to the map */
    background-color: white;
}

#map {
    height: 100%;
    border-radius: 20px;
}

#nav-bar {
    height: 50px;
}

/* Styles pour le logo responsive dans la navbar */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.navbar-logo {
    height: 30px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    transition: all 0.3s ease;
}

/* Responsive pour le logo */
@media (max-width: 576px) {
    .navbar-brand {
        gap: 0.25rem;
    }

    .navbar-brand span {
        font-size: 0.9rem;
    }

    .navbar-logo {
        height: 25px;
        max-width: 80px;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .navbar-logo {
        height: 28px;
        max-width: 100px;
    }
}

@media (min-width: 769px) {
    .navbar-logo {
        height: 30px;
        max-width: 120px;
    }
}

/* Styles pour le bouton burger responsive */
.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
    background-color: transparent;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: none;
}

.navbar-toggler:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Responsive pour le bouton burger */
@media (max-width: 576px) {
    .navbar-toggler {
        padding: 0.2rem 0.4rem;
        font-size: 1.1rem;
        margin-right: 0.5rem;
    }

    .navbar-toggler-icon {
        width: 1.1em;
        height: 1.1em;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        font-size: 1.2rem;
        margin-right: 0.75rem;
    }

    /* Ajustements pour tablettes */
    .navbar-brand {
        flex-shrink: 1;
        min-width: 0;
    }

    .navbar-brand span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .navbar-toggler {
        flex-shrink: 0;
        margin-left: auto;
    }
}

/* Ajustement de l'espacement de la navbar sur mobile */
@media (max-width: 576px) {
    #nav-bar .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Ajustements spécifiques pour éviter le débordement */
    #nav-bar {
        min-height: 50px;
        max-height: 50px;
        overflow: hidden;
    }

    .navbar-brand {
        flex-shrink: 1;
        min-width: 0;
    }

    .navbar-brand span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .navbar-toggler {
        flex-shrink: 0;
        margin-left: auto;
    }
}

/* Carré pour faire la ligne multicolor */
.square {
    width: 15%;
    height: 15px;
    margin: 0px;
    display: inline-block;
}

#chartdiv_sensor {
    width: 100%;
    height: 35vh;
    max-width: 100%;
    min-height: 250px;
    position: relative;
    overflow: hidden;
}

#div_button_seuils_ {
    position: absolute;
    left: 50%;
    transform: translateX(
        -50%
    ); /* Adjust position to fully center the button */
    background-color: transparent;

    bottom: 15px;
    z-index: 1000;
}

#btn_default {
    background-color: #999999;
    color: black;
}

#btn_bon {
    background-color: #4ff0e6;
    color: black;
}

#btn_moyen {
    background-color: #51ccaa;
    color: black;
}

#btn_degrade {
    background-color: #ede663;
    color: black;
}

#btn_mauvais {
    background-color: #ed5e58;
    color: white;
}

#btn_tresMauvais {
    background-color: #881b33;
    color: white;
}

#btn_extrMauvais {
    background-color: #74287d;
    color: white;
}

/* Animation pour le marqueur */
.marker-selected {
    animation: glow 1.5s ease-in-out infinite;
}

@keyframes glow {
    0% {
        filter: brightness(100%) drop-shadow(0 0 5px rgba(0, 255, 255, 0.5)); /* Bleu clair / Turquoise */
    }
    25% {
        filter: brightness(120%) drop-shadow(0 0 15px rgba(0, 255, 255, 0.8)); /* Intensification légère du bleu */
    }
    50% {
        filter: brightness(130%) drop-shadow(0 0 25px rgba(0, 255, 255, 1)); /* Un bleu plus fort */
    }
    75% {
        filter: brightness(120%) drop-shadow(0 0 15px rgba(0, 255, 255, 0.8)); /* Décrue */
    }
    100% {
        filter: brightness(100%) drop-shadow(0 0 5px rgba(0, 255, 255, 0.5)); /* Retour à la normale */
    }
}
/* Style pour l'encart info station/device */
#device-info {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    max-width: 300px;
}

@media (max-width: 576px) {
    #device-info {
        width: 100%;
        max-width: 100%;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 0;
    }

    #map-container {
        padding-right: 10px;
        padding-left: 10px;
        margin-top: 40px;
    }

    #map {
        border-radius: 10px;
    }

    #side-panel {
        padding: 10px;
    }

    .card {
        margin-bottom: 10px;
    }

    .card-body {
        padding: 10px;
    }

    #chartdiv_sensor {
        height: 50vh;
        min-height: 200px;
    }

    .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .form-control {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .btn-group {
        gap: 3px;
    }

    .btn-group label[for='btn_historique_'],
    .btn-group label[for='btn_pasDeTemps_'] {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .text-center.mt-2 .d-flex {
        flex-direction: column;
        gap: 10px;
    }

    #togglePollutants,
    #toggleYAxisCapping {
        width: 100%;
        justify-content: center;
    }

    #yAxisMaxValue {
        width: 100%;
    }

    #btn_polluants,
    .btn-group[role='group'] {
        gap: 0.375rem;
        padding: 0.5rem;
    }

    #btn_polluants .btn,
    .btn-group[role='group'] .btn {
        min-width: 7rem;
        padding: 0.375rem 0.5rem;
        font-size: 0.8125rem;
    }

    #div_button_seuils_ {
        gap: 0.125rem;
        padding: 0.375rem;
    }

    #div_button_seuils_ .btn {
        min-width: 5rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    #device-info {
        max-width: 80%;
        right: 10%;
    }

    #map-container {
        padding-right: 20px;
        padding-left: 20px;
    }

    #side-panel {
        padding: 12px;
    }

    #chartdiv_sensor {
        height: 40vh;
        min-height: 220px;
    }

    .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    .form-control {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }

    .btn-group label[for='btn_historique_'],
    .btn-group label[for='btn_pasDeTemps_'] {
        font-size: 0.8rem;
        padding: 0.25rem 0.45rem;
    }

    #btn_polluants,
    .btn-group[role='group'] {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    }
}

/* Styles pour les boutons et contrôles */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.form-control {
    font-size: 0.875rem;
}

/* Style pour les labels descriptifs */
.btn-group-title {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    margin-right: 0.25rem;
    color: #495057;
    font-weight: 600;
    font-size: 0.75rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

/* Styles harmonisés pour les boutons d'historique et de pas de temps */
.btn-group.btn-group-sm[role='group'] {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.375rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    margin: 0.25rem 0;
}

.btn-group.btn-group-sm[role='group'] .btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.btn-group.btn-group-sm[role='group'] .btn {
    position: relative;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #0074d9;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    min-width: 2.5rem;
    text-align: center;
    line-height: 1.2;
}

.btn-group.btn-group-sm[role='group'] .btn:hover {
    background-color: #f1f3f5;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-group.btn-group-sm[role='group'] .btn-check:checked + .btn {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
    box-shadow: 0 1px 1px rgba(13, 110, 253, 0.2);
}

.btn-group.btn-group-sm[role='group'] .btn-check:checked + .btn:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
    box-shadow: 0 1px 2px rgba(13, 110, 253, 0.3);
}

/* Styles responsifs pour les boutons */
@media (max-width: 576px) {
    .btn-group.btn-group-sm[role='group'] {
        padding: 0.25rem;
        gap: 0.15rem;
    }

    .btn-group.btn-group-sm[role='group'] .btn {
        padding: 0.15rem 0.35rem;
        font-size: 0.7rem;
        min-width: 2rem;
    }

    .btn-group-title {
        padding: 0.15rem 0.35rem;
        font-size: 0.7rem;
        margin-right: 0.15rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .btn-group.btn-group-sm[role='group'] {
        padding: 0.3rem;
        gap: 0.2rem;
    }

    .btn-group.btn-group-sm[role='group'] .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.725rem;
        min-width: 2.25rem;
    }

    .btn-group-title {
        padding: 0.2rem 0.4rem;
        font-size: 0.725rem;
        margin-right: 0.2rem;
    }
}

/* Styles pour le mode plein écran du side panel */
#side-panel.expanded {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1000;
    background-color: white;
    overflow-y: auto;
    display: block !important;
    padding: 20px;
}

#map-container.map-collapsed {
    display: none !important;
}

/* Styles pour le panneau latéral en mode normal */
#side-panel:not(.expanded) {
    display: block;
    position: relative;
    height: calc(100vh - 60px);
    overflow-y: auto;
    background-color: white;
    padding: 20px;
}

/* Styles pour le conteneur de la carte en mode normal */
#map-container:not(.map-collapsed) {
    display: block;
    height: calc(100vh - 60px);
    position: relative;
}

@media (max-width: 768px) {
    #side-panel #toggleSidePanel {
        display: none;
    }
}

/* Styles pour les notifications */
.custom-toast {
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    font-family:
        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
        Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;
    font-size: 14px !important;
    margin: 1rem auto !important;
    max-width: 90% !important;
    width: auto !important;
    padding: 1.25rem !important;
    line-height: 1.5 !important;
    backdrop-filter: blur(8px) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #2c3e50 !important;
}

.custom-toast .swal2-title {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.75rem !important;
    color: #2c3e50 !important;
    line-height: 1.4 !important;
    padding: 0 !important;
}

.custom-toast-refwarning .swal2-html-container {
    margin: 0.25rem 0 !important;       /* réduit fortement l’espace vertical */
    color: #7f8c8d !important;          /* gris plus doux */
    line-height: 1.2 !important;        /* texte plus compact */
    font-size: 0.85rem !important;      /* texte plus petit */
    padding: 0.25rem 0.5rem !important; /* moins d’espace intérieur */
    min-height: auto !important;        /* pas de hauteur imposée */
}

/* On réduit aussi le padding global du popup */
.custom-toast-refwarning.swal2-popup.swal2-toast {
    padding: 0.25rem 0.5rem !important;
    box-shadow: none !important;       /* moins de relief, plus discret */
    background: rgba(255, 159, 67, 0.1) !important; /* fond très léger */
}


/* Styles responsifs pour les toasts */
@media (max-width: 768px) {
    .custom-toast {
        font-size: 13px !important;
        padding: 1rem !important;
        margin: 0.75rem auto !important;
        border-radius: 12px !important;
        max-width: 85% !important;
    }

    .custom-toast .swal2-title {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    .custom-toast .swal2-html-container {
        margin: 0.5rem 0 !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    .custom-toast {
        font-size: 12px !important;
        padding: 0.75rem !important;
        margin: 0.5rem auto !important;
        max-width: 92% !important;
        border-radius: 10px !important;
    }

    .custom-toast .swal2-title {
        font-size: 0.95rem !important;
        margin-bottom: 0.375rem !important;
    }

    .custom-toast .swal2-html-container {
        margin: 0.375rem 0 !important;
        font-size: 0.85rem !important;
    }

    /* Suppression des marges par défaut de SweetAlert2 */
    .swal2-popup {
        padding: 0 !important;
        margin: 0 !important;
    }

    .swal2-actions {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Animation pour l'apparition des notifications */
.swal2-show {
    animation: slideInDown 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

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

/* Styles spécifiques pour les différents types de toasts */
.custom-toast.swal2-icon-success {
    background: rgba(46, 213, 115, 0.95) !important;
    border-color: rgba(46, 213, 115, 0.2) !important;
    color: white !important;
}

.custom-toast.swal2-icon-success .swal2-title,
.custom-toast.swal2-icon-success .swal2-html-container {
    color: white !important;
}

.custom-toast.swal2-icon-error {
    background: rgba(255, 71, 87, 0.95) !important;
    border-color: rgba(255, 71, 87, 0.2) !important;
    color: white !important;
}

.custom-toast.swal2-icon-error .swal2-title,
.custom-toast.swal2-icon-error .swal2-html-container {
    color: white !important;
}

.custom-toast.swal2-icon-warning {
    background: rgba(255, 159, 67, 0.95) !important;
    border-color: rgba(255, 159, 67, 0.2) !important;
    color: #2c3e50 !important;
}

.custom-toast.swal2-icon-warning .swal2-title,
.custom-toast.swal2-icon-warning .swal2-html-container {
    color: #2c3e50 !important;
}

.custom-toast.swal2-icon-info {
    background: rgba(52, 152, 219, 0.95) !important;
    border-color: rgba(52, 152, 219, 0.2) !important;
    color: white !important;
}

.custom-toast.swal2-icon-info .swal2-title,
.custom-toast.swal2-icon-info .swal2-html-container {
    color: white !important;
}

/* Icônes des toasts */
.custom-toast .swal2-icon {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
}

.custom-toast .swal2-icon::before {
    display: none !important;
}

.custom-toast .swal2-icon::after {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* Styles modernes pour les boutons de polluants */
#btn_polluants {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    margin: 0.75rem auto;
    max-width: 100%;
}

#btn_polluants .btn {
    position: relative;
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #0074d9;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    min-width: 3.5rem;
    text-align: center;
    line-height: 1.2;
}

#btn_polluants .btn:hover {
    background-color: #f1f3f5;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#btn_polluants .btn-check:checked + .btn {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
    box-shadow: 0 1px 1px rgba(13, 110, 253, 0.2);
}

#btn_polluants .btn-check:checked + .btn:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
    box-shadow: 0 1px 2px rgba(13, 110, 253, 0.3);
}

/* Ajustements responsifs pour les boutons de polluants */
@media (max-width: 576px) {
    #btn_polluants {
        padding: 0.375rem;
        gap: 0.25rem;
        margin: 0.5rem auto;
    }

    #btn_polluants .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
        min-width: 3rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    #btn_polluants {
        padding: 0.45rem;
        gap: 0.3rem;
        margin: 0.6rem auto;
    }

    #btn_polluants .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.85rem;
        min-width: 3.25rem;
    }
}

/* Styles pour les contrôles du graphique */
.text-center.mt-2 {
    margin-bottom: 15px;
}

.text-center.mt-2 .d-flex {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

/* Styles pour les groupes de boutons sous le graphique */
.text-center .btn-group.btn-group-sm[role='group'] {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    margin: 0.5rem auto;
    max-width: 100%;
}

.text-center .btn-group-title {
    margin-right: 0.5rem;
}

/* Ajustements responsifs */
@media (max-width: 576px) {
    .text-center .btn-group.btn-group-sm[role='group'] {
        padding: 0.25rem;
        gap: 0.15rem;
        margin: 0.35rem auto;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .text-center .btn-group.btn-group-sm[role='group'] {
        padding: 0.3rem;
        gap: 0.2rem;
        margin: 0.4rem auto;
    }
}

#togglePollutants {
    background-color: transparent;
    border: 1px solid #dee2e6;
    color: #0074d9;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 8px;
}

#togglePollutants:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

#togglePollutants i {
    transition: transform 0.2s ease-in-out;
}

#togglePollutants[aria-expanded='true'] i {
    transform: rotate(180deg);
}

/* Styles pour le groupe de boutons de capping de l'axe Y */
.btn-group[role='group'] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
}

#toggleYAxisCapping {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: transparent;
    border: 1px solid #dee2e6;
    color: #0074d9;
    transition: all 0.2s ease-in-out;
}

#toggleYAxisCapping:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

#yAxisMaxValue {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease-in-out;
}

#toggleYAxisCapping.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

#yAxisMaxValue:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

#yAxisMaxValue:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    outline: none;
}

/* Style pour le bouton de plage de dates */
[data-bs-toggle='collapse'] {
    background-color: transparent;
    border: 1px solid #dee2e6;
    color: #0074d9;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    margin: 10px 0;
}

[data-bs-toggle='collapse']:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #0074d9;
}

[data-bs-toggle='collapse'] i {
    margin-right: 8px;
    transition: transform 0.2s ease-in-out;
}

[data-bs-toggle='collapse'][aria-expanded='true'] i {
    transform: rotate(180deg);
}

/* Style moderne pour le formulaire de plage de dates */
#dateRangeForm {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 116, 217, 0.1);
}

#dateRangeForm .form-label {
    color: #495057;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

#dateRangeForm .form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 15px;
    transition: all 0.3s ease;
    color: #495057;
    font-size: 0.95rem;
    background-color: #f8f9fa;
}

#dateRangeForm .form-control:hover {
    border-color: #0074d9;
    background-color: #ffffff;
}

#dateRangeForm .form-control:focus {
    border-color: #0074d9;
    box-shadow: 0 0 0 3px rgba(0, 116, 217, 0.15);
    background-color: #ffffff;
}

#dateRangeForm .form-control::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#dateRangeForm .form-control::-webkit-calendar-picker-indicator:hover {
    filter: invert(0.3);
    background-color: #f8f9fa;
}

#apply_date_range {
    margin-top: 15px;
    padding: 8px 16px;
    font-weight: 500;
    background-color: #ffffff;
    border: 1px solid #0074d9;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #0074d9;
    font-size: 0.85rem;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 120px;
    box-shadow: 0 1px 2px rgba(0, 116, 217, 0.1);
}

#apply_date_range:hover {
    background-color: #0074d9;
    border-color: #0074d9;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 116, 217, 0.15);
}

#apply_date_range:active {
    transform: translateY(0);
    background-color: #0063b1;
    border-color: #0063b1;
    box-shadow: 0 1px 2px rgba(0, 116, 217, 0.1);
}

#apply_date_range i {
    font-size: 0.9rem;
    color: inherit;
}

/* Style pour le conteneur des dates */
#dateRangeForm .row {
    margin: 0 -10px;
}

#dateRangeForm .col-md-6 {
    padding: 0 10px;
}

/* Animation pour l'ouverture du formulaire */
#dateRangeForm.collapse {
    transition: all 0.3s ease-in-out;
}

#dateRangeForm.collapsing {
    transition: all 0.3s ease-in-out;
}

/* Styles pour les boutons de contrôle du side panel */
#toggleSidePanel,
#collapseSidePanel {
    position: fixed !important;
    background-color: white !important;
    border: none !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
    padding: 8px 12px !important;
    border-radius: 50% !important;
    z-index: 9999 !important;
    display: block !important;
    width: 40px !important;
    height: 40px !important;
    line-height: 1 !important;
    text-align: center !important;
}

#toggleSidePanel {
    left: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

#collapseSidePanel {
    left: 20px !important;
    top: calc(50% + 50px) !important;
    transform: translateY(-50%) !important;
}

/* Quand le side panel est ouvert */
body.side-panel-open #toggleSidePanel,
body.side-panel-open #collapseSidePanel {
    left: calc(
        41.666667% + 20px
    ) !important; /* col-lg-5 (41.666667%) + marge */
}

#toggleSidePanel i,
#collapseSidePanel i {
    font-size: 1.2rem !important;
    color: #0d6efd !important;
    line-height: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

#toggleSidePanel:hover,
#collapseSidePanel:hover {
    background-color: #f8f9fa !important;
    transform: translateY(-50%) scale(1.1) !important;
}

#toggleSidePanel:active,
#collapseSidePanel:active {
    transform: translateY(-50%) scale(0.95) !important;
}

/* Ajuster la visibilité des boutons sur mobile */
@media (max-width: 768px) {
    #toggleSidePanel {
        display: none !important;
    }

    #collapseSidePanel {
        display: block !important;
    }
}

/* Styles pour les boutons de seuils de la carte */
#div_button_seuils_ {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
}

#div_button_seuils_ .btn {
    flex: 0 1 auto;
    min-width: 6rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    border-radius: 0.25rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: default;
}

/* Signalair */
.signalair-draggable {
    position: absolute;
    top: 100px;
    left: 100px;
    z-index: 9999;
    width: 320px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

.signalair-draggable .drag-header {
    background-color: #f7f7f7;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.signalair-draggable .close-btn {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #888;
    transition: color 0.2s ease;
}

.signalair-draggable .close-btn:hover {
    color: #000;
}

.signalair-draggable .drag-content {
    padding: 16px;
    font-size: 14px;
    color: #333;
}

.signalair-draggable .drag-content p {
    margin: 8px 0;
    line-height: 1.4;
}

.signalair-draggable .drag-content p a {
    color: #2563eb; /* Bleu moderne (inspiré de Tailwind) */
    text-decoration: none;
    font-weight: 500;
    transition:
        color 0.2s ease,
        text-decoration 0.2s ease;
}

.signalair-draggable .drag-content p a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.signalair-draggable .drag-content p a:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4); /* halo bleu */
    border-radius: 4px;
}

/* Styles pour la fenêtre popup Sensor.Community */
#sensor-community-popup {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease;
}

#sensor-community-popup:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#sensor-community-popup .header {
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    padding: 10px 15px;
    border-bottom: 1px solid #dee2e6;
}

#sensor-community-popup .close-button {
    color: #6c757d;
    transition: color 0.2s ease;
}

#sensor-community-popup .close-button:hover {
    color: #dc3545;
}

#sensor-community-popup .chart-container {
    padding: 15px;
}
.table .btn-group {
    display: flex;
    flex-direction: row;
    gap: 2px;
}
.table .btn-group .btn {
    flex: 1;
    white-space: nowrap;
}
.time-buttons-group {
    display: flex !important;
    flex-direction: row !important;
    gap: 2px;
    width: 100%;
}
.time-buttons-group .btn {
    flex: 1;
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: default;
}
#button_horloge {
    cursor: default;
}

#button_horloge:hover {
    background-color: inherit;
    color: inherit;
}

/* Style personnalisé pour les boutons avec la couleur #0074D9 */
.btn-custom-blue {
    background-color: #0074d9 !important;
    border-color: #0074d9 !important;
    color: white !important;
}

.btn-custom-blue:hover {
    background-color: #0063b1 !important;
    border-color: #0063b1 !important;
    color: white !important;
}

/* Style personnalisé pour les boutons outline avec la couleur #0074D9 */
.btn-outline-custom-blue {
    background-color: transparent !important;
    border-color: #0074d9 !important;
    color: #0074d9 !important;
}

.btn-outline-custom-blue:hover {
    background-color: #0074d9 !important;
    border-color: #0074d9 !important;
    color: white !important;
}

/* Styles pour la légende des seuils */
.legend-seuils {
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    font-size: 12px;
    line-height: 18px;
    color: #333;
}

.legend-seuils i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}

/* Media query pour les petits écrans */
@media (max-width: 768px) {
    #div_button_seuils_ {
        display: none;
    }

    .legend-seuils {
        display: block;
    }
}

/* Media query pour les grands écrans */
@media (min-width: 769px) {
    .legend-seuils {
        display: none;
    }
}

/* Styles pour le bouton de fermeture mobile */
#closeSidePanelMobile {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1200;
    background-color: white;
    border: 2px solid #6c757d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    padding: 10px 12px;
    border-radius: 50%;
    display: none;
    /* Améliorations pour Safari iOS */
    -webkit-appearance: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    cursor: pointer;
}

#closeSidePanelMobile:hover {
    background-color: #f8f9fa;
    border-color: #495057;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
}

#closeSidePanelMobile:active {
    transform: scale(0.95);
}

/* Styles spécifiques pour Safari iOS */
@supports (-webkit-touch-callout: none) {
    #closeSidePanelMobile {
        /* Optimisations spécifiques pour iOS */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }

    #closeSidePanelMobile:active {
        -webkit-transform: scale(0.95) translateZ(0);
        transform: scale(0.95) translateZ(0);
    }
}

/* Styles spécifiques pour le panneau mobile */
.mobile-side-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 9999 !important; /* Z-index très élevé */
    background-color: white !important;
    overflow-y: auto !important;
    padding: 20px 15px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    /* Optimisations pour Safari iOS */
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* Styles spécifiques pour Safari iOS */
@supports (-webkit-touch-callout: none) {
    .mobile-side-panel {
        /* Optimisations spécifiques pour iOS */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
        /* Éviter les problèmes de scroll sur iOS */
        -webkit-overflow-scrolling: touch;
        /* Forcer le rendu matériel */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Améliorations pour le side panel sur mobile */
@media (max-width: 576px) {
    #side-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        z-index: 9999 !important; /* Z-index très élevé */
        background-color: white !important;
        overflow-y: auto !important;
        padding: 20px 15px !important;
        margin-top: 0 !important;
        /* Optimisations pour Safari iOS */
        -webkit-overflow-scrolling: touch;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }

    #side-panel .row {
        margin-top: 60px; /* Espace pour la navbar */
    }

    /* Masquer les boutons complexes sur mobile */
    #toggleSidePanel,
    #collapseSidePanel,
    #reduceSidePanel {
        display: none !important;
    }

    /* Afficher le bouton de fermeture mobile quand le panneau est ouvert */
    #closeSidePanelMobile {
        display: block !important;
        position: fixed !important;
        top: 80px !important;
        right: 20px !important;
        z-index: 1200 !important;
    }

    /* Améliorer l'espacement des cartes sur mobile */
    #side-panel .card {
        margin-bottom: 15px;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    #side-panel .card-body {
        padding: 15px;
    }

    /* Ajuster la hauteur du graphique sur mobile */
    #chartdiv_sensor {
        height: 40vh;
        min-height: 250px;
    }

    /* Améliorer la lisibilité des boutons sur mobile */
    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .btn-group-title {
        font-size: 0.8rem;
        font-weight: 600;
    }
}

/* Styles pour les écrans moyens (tablettes) */
@media (min-width: 577px) and (max-width: 768px) {
    #closeSidePanelMobile {
        display: none !important;
    }

    #side-panel {
        padding: 15px;
    }

    #chartdiv_sensor {
        height: 35vh;
        min-height: 250px;
    }
}

/* Masquer le bouton de fermeture mobile sur desktop */
@media (min-width: 769px) {
    #closeSidePanelMobile {
        display: none !important;
    }
}
