/* Appliquer box-sizing à tous les éléments */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Importation des polices */
@font-face {
    font-family: 'Ubuntu-Regular';
    src: url('../fonts/Ubuntu-Regular.ttf') format('truetype');
}

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

/* Styles globaux */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f3 100%);
    font-family: 'Poppins', 'Ubuntu-Regular', Arial, sans-serif;
    overflow: hidden;
}

/* Styles pour les nœuds et les liens du graphe */
.node {
    stroke: #fff;
    stroke-width: 3px;
    transition: all 0.3s ease;
}

.node:hover {
    stroke-width: 4px;
    filter: brightness(1.2);
}

.link {
    stroke-opacity: 0.8;
    stroke-width: 3px;
    transition: all 0.3s ease;
}

.link:hover {
    stroke-opacity: 1;
    stroke-width: 4px;
}

.label {
    font-family: 'Poppins', sans-serif !important;
    font-size: 13px;
    fill: #1a1a1a;
    font-weight: 600;
    letter-spacing: 0.3px;
    paint-order: stroke;
    stroke: #ffffff;
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.label:hover {
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

/* Style pour les labels des stations du chemin sélectionné */
.label.highlighted {
    font-weight: 700;
    font-size: 14px;
    fill: #000000;
}

label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    display: block;
}

/* Conteneur d'autocomplétion */
.autocomplete-container {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}

/* Styles des champs de saisie */
input {
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    width: 100%;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

input:focus {
    border-color: #3498db;
    box-shadow: 0 2px 12px rgba(52, 152, 219, 0.15);
    outline: none;
}

/* Styles des boutons */
button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#clear {
    background-color: #e74c3c;
}

#clear:hover {
    background-color: #c0392b;
}

#search {
    background-color: #2ecc71;
    margin-bottom: 10px;
}

#search:hover {
    background-color: #27ae60;
}

#acpm {
    background-color: #34495e;
    margin-top: 5px;
}

#acpm:hover {
    background-color: #2c3e50;
}

/* Styles pour la liste des suggestions */
.suggestions {
    list-style: none;
    margin: 0;
    padding: 5px 0;
    background: rgba(255, 255, 255, 0.98);
    position: absolute;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    border: 1px solid #e1e8ed;
}

.suggestions li {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.suggestions li:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

/* Styles pour le menu */
.menu {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 500px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    border-radius: 15px;
    color: #2c3e50;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.9);
}

/* Styles pour le conteneur des résultats */
.results-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    display: none;
    overflow-y: auto;
    max-height: 400px;
    opacity: 0;
    transition: all 0.4s ease;
    margin-top: 15px;
}

.results-container.show {
    display: block;
    opacity: 1;
}

.acpm-container {
    background-color: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 10px;
    margin-top: 15px;
    display: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.acpm-container.show {
    display: block;
}

.acpm-container p {
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
    margin: 0;
}

#acpm-weight {
    font-weight: bold;
    color: #e74c3c;
}

/* Styles pour la liste des résultats */
.result-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Styles pour chaque élément de résultat */
.result-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid #e1e8ed;
    gap: 15px;
}

.result-item:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Styles pour le badge de la ligne */
.line-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    border-radius: 50%;
    color: #fff;
    font-weight: bold;
    text-align: center;
    flex-shrink: 0;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Styles pour les informations sur les arrêts */
.station-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 10px;
    min-width: 0;
}

/* Style pour la station de départ */
.station-start {
    font-size: 15px;
    color: #2c3e50;
}

/* Style pour l'instruction */
.instruction {
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.5;
    width: 100%;
    margin-bottom: 8px;
}

/* Style pour le temps de trajet */
.time-info {
    font-weight: 500;
    color: #3498db;
    font-size: 14px;
    margin-top: 4px;
}

/* Style pour le total des résultats */
.result-total {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    border: 1px solid #e1e8ed;
    list-style: none;
}

/* Suppression du pseudo-élément before */
.result-total::before {
    content: none;
}

/* Conteneur du graphe */
.graph-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f3 100%);
}

/* Style pour le SVG */
.graph-container svg {
    cursor: default;
}

/* Style pour le SVG pendant le déplacement */
.graph-container svg.grabbing {
    cursor: grabbing;
}

/* Style pour les zones interactives */
.node-group, .label-group {
    cursor: pointer;
}

/* Style pour les liens ACPM */
.acpm-link {
    stroke: #e74c3c !important;
    stroke-width: 3px !important;
    stroke-opacity: 0.8 !important;
    transition: all 0.3s ease;
}

.acpm-link:hover {
    stroke-opacity: 1 !important;
    stroke-width: 4px !important;
}

/* Style pour les suggestions actives */
#start-suggestions li.active,
#end-suggestions li.active {
    background-color: #f1f8ff;
    color: #3498db;
}

/* Style pour le conteneur des boutons d'action */
.action-buttons-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    margin-bottom: 10px;
}

.action-buttons-container button {
    flex: 1;
    margin-bottom: 0;
}

/* Responsive design */
@media (max-width: 600px) {
    .menu {
        width: 95%;
        left: 50%;
        transform: translateX(-50%);
        max-height: 80vh;
        padding: 20px;
    }

    /* Rendre le bouton de recherche plus large sur mobile mais avec style cohérent */
    #search {
        width: 100%; /* Utiliser la même largeur que les autres boutons */
        margin-left: 0; /* Supprimer le décalage */
        border-radius: 8px; /* S'assurer que les bords sont arrondis */
        margin-bottom: 10px;
    }

    /* Superposer les boutons Effacer et ACPM sur mobile */
    .action-buttons-container {
        flex-direction: column;
        gap: 8px;
    }

    /* Ajuster la taille du texte pour le bouton de menu mobile */
    .show-menu-btn {
        font-size: 12px !important; /* Réduire la taille du texte pour éviter le débordement */
        padding: 8px 12px !important; /* Ajuster le padding pour une meilleure apparence */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px !important;
    }

    .clear-route-btn, .show-details-btn {
        position: fixed !important;
        bottom: 16px !important;
        left: 16px !important;
        transform: none !important;
        border-radius: 40px !important;
        z-index: 1002;
        margin-bottom: 0 !important;
        min-width: 90px;
        max-width: 120px;
        height: 36px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    .clear-route-btn {
        font-size: 11px !important;
        padding: 7px 10px !important;
        left: 16px !important;
    }
    .show-details-btn {
        font-size: 12px !important;
        padding: 7px 10px !important;
        left: calc(16px + 120px + 8px) !important;
        /* 120px largeur max du bouton effacer + 8px d'espace */
        background-color: #3498db !important;
        color: #fff !important;
        box-shadow: 0 3px 10px rgba(0,0,0,0.18) !important;
    }
    .reset-view-btn {
        position: fixed !important;
        left: 16px !important;
        top: 16px !important;
        bottom: auto !important;
        right: auto !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 30px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        line-height: 1 !important;
        background-color: #3498db !important;
        color: #fff !important;
        box-shadow: 0 3px 10px rgba(0,0,0,0.18) !important;
        z-index: 1003;
    }
    .reset-view-btn svg, .reset-view-btn span, .reset-view-btn i {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        font-size: 32px !important;
    }
    .trip-details-panel .close-details-btn {
        position: fixed !important;
        top: 18px !important;
        right: 18px !important;
        z-index: 2000 !important;
        background: #fff !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
        border-radius: 50% !important;
        width: 36px !important;
        height: 36px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 22px !important;
        opacity: 1 !important;
    }
    .trip-details-panel:not(.visible) .close-details-btn {
        display: none !important;
    }
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}