* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    overflow: hidden;
    background: #f5f5f5;
}

button,
select,
input {
    font: inherit;
}

.application {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    min-height: 0;
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid #cfcfcf;
    background: #ffffff;
}

.sidebar-header {
    flex: 0 0 auto;
    padding: 18px 16px 8px;
}

.sidebar-header h1 {
    margin: 0;
    font-size: 1.55rem;
}

.selection-section {
    flex: 0 0 auto;
    padding: 12px 16px 14px;
    border-bottom: 1px solid #dedede;
}

.selection-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.selection-section select {
    width: 100%;
    min-height: 40px;
    padding: 8px;
}

.streets-section {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 14px 8px 0;
}

.section-title {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px;
}

.section-title h2 {
    margin: 0;
    font-size: 1.1rem;
}

#streets-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e9edf1;
    font-size: 0.82rem;
    font-weight: 700;
}

.street-actions {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0 10px;
}

.street-actions button {
    min-height: 36px;
    padding: 6px 8px;
    cursor: pointer;
}

.street-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

#status-message {
    flex: 0 0 auto;
    margin: 0 0 8px;
    padding: 9px;
    background: #f2f2f2;
    line-height: 1.3;
}

#streets-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 3px;
    padding-bottom: 12px;
    scrollbar-gutter: stable;
}

.street-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 6px;
    border-bottom: 1px solid #e5e5e5;
    cursor: pointer;
    transition:
        background 120ms ease,
        border-color 120ms ease;
}

.street-item:hover {
    background: #f5f8fa;
}

.street-item input {
    flex: 0 0 auto;
    margin-top: 3px;
}

.street-content {
    display: block;
    flex: 1;
    min-width: 0;
}

.street-name {
    display: block;
    overflow-wrap: anywhere;
    color: #202020;
    font-weight: 700;
    line-height: 1.25;
}

.street-details {
    display: block;
    margin-top: 4px;
    color: #606060;
    font-size: 0.82rem;
    line-height: 1.3;
}

.street-selected {
    border-left: 5px solid #ff00a8;
    padding-left: 1px;
    background: #fff2fb;
}

.street-selected .street-name {
    color: #9a0066;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 10px 16px;
    border-top: 1px solid #dcdcdc;
    background: #fafafa;
}

.sidebar-footer p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.35;
}

.map-container,
#map {
    width: 100%;
    height: 100vh;
    min-width: 0;
    min-height: 0;
}

.commune-tooltip {
    padding: 4px 7px;
    border: 1px solid #666666;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.92);
    color: #222222;
    font-size: 0.8rem;
    font-weight: 700;
}

.destination-label {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    color: #c72232;
    font-size: 0.9rem;
    font-weight: 900;
    white-space: nowrap;
}

.leaflet-tooltip.destination-label::before {
    display: none;
}

.destination-popup {
    min-width: 190px;
    line-height: 1.45;
}

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .application {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(330px, 46vh) minmax(420px, 54vh);
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        height: 46vh;
        min-height: 330px;
        border-right: 0;
        border-bottom: 1px solid #cfcfcf;
    }

    .map-container,
    #map {
        height: 54vh;
        min-height: 420px;
    }
}
.street-map-tooltip .street-tooltip-title {
    color: #a50063 !important;
    font-size: 2rem;
    font-weight: 700;
}

.street-map-tooltip .street-tooltip-destination {
    color: #606b75;
    font-weight: 400;
}
.leaflet-tooltip.street-map-tooltip .street-tooltip-title {
    color: #a50063 !important;
    font-size: 2rem !important;
    font-weight: 700 !important;
    line-height: 1.1;
    margin-bottom: 4px;
}

.leaflet-tooltip.street-map-tooltip .street-tooltip-destination {
    color: #606b75;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.25;
}

.street-search {
    margin-top: 12px;
    margin-bottom: 10px;
}

#street-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    font-size: 1rem;
}

#street-search-input::placeholder {
    color: #b8b8b8;
    opacity: 1;
}

.sidebar-header h1 {
    margin: 0 0 18px 0;
}

.search-mode-selector {
    display: flex;
    gap: 24px;
    margin: 0 0 18px 0;
    padding: 0;
    border: 0;
}

.search-mode-selector label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.context-search-section {
    margin-bottom: 18px;
}

/* En-tête : titre, radios et recherche */

.sidebar-header h1 {
    margin: 0 0 20px 0 !important;
}

fieldset.search-mode-selector {
    display: flex !important;
    align-items: center !important;
    gap: 24px !important;

    width: auto !important;
    min-width: 0 !important;

    margin: 0 0 20px 0 !important;
    padding: 0 !important;

    border: none !important;
    outline: none !important;
    background: transparent !important;
}

fieldset.search-mode-selector label {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;

    margin: 0 !important;
    padding: 0 !important;
}

.context-search-section {
    margin: 0 20px 20px 20px !important;
}

#context-search-input {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
    padding: 9px 11px;
    font-size: 1rem;
}

#context-search-input::placeholder {
    color: #b8b8b8;
    opacity: 1;
}

#street-mode-panel .street-search {
    width: 100%;
    margin-top: 16px;
    margin-bottom: 16px;
}

#global-street-search-input {
    display: block;
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    padding: 9px 11px;
    font-size: 1rem;
}

#global-street-search-input::placeholder {
    color: #b8b8b8;
    opacity: 1;
}

#global-street-status[hidden] {
    display: none;
}

/* Champs des modes Rue et Adresse */

#street-mode-panel .street-search,
#address-mode-panel .street-search {
    width: 100%;
    margin-top: 16px;
    margin-bottom: 16px;
}

#global-street-search-input,
#global-address-search-input {
    display: block;
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    padding: 9px 11px;
    font-size: 1rem;
}

#global-street-search-input::placeholder,
#global-address-search-input::placeholder {
    color: #b8b8b8;
    opacity: 1;
}

#global-street-status[hidden],
#global-address-status[hidden] {
    display: none;
}

#address-mode-panel {
    height: calc(100vh - 155px);
    overflow: hidden;
}

#global-addresses-list {
    height: calc(100vh - 285px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}