/*------------------------*/
/*------- Variables ------*/
/*------------------------*/
:root {
    /* Couleurs principales */
    --primary-color: #6b8915;
    --primary-color-hover: #536b12;

    /* Fonds */
    --bg-main: #f3f4f6;
    --bg-panel: #ffffff;
    --bg-map: #e5e5e5;

    /* Textes */
    --text-main: #111111;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;

    /* Éléments UI & Ombres */
    --border-color: #e5e7eb;
    --handle-color: rgba(0, 0, 0, 0.15);
    --shadow-soft: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.2);
}

/*------------------------*/
/*---- Layout global -----*/
/*------------------------*/
html, body {
    margin: 0;
    padding: 0;
    position: fixed; 
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-family: 'Roboto', sans-serif;
    overflow: hidden; 
    background-color: var(--bg-main);
}

#app {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/*------------------------*/
/*--------- Carte --------*/
/*------------------------*/
#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background-color: var(--bg-map);
}

.leaflet-control-zoom {
    display: none;
}

/*------------------------*/
/*--- Interface Mobile ---*/
/*------------------------*/

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000; 
    pointer-events: none; 
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
}

/* Conteneur des contrôles du bas */
#bottom-controls {
    padding: 15px 20px calc(20px + env(safe-area-inset-bottom)) 20px; 
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- Boutons Flottants --- */
.floating-buttons {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.btn-icon {
    pointer-events: auto;
    background-color: var(--primary-color);
    color: var(--text-inverse);
    border: none;
    border-radius: 12px;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px var(--shadow-soft);
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
}

.btn-icon:active {
    transform: scale(0.95);
    background-color: var(--primary-color-hover);
}

/* --- Overlay étages --- */
.layer-menu-container {
    position: relative;
    width: 50px;
    height: 50px;
}

#floor-menu {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    background-color: var(--primary-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 200px; 
    box-shadow: 0 4px 6px var(--shadow-soft);
    pointer-events: auto;
    z-index: 10;
    scrollbar-width: none;
}
#floor-menu::-webkit-scrollbar {
    display: none;
}

.floor-btn {
    background: transparent;
    color: var(--text-inverse);
    border: none;
    width: 100%;
    height: 50px;
    flex-shrink: 0;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
}

.floor-btn:not(:last-child) { border-bottom: 1px solid rgba(255, 255, 255, 0.2); }
.floor-btn.active, .floor-btn:active {
    background-color: var(--primary-color-hover);
}

/* --- Barres de Recherche --- */
.search-bar-container {
    pointer-events: auto;
    display: flex;
    align-items: center;
    background-color: var(--bg-panel);
    border: 3px solid var(--primary-color);
    border-radius: 30px;
    padding: 5px 15px;
    box-shadow: 0 4px 10px var(--shadow-soft);
}

.search-icon {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-right: 10px;
}

.search-bar-container input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 1.1rem;
    color: var(--text-main);
    outline: none;
    width: 100%;
}

.search-bar-container input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.btn-mic {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* --- OVERLAYS GÉNÉRIQUES --- */
#search-overlay, #route-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    background-color: var(--bg-panel);
    border-top: 3px solid var(--primary-color);
    border-left: 3px solid var(--primary-color);
    border-right: 3px solid var(--primary-color);
    border-radius: 30px 30px 0 0;
    padding: 10px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    z-index: 2000;
    pointer-events: auto;
    box-shadow: 0 -5px 15px var(--shadow-strong);
    transition: transform 0.2s ease-out;
}

#search-overlay {
    height: 75vh;
}

.drag-handle {
    width: 45px;
    height: 6px;
    background-color: var(--handle-color);
    border-radius: 3px;
    margin: 0 auto 15px auto;
}

.btn-close-overlay {
    background-color: var(--bg-main);
    color: var(--text-main);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* --- Overlay de Recherche --- */
.search-overlay-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 25px;
}

.search-overlay-header .search-bar-container {
    flex: 1;
    background-color: var(--bg-main);
    border: 2px solid var(--primary-color);
    box-shadow: none;
}

.search-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-section-title {
    color: var(--primary-color);
    margin: 0 0 10px 5px;
    font-size: 1.1rem;
}

.location-list {
    background-color: var(--bg-main);
    border-radius: 20px;
    padding: 5px 20px;
    overflow-y: auto;
    flex: 1; 
    box-sizing: border-box;
}

.location-item {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--text-main);
    cursor: pointer;
}

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

/* --- Overlay d'Itinéraire --- */
.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.route-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.toggle-group {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.toggle-btn {
    flex: 1;
    background-color: var(--bg-main);
    color: var(--text-muted);
    border: none;
    border-radius: 30px;
    padding: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, color 0.2s;
}

.toggle-btn.active {
    background-color: var(--primary-color);
    color: var(--text-inverse);
    box-shadow: 0 4px 6px var(--shadow-soft);
}

.route-inputs {
    background-color: var(--bg-main);
    border-radius: 15px;
    padding: 5px 20px;
    margin-bottom: 20px;
}

.route-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.route-input-group:last-child {
    border-bottom: none;
}

.route-input-group input {
    border: none;
    outline: none;
    font-size: 1.1rem;
    width: 100%;
    background: transparent;
    font-weight: bold;
    color: var(--text-main);
    cursor: pointer;
}

.route-input-group i {
    font-size: 1.2rem;
}

.add-stop span {
    font-weight: bold;
    color: var(--text-main);
    font-size: 1.05rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-inverse);
    border: none;
    border-radius: 30px;
    padding: 15px;
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 10px rgba(107, 137, 21, 0.4);
}

/*------------------------*/
/*-------- Utility -------*/
/*------------------------*/
.hidden { display: none !important; }