/* Styles généraux */
@import url('https://fonts.googleapis.com/css2?family=Alata&family=Bebas+Neue&family=Gabarito&display=swap');



body {
    font-family: 'Alata', sans-serif;
    margin: 12px;
    padding: 0;
}

/* Conteneur principal pour aligner recherche et bouton */
#search-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

#search-container > *:last-child {
    margin-right: 0;
}

#search-container a{
    font-size: 14px;
    text-decoration: none;
    color: #007BFF;
}

/* Titre "Search for a route" */
#search-title {
    margin: 0;
    font-size: 16px;
    white-space: nowrap;
}

/* Formulaire de recherche */
#search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 280px;
    flex-wrap: wrap;
}

/* Champs de recherche */
#search-form input[type="text"] {
    padding: 9px 12px;
    font-size: 13px;
    font-family: 'Alata', sans-serif;
    border: 1px solid black;
    border-radius: 10px;
    flex: 1;
    background-color: rgb(255, 255, 255);
    color: rgb(0, 0, 0);
    text-transform: uppercase;
    box-sizing: border-box;
    min-width: 120px;
}
/* Cibler le placeholder et annuler le uppercase */
#search-form input[type="text"]::placeholder {
    text-transform: none;
}


/* Bouton "Publish a Route" (ancienne version, si elle est toujours utilisée ailleurs) */
#search-container button {
    padding: 9px 12px;
    font-size: 13px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: 'Gabarito', sans-serif;
    box-sizing: border-box;
}

#search-container button:hover {
    background-color: #0056b3;
}

/* Styles for the new "Publish a new route" button */
.publish-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Adjusted padding to fit height more consistently */
    padding: 0 24px; /* Set horizontal padding, vertical padding will be managed by height + line-height */
    height: 39px; /* Match the height of .dropbtn */
    border: none;
    border-radius: 8px;
    background-color: #1a73e8;
    color: white;
    font-family: 'Gabarito', sans-serif;
    font-size: 16px; /* Keep font size for publish button */
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    box-sizing: border-box; /* Add this for consistent box model */
}

.publish-button:hover {
    background-color: #1565c0;
}

.publish-button:active {
    background-color: #0d47a1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.publish-button .icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Élément de route */
.route-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #ccc;
    padding: 6px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.3s ease;
    font-size: 12px;
    min-height: 24px;
    border-radius: 5px;
    font-family: 'Gabarito', sans-serif;
    overflow: hidden;
}

.route-item:hover {
    transform: scale(1.006);
    background-color: #e6f7ff;
}

.route-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 60px);
}

/* Infos de la route */
.route-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.route-item p {
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tag AIRAC */
.airac-tag {
    flex-shrink: 0;
    display: inline-block;
    padding: 4px 6px;
    border-radius: 5px;
    font-size: 11px;
    text-transform: uppercase;
    color: white;
    min-width: 42px;
    text-align: center;
    font-family: 'Bebas Neue', sans-serif;
    font-weight: normal;
    margin-left: 10px;
    margin-right: 10px;
}

.green {
    background-color: #4CAF50;
}

.orange {
    background-color: #FFA500;
}

#map{
    border-radius: 15px;
}

.leaflet-popup-content button {
    font-family: 'Alata', sans-serif;
    background-color: #007BFF;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 6px;
}

.leaflet-popup-content button:hover {
    background-color: #0056b3;
}

.header-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 10px;
    margin: 20px auto 15px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    color: #333;
    font-family: 'Alata', sans-serif;
}

.header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    font-weight: bold;
    margin: 0;
    white-space: nowrap;
}


