html, body {
    margin: 0;         
    padding: 0;       
    width: 100%;
    height: 100%;
}

body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Roboto, sans-serif;
    padding-bottom: env(safe-area-inset-bottom);
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
    background-color: cadetblue;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    font-size: 18px;
    font-weight: 600;
    box-sizing: border-box;
}

header h1 {
    margin: 0;
    font-size: 1.2rem;
}

header img.logo {
    height: 40px;       
    width: auto;       
    display: block;
}

.main{
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background-color: white;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    overflow-x: visible;
    box-shadow: 2px 0 6px rgba(0,0,0,0.05);
    transition: all 0.3s ease-in-out;
}

.sidebar h3{
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #333; /* contraste renforcé */
    margin: 0;
    margin-top: 6px;
}

.sidebar input {
    width: calc(100% - 24px);
    padding: 12px 12px; /* padding légèrement augmenté */
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.88rem;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.sidebar input:focus {
    border-color: cadetblue;
    box-shadow: 0 0 0 3px rgba(95,158,160,0.2); /* plus visible */
}

.search-container {
    position: relative;
}

.guide {
    font-size: 0.9rem;
    color: #333; /* contraste amélioré */
    background: #eef6f7;
    padding: 10px 12px; /* padding augmenté */
    border-left: 4px solid cadetblue;
    border-radius: 6px;
    line-height: 1.4;
}

#suggestions-start, #suggestions-end{
    position: absolute;
    top: 100%;
    z-index: 1000;
    width: 276px;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.info{
    background: #f1f3f4;
    border-radius: 8px;
    padding: 2px 8px;
}

.info p{
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
}

#lbl-start{
    color: green;
}

#lbl-end{
    color: red;
}

#pmr-mode-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: #444;
    cursor: pointer;
}

#pmr-mode-label input {
    width: 16px;
    height: 16px;
    accent-color: cadetblue;
    cursor: pointer;
}

#warning, .no-path-pmr {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #e65100;
    border-radius: 8px;
    padding: 10px 12px; /* padding augmenté pour meilleure lisibilité */
    font-size: 0.82rem;
}

button {
    transition: 0.15s;
}

button:active {
    transform: scale(0.97);
}

#btn-calc {
    width: 100%;
    padding: 12px;
    background: cadetblue;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

#btn-calc:hover{
    background: rgb(59, 113, 115);
}

#btn-calc:disabled{
    background: #e0e0e0;
    color: #90868b;
    cursor: not-allowed;
}

#btn-reset {
    width: 100%;
    padding: 12px;
    background: white;
    color: #e57373;
    border: 2px solid #e57373;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}
#btn-reset:hover {
    background: #fdecea;
    color: #c62828;
    border-color: #c62828;
}

#instructions {
    font-size: 0.85rem;
    color: #444;
}

#instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#instructions li {
    padding: 8px 12px;
    border-radius: 8px;
    background: #f1f3f4;
    display: flex;
    align-items: center;
    gap: 8px;
}

#instructions li:last-child {
    background: #e8f5e9;
    color: green;
    font-weight: 600;
}

.credits {
    margin-top: auto;
    font-size: 0.65rem;
    color: #aaa;
    text-align: center;
    padding: 6px;
    border-top: 1px solid #eee;
}

.map {
    flex: 1;
    background-color: white;
    overflow: auto;
    position: relative;
}

#map-wrapper {
    display: inline-block;
    overflow: hidden;
}


#map-svg-container{
    position: relative;
    display: inline-block;
}

#overlay{
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

#overlay circle {
    pointer-events: all;
}

#plan-img{
    display: block;
}

#floor-controls {
    position: fixed;
    top: 76px;
    left: 316px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.floor-btn {
    padding: 8px 14px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    color: #80868b;
    transition: 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.floor-btn:hover {
    border-color: cadetblue;
    color: cadetblue;
}

.floor-btn.active {
    background: cadetblue;
    border-color: cadetblue;
    color: white;
}

#zoom-controls {
    position: fixed;
    bottom: 50px;
    right: 32px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#zoom-controls button {
    width: 36px;
    height: 36px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    color: #80868b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

#zoom-controls button:hover {
    border-color: cadetblue;
    color: cadetblue;
}

#mobile-tabs{
    display: none;
}

#panel-instructions {
    display: none;
}

#btn-calc-map {
    display: none;
}

@media (max-width: 768px) {
    #mobile-tabs {
        display: flex;
        background: white;
        border-top: 1px solid #e0e0e0;
        flex-shrink: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .tab-btn {
        flex: 1;
        padding: 10px 4px 8px;
        background: none;
        border: none;
        cursor: pointer;
        font-size: 0.95rem; /* légèrement augmenté */
        color: #555; /* plus visible */
        font-weight: 500;
        transition: color 0.2s;
    }

    .tab-btn.active {
        color: cadetblue;
        font-weight: 700;
        text-shadow: 0 0 1px rgba(0,0,0,0.1); /* légère mise en évidence */
    }

    .main {
        position: relative;
    }

    .sidebar {
        position: absolute;
        inset: 0;
        width: 100%;
        box-sizing: border-box;
        border-right: none;
        overflow-y: auto;
        display: none;
        transition: all 0.3s ease-in-out;
    }

    .sidebar.active {
        display: flex;
    }

    .sidebar #title-instructions,
    .sidebar #instructions {
        display: none;
    }

    .map {
        position: absolute;
        inset: 0;
        display: none;
        transition: all 0.3s ease-in-out;
    }

    .map.active {
        display: block;
    }

    #panel-instructions {
        position: absolute;
        inset: 0;
        background: white;
        overflow-y: auto;
        padding: 16px;
        box-sizing: border-box;
        display: none;
    }

    #panel-instructions.active {
        display: block;
    }

    #panel-instructions h3{
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: gray;
        margin: 1rem;
    }

    #btn-calc-map {
        display: block;
        position: fixed;
        bottom: 50px;
        left: 50%;
        transform: translateX(-50%);
        padding: 12px 24px;
        background: cadetblue;
        color: white;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        font-size: 0.9rem;
        cursor: pointer;
        z-index: 10;
    }

    #btn-calc-map:disabled {
        background: #e0e0e0;
        color: #90868b;
        cursor: not-allowed;
    }

    #mobile-instructions-content ul {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    #mobile-instructions-content li {
        padding: 8px 12px;
        border-radius: 8px;
        background: #f1f3f4;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    #mobile-instructions-content li:last-child {
        background: #e8f5e9;
        color: green;
        font-weight: 600;
    }

    .credits {
        font-size: 0.65rem;
        padding: 8px;
        text-align: center;
        color: #999;
    }

    #floor-controls {
        top: 76px;
        left: 16px;
    }
}

* {
    box-sizing: border-box;
}