/* --- Sous-menu horizontal en groupes de billes --- */
.sub-navbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    min-width: 0;
    gap: 15px;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.sub-group {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 15px;
    padding-right: 15px;
    border-right: 1px solid #dee2e6;
}

.sub-group:last-child,
.sub-navbar > .sub-group:has(+ .overflow-more[hidden]) {
    border-right: none;
}

/* Barres d'icônes sur une seule ligne : ce qui ne tient pas passe dans le menu du bouton à trois traits (overflow-bar.js). */
.is-overflowed { display: none !important; }
.overflow-more {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; align-self: center;
    width: 38px; height: 38px; margin-left: auto; padding: 0; border: 0; border-radius: 6px; box-sizing: border-box;
    background: transparent; color: #6c757d; cursor: pointer; box-shadow: none;
}
.overflow-more svg { width: 26px; height: 26px; }
.overflow-more[hidden] { display: none; }
.overflow-more:hover { color: #343a40; }
.overflow-more:focus-visible { outline: 2px solid #007bff; outline-offset: 3px; }
.sub-group-right ~ .overflow-more { margin-left: 8px; }
.side-options > .overflow-more { align-self: flex-start; }
.sub-item span { white-space: nowrap; }

.overflow-menu {
    position: fixed; z-index: 5000; min-width: 170px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 4px;
    background: #fff; border: 1px solid #d5dbe1; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
}
.overflow-menu-item {
    display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; border: 0; border-radius: 6px;
    background: transparent; color: #0a2540; font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
}
.overflow-menu-item:hover, .overflow-menu-item:focus-visible { background: #e8f4f8; outline: none; }
.overflow-menu-item.is-active { font-weight: 700; }
.overflow-menu-icon { flex: 0 0 auto; display: inline-flex; pointer-events: none; }
.overflow-menu-icon .tool-icon-circle, .overflow-menu-icon .side-opt { width: 28px; height: 28px; margin: 0; box-shadow: none; }
.overflow-menu-icon .tool-icon-circle:hover { transform: none; }
.overflow-menu-icon svg { width: 16px; height: 16px; }
body.dark-mode .overflow-menu { background: #1d232c; border-color: #3b4552; }
body.dark-mode .overflow-menu-item { color: #e6edf3; }
body.dark-mode .overflow-menu-item:hover, body.dark-mode .overflow-menu-item:focus-visible { background: #2a323d; }
body.dark-mode .overflow-more { color: #aab4bf; }
body.dark-mode .overflow-more:hover { color: #e6edf3; }

.sub-group-right {
    margin-left: auto;
    border-right: none;
    padding-right: 0;
}

.sub-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s ease;
}

.sub-item:hover {
    transform: scale(1.05);
}

.sub-item span {
    font-size: 0.65rem;
    color: #495057;
    margin-top: 4px;
    font-weight: 500;
}

.sub-separator {
    width: 1px;
    height: 30px;
    background-color: #ced4da;
    margin: 0 4px;
}

.sub-item.active .tool-icon-circle,
.sub-nav-btn.active {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.4);
}

.toggle-container { display: flex; align-items: center; gap: 8px; font-weight: bold; }

.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc; transition: .4s; border-radius: 20px;
}
.slider:before {
    position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: #6c757d; }
input:checked + .slider:before { transform: translateX(20px); }

.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); justify-content: center; align-items: center; z-index: 2000;
}

.modal-card {
    background: white; padding: 25px; border-radius: 8px;
    width: 100%; max-width: 400px; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    position: relative; box-sizing: border-box;
}

.modal-card h3 { margin-top: 0; text-align: center; }

.user-preferences-modal { z-index: 2100; }
.user-preferences-card { max-width: 430px; }
.user-preferences-card h3 { margin: 0 0 18px; text-align: left; }
.user-preference-option { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-top: 1px solid #e9ecef; }
.user-preference-option label { font-weight: 600; }
.user-preference-option select { min-width: 150px; max-width: 55%; padding: 6px 8px; border: 1px solid #c5ccd6; border-radius: 6px; font: inherit; background: #fff; color: #212529; }

body.dark-mode {
    --bg-color: #171b22;
    --card-bg: #222832;
    --text-color: #e6edf3;
    color-scheme: dark;
}
body.dark-mode .search-form,
body.dark-mode .trip-card,
body.dark-mode .shared-trip-card,
body.dark-mode .my-trip-list-card,
body.dark-mode .trip-additional-info-content,
body.dark-mode .function-detail,
body.dark-mode .detail-text-side input,
body.dark-mode .detail-text-side select,
body.dark-mode .detail-text-side textarea,
body.dark-mode .modal-card,
body.dark-mode .shared-search-criteria,
body.dark-mode .trip-map-sidebar,
body.dark-mode .trip-budget-card,
body.dark-mode .trip-budget-panel {
    background-color: #222832;
    color: #e6edf3;
}
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background-color: #171b22;
    border-color: #505b68;
    color: #e6edf3;
}
body.dark-mode .sub-navbar,
body.dark-mode .trip-additional-fields input,
body.dark-mode .trip-additional-fields select,
body.dark-mode .user-preferences-button {
    background-color: #222832;
    color: #e6edf3;
}
body.dark-mode .user-preferences-button { border-color: #505b68; }

.trip-preferences-card { max-width: 460px; max-height: 90vh; overflow-y: auto; }
.trip-preferences-card h3 { margin: 0 0 20px; }
.trip-preference-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    align-items: center;
    justify-content: initial;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}
.trip-preference-row:last-child { border-bottom: none; }
.trip-preference-row > .preference-switch { justify-self: start; }
.trip-preference-control { display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-width: 0; }
.trip-preference-state { min-width: 42px; font-size: 0.9rem; font-weight: bold; }
.preference-switch { position: relative; display: inline-flex; width: 76px; height: 30px; cursor: pointer; }
.preference-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.preference-switch-pill {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-around;
    border-radius: 20px;
    background: #6c757d;
    color: #fff;
    font-size: 0.65rem;
    font-weight: bold;
    transition: background 0.2s;
}
.preference-switch-pill > span:not(.preference-switch-knob) { z-index: 1; }
.preference-switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}
.preference-switch input:checked + .preference-switch-pill { background: #28a745; }
.preference-switch input:checked + .preference-switch-pill .preference-switch-knob { transform: translateX(46px); }
.preference-switch input:focus-visible + .preference-switch-pill { outline: 3px solid rgba(0, 123, 255, 0.4); outline-offset: 2px; }

.form-group { margin-bottom: 15px; display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.85rem; font-weight: bold; }
.form-group input, .form-group select { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem; }

.modal-close { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #888; }

.auth-switch-text { text-align: center; font-size: 0.85rem; margin-top: 15px; }
.auth-switch-text a { color: var(--primary-color); cursor: pointer; text-decoration: underline; }

h2 { font-size: 1.5rem; text-align: center; }

.auth-session-notice { margin: 0 0 12px; padding: 8px 10px; border-radius: 4px; background: #fff3cd; color: #664d03; font-size: 0.88rem; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 32px auto 0; max-width: 1200px; padding: 14px 12px 18px; border-top: 1px solid #e3e7ea; font-size: 0.72rem; }
.site-footer a, .site-footer span { color: #98a1a8; text-decoration: none; }
.site-footer a:hover { color: #58656e; text-decoration: underline; }
.account-terms { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 12px; font-size: 0.82rem; color: #495057; }
.account-terms input { margin-top: 3px; flex: 0 0 auto; }
body.dark-mode .site-footer { border-top-color: #333; }
body.dark-mode .brand-mark img { filter: brightness(0) invert(1); }
body.dark-mode .function-item { background: #222832; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
body.dark-mode .bar-city-dot::before { box-shadow: 0 0 0 3px #171b22, 0 0 0 4px #4a5563; }
/* Le détail d'une barre garde son fond clair (dégradé) et son texte sombre, même en mode sombre. */
body.dark-mode .function-item .function-detail {
    background: linear-gradient(color-mix(in srgb, var(--bar-color, #6c757d) 16%, #fff), #fff 140%);
    color: #0a2540;
    color-scheme: light;
}
body.dark-mode .function-item .function-detail label,
body.dark-mode .function-item .function-detail .detail-row,
body.dark-mode .function-item .function-detail strong { color: #0a2540; }
body.dark-mode .function-item .function-detail input,
body.dark-mode .function-item .function-detail select,
body.dark-mode .function-item .function-detail textarea { background-color: #fff; border-color: #ccc; color: #222; }
body.dark-mode .function-item .function-detail .transport-route { background: #f4f6f8; border-color: #e3e7eb; }
body.dark-mode .function-item .function-bar-minimal,
body.dark-mode .function-item .function-bar-minimal *:not(.link-pill):not(.link-pill *):not(.delete-func-badge) { color: #ffffff !important; }
body.dark-mode .function-item.read-only { color: #ffffff !important; }
body.dark-mode .page-bar-inline { background: #fff; color: #333; }