.header-button {
    background-color: #007BFF;
    font-size: 12px;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.header-button:hover {
    background-color: #0056b3;
}


/* --- ACCOUNT BUTTON / PROFILE PICTURE STYLES --- */
.header-button.account-button {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.profile-thumbnail {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    display: block;
}

.header-button.account-button:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

/* --- END ACCOUNT BUTTON / PROFILE PICTURE STYLES --- */


/* Mode sombre */
body.dark-mode {
    background-color: #292b31;
    color: #e0e0e0;
}

body.dark-mode .header-container,
body.dark-mode .route-item{
    background: #33353b;
    color: #e0e0e0;
    border-color: #555;
}

/* Apply dark mode styles to the new publish button */
body.dark-mode .publish-button {
    background-color: #33353b;
    color: #e0e0e0;
    border: 1px solid #555;
}

body.dark-mode .publish-button:hover {
    background-color: #555;
}

body.dark-mode .publish-button:active {
    background-color: #666;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}


body.dark-mode #search-form input,
body.dark-mode #search-form input[type="submit"],
body.dark-mode #reset-button,
body.dark-mode #search-container button{
    background-color: #33353b;
    color: #e0e0e0;
}

body.dark-mode #search-form input[type="submit"]:hover,
body.dark-mode #reset-button:hover,
body.dark-mode #search-container button:hover,
body.dark-mode .header-button:hover,
body.dark-mode .leaflet-popup-content button:hover {
    background-color: #555;
}

/* Dark mode for the account button and profile picture */
body.dark-mode .header-button.account-button {
    background-color: transparent;
    border: none;
}

body.dark-mode .profile-thumbnail {
    border: none;
}

body.dark-mode .header-button.account-button:hover {
    background-color: rgba(224, 224, 224, 0.637);
}


body.dark-mode .airac-tag.green {
    background-color: #388E3C;
}

body.dark-mode .airac-tag.orange {
    background-color: #E65100;
}

/* Style du bouton switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    /* Supprimez margin-right sur desktop si vous voulez qu'il soit directement à côté de l'icône de compte */
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

/* Forme arrondie du bouton */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* MODIFICATIONS ICI POUR LES ICÔNES */
.sun-icon, .moon-icon {
    position: absolute;
    font-size: 14px;
    transition: opacity .4s ease, color .4s ease;
    z-index: 1;
}

.sun-icon {
    left: 8px;
    opacity: 1;
    color: #FFD700;
}

.moon-icon {
    right: 8px;
    opacity: 0.5;
    color: #e0e0e0;
}

input:checked + .slider .sun-icon {
    opacity: 0.5;
    color: #fff;
}

input:checked + .slider .moon-icon {
    opacity: 1;
    color: #33353b;
}
/* FIN DES MODIFICATIONS POUR LES ICÔNES */


/* Dark mode specific styles for the slider and icons */
body.dark-mode .slider {
    background-color: #33353b;
}

body.dark-mode input:checked + .slider {
    background-color: #2196F3;
}

body.dark-mode .slider:before {
    background-color: #e0e0e0;
}

.airline-logos {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.airline-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 3px;
}


/* New: Dropdown specific styles */
.dropdown {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    min-width: 150px;
    vertical-align: middle;
}

.dropbtn {
    background-color: #007BFF;
    color: white;
    padding: 9px 12px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    border-radius: 10px;
    font-family: 'Gabarito', sans-serif;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    height: 39px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 10;
    border-radius: 10px;
    overflow-y: auto;
    max-height: 250px;
    padding: 10px;
    top: 100%;
    left: 0;
}

.dropdown-content label {
    display: block;
    padding: 6px 0;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    font-family: 'Alata', sans-serif;
}

.dropdown-content label:hover {
    background-color: #f1f1f1;
}

.dropdown-content input[type="checkbox"] {
    margin-right: 8px;
}

.dropdown-content.show {
    display: block;
}

/* Dark mode for dropdown */
body.dark-mode .dropdown-content {
    background-color: #33353b;
    color: #e0e0e0;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.4);
}

body.dark-mode .dropdown-content label {
    color: #e0e0e0;
}

body.dark-mode .dropdown-content label:hover {
    background-color: #555;
}

body.dark-mode .dropbtn {
    background-color: #33353b;
    color: #e0e0e0;
    border: 1px solid #555;
}

body.dark-mode .dropbtn:hover {
    background-color: #555;
}

/* --- Footer Styling --- */
.footer-container {
    margin-top: 20px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    font-family: 'Alata', sans-serif;
    font-size: 14px;
    color: #555;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

body.dark-mode .footer-container {
    background: #33353b;
    color: #b0b0b0;
    border-color: #555;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.footer-container p {
    margin: 0;
    line-height: 1.5;
}

.footer-container a {
    color: #007BFF;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-container a:hover {
    color: #0056b3;
    text-decoration: underline;
}

body.dark-mode .footer-container a {
    color: #8ab4f8;
}

body.dark-mode .footer-container a:hover {
    color: #6a9ee8;
}


/* --- Responsive Adjustments --- */

/* Hamburger menu styles */
.hamburger-menu {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 24px;
    position: relative;
    z-index: 20; /* Ensure it's above other content if needed */
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    display: block;
    width: 100%;
    height: 3px;
    background-color: #333; /* Dark mode color for hamburger */
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-icon::before {
    position: absolute;
    top: 0;
}

.hamburger-icon::after {
    position: absolute;
    bottom: 0;
}

/* Dark mode for hamburger icon */
body.dark-mode .hamburger-icon,
body.dark-mode .hamburger-icon::before,
body.dark-mode .hamburger-icon::after {
    background-color: #e0e0e0;
}

/* Hamburger open state */
.hamburger-menu.open .hamburger-icon {
    background-color: transparent; /* Hide middle bar */
}

.hamburger-menu.open .hamburger-icon::before {
    transform: rotate(45deg) translate(5px, 5px); /* Rotate top bar */
}

.hamburger-menu.open .hamburger-icon::after {
    transform: rotate(-45deg) translate(5px, -5px); /* Rotate bottom bar */
}

/* Header navigation items container */
.header-nav-items {
    display: flex; /* Default for desktop */
    align-items: center;
    gap: 15px; /* Space between items on desktop */
}

/* Default styling for refresh button (visible on desktop) */
.refresh-button {
    display: block;
}

/* New: Styles for the AIRAC info */
.airac-info {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    margin-right: 15px; /* Add some space before the switch */
}

body.dark-mode .airac-info {
    color: #b0b0b0;
}

.airac-info .airac-version {
    font-weight: bold;
    color: #007BFF; /* Highlight the current AIRAC version */
}

body.dark-mode .airac-info .airac-version {
    color: #8ab4f8; /* Dark mode highlight */
}

.airac-info .next-update-date {
    font-style: italic;
}


/* --- Mobile Styles (max-width: 768px is a common breakpoint for tablets/mobiles) --- */
@media (max-width: 768px) {
    .header-container {
        justify-content: flex-start;
        padding: 10px;
        position: relative; /* Indispensable pour le z-index et le positionnement des enfants absolus */
        z-index: 1001; /* Z-index plus élevé pour le conteneur principal du menu */
    }

    .hamburger-menu {
        display: block;
        margin-right: 15px;
    }

    .refresh-button {
        display: none;
    }

    .header-title {
        text-align: left;
        flex-grow: 1;
    }

    .header-nav-items {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%; /* Position juste en dessous de l'en-tête */
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-radius: 0 0 10px 10px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
        padding: 0 15px;
        width: 100%;
        box-sizing: border-box;
        z-index: 1000; /* Z-index élevé, mais le parent aura la priorité */
        gap: 10px;

        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.5s ease-out, opacity 0.5s ease-out, padding 0.5s ease-out;
    }

    .header-nav-items.show-menu {
        max-height: 300px; /* Assurez-vous que c'est assez grand pour tout le contenu */
        opacity: 1;
        padding: 15px;
    }

    body.dark-mode .header-nav-items {
        background: rgba(51, 53, 59, 0.95);
    }

    .header-nav-items .header-button {
        width: 100%; /* Les boutons normaux du menu prennent toute la largeur */
        text-align: center;
        margin: 0;
    }

    /* Grouping for mobile menu items at the bottom */
    .menu-bottom-items {
        display: flex; /* Aligns the switch and account button horizontally */
        align-items: center;
        justify-content: center; /* Centers them within the menu */
        width: 90%; /* Takes full width of the menu */
        margin-top: 10px; /* Adds some space from items above */
        margin-bottom: 10px; /* Adds some space from the bottom of the menu */
    }

    .header-nav-items .switch {
        margin-right: 15px; /* Space between the switch and account button */
        margin-bottom: 0;
    }

    .header-nav-items .account-button {
        margin-right: 0;
    }

    /* The new AIRAC info for mobile */
    .airac-info {
        order: -1; /* Place it at the top of the flex column */
        width: 100%;
        text-align: center;
        margin-right: 0; /* Remove desktop margin */
        margin-bottom: 10px; /* Add space below it */
        font-size: 14px;
        line-height: 1.4;
    }


    /* Rest of your mobile CSS remains the same */
    #search-container {
        flex-direction: column;
        align-items: stretch;
    }

    #search-title {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    #search-form {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    #search-form input[type="text"],
    .dropdown {
        width: 100%;
        min-width: auto;
    }

    .dropdown-content {
        min-width: 100%;
    }


    .route-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
        font-size: 14px;
    }

    .route-info {
        width: 100%;
        margin-bottom: 10px;
    }

    .airac-tag {
        margin-left: 0;
        align-self: flex-end;
    }

    .airline-logos {
        display: flex;
        gap: 5px;
        margin-top: 10px;
    }

    .footer-container {
        flex-direction: column;
        gap: 10px;
    }
}

/* Tablet / Medium Screens (from 769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-container {
        padding: 12px 20px;
    }

    .header-title {
        font-size: 18px;
    }

    .header-button {
        font-size: 13px;
        padding: 9px 15px;
    }

    /* Position the AIRAC info for tablet */
    .airac-info {
        font-size: 12px;
        margin-right: 10px; /* Adjust spacing as needed */
    }

    #search-container {
        flex-direction: row;
        justify-content: space-around;
        gap: 15px;
    }

    #search-form {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    #search-form input[type="text"] {
        flex: 1 1 45%; /* Allow inputs to take about half width */
    }

    .dropdown {
        flex: 1 1 45%; /* Allow dropdown to take about half width */
    }


    .route-item {
        padding: 8px;
        font-size: 13px;
    }

    .airac-tag {
        font-size: 12px;
    }

    .footer-container {
        flex-direction: row;
        justify-content: space-between;
        padding: 15px 30px;
    }
}

/* Desktop / Large Screens (min-width: 1025px) */
@media (min-width: 1025px) {

    #search-container {
        margin-left: auto;
        margin-right: auto;
    }

    #routes-container {
        padding: 10px;
        margin-left: auto;
        margin-right: auto;
        display: flex;
        flex-direction: column;
        align-items: center; /* Centre les éléments si leur largeur est inférieure à max-width */
        gap: 5px;
    }

    #routes-container .route-item {
        width: 100%; /* Each route item takes full width of its parent */
    }
}