
.map-layout {
    display: flex;
    height: calc(100vh - 80px);
    position: relative;
}
.map-sidebar {
    display: none;
    width: 40%;
    max-width: 600px;
    min-width: 350px;
    height: 100%;
    background: white;
    border-right: 1px solid var(--mau-vien);
    flex-shrink: 0;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

@media (min-width: 1024px) {
    .map-sidebar {
        display: flex;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 1500;
        width: 85px;
        min-width: 85px;
        height: 100%;
        transition: width 0.15s ease, min-width 0.15s ease;
        box-shadow: 2px 0 15px rgba(0,0,0,0.1);
        overflow: hidden;
        user-select: none;
        -webkit-user-select: none;
        background: var(--mau-nen);
        cursor: default;
        caret-color: transparent;
        pointer-events: auto;
    }
    
    .map-sidebar * {
        caret-color: transparent;
    }
    
    .map-sidebar input,
    .map-sidebar textarea {
        caret-color: auto;
        user-select: text;
        -webkit-user-select: text;
    }
    
    .map-sidebar.expanded {
        width: 320px;
        min-width: 300px;
        max-width: 350px;
        transition: width 0.2s ease, min-width 0.2s ease;
    }
}

/* Màn 1280px - 1439px */
@media (min-width: 1280px) and (max-width: 1439px) {
    .map-sidebar.expanded {
        width: 340px;
        min-width: 320px;
        max-width: 380px;
    }
}

/* Màn 1440px - 1599px */
@media (min-width: 1440px) and (max-width: 1599px) {
    .map-sidebar.expanded {
        width: 360px;
        min-width: 340px;
        max-width: 420px;
    }
}

/* Màn 1600px - 1919px */
@media (min-width: 1600px) and (max-width: 1919px) {
    .map-sidebar.expanded {
        width: 380px;
        min-width: 350px;
        max-width: 480px;
    }
}

/* Màn >= 1920px (2K trở lên) */
@media (min-width: 1920px) {
    .map-sidebar.expanded {
        width: 40%;
        min-width: 380px;
        max-width: 600px;
    }
}

@media (min-width: 1024px) {
    /* Đảm bảo tất cả container đều có background */
    .map-sidebar #sidebarListView {
        position: relative;
        background: var(--mau-nen);
        padding: 0;
        margin: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .map-sidebar .ditich-list {
        padding: 0.25rem;
        display: flex;
        flex-direction: column;
        gap: 0;
        background: var(--mau-nen);
        margin: 0;
        flex: 1;
        overflow-y: auto;
    }
    
    .map-sidebar.expanded .ditich-list {
        padding: 0.5rem;
        gap: 0;
    }
    
    .map-sidebar #sidebarListView,
    .map-sidebar .route-button,
    .map-sidebar .map-controls-sidebar,
    .map-sidebar .sidebar-online,
    .map-sidebar .ditich-item,
    .map-sidebar .ditich-item *,
    .map-sidebar .ditich-list,
    .map-sidebar .ditich-name,
    .map-sidebar .ditich-address,
    .map-sidebar .ditich-thumb,
    .map-sidebar .route-list-header,
    .map-sidebar .route-panel {
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }
    
    .map-sidebar .ditich-detail {
        user-select: text;
        -webkit-user-select: text;
    }
    
    .map-sidebar .sidebar-header {
        max-height: 0;
        overflow: hidden;
        padding: 0;
        margin: 0;
        transition: all 0.3s ease;
        background: var(--mau-nen);
    }
    
    .map-sidebar.expanded .sidebar-header {
        max-height: 100px;
        padding: 1rem;
    }
    
    .map-sidebar .route-button {
        width: 50px;
        height: 50px;
        padding: 0;
        border-radius: 50%;
        margin: 0.5rem auto;
        justify-content: center;
        min-width: 50px;
        font-size: 1rem;
        flex-shrink: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        display: flex;
        align-items: center;
        color: white !important;
        border: none;
    }
    
    .map-sidebar .route-button i {
        display: block !important;
        font-size: 1.1rem;
        color: white !important;
    }
    
    .map-sidebar .route-button span {
        display: none;
    }
    
    .map-sidebar.expanded .route-button {
        width: calc(100% - 2rem);
        height: auto;
        padding: 0.6rem 1rem;
        border-radius: 25px;
        margin: 0.5rem 1rem;
        font-size: inherit;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: white !important;
    }
    
    .map-sidebar.expanded .route-button i {
        display: block !important;
        color: white !important;
    }
    
    .map-sidebar.expanded .route-button span {
        display: inline;
        color: white !important;
    }
    
    .map-sidebar .map-controls-sidebar {
        display: none;
        height: 0;
        overflow: hidden;
        padding: 0;
        margin: 0;
        background: var(--mau-nen);
    }
    
    .map-sidebar.expanded .map-controls-sidebar {
        display: flex;
        height: auto;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        justify-content: center;
    }
    
    .map-sidebar .map-controls-sidebar .map-category-item span {
        display: none;
    }
    
    .map-sidebar.expanded .map-controls-sidebar .map-category-item span {
        display: inline;
    }
    
    .map-sidebar:has(.ditich-detail.active) .map-controls-sidebar,
    .map-sidebar:has(.route-panel.active) .map-controls-sidebar {
        display: none !important;
    }
    
    .map-sidebar:has(.ditich-detail.active) .route-button,
    .map-sidebar:has(.route-panel.active) .route-button {
        display: none !important;
    }
    
    .map-sidebar:has(.ditich-detail.active) #sidebarListView,
    .map-sidebar:has(.route-panel.active) #sidebarListView {
        display: none !important;
    }
    
    .map-sidebar:has(.ditich-detail.active),
    .map-sidebar:has(.route-panel.active) {
        width: 40%;
        min-width: 350px;
        max-width: 600px;
    }
    
    .map-sidebar .sidebar-online {
        padding: 0.5rem;
        font-size: 0.9rem;
        justify-content: center;
        overflow: hidden;
    }
    
    .map-sidebar .sidebar-online .online-text {
        display: none;
    }
    
    .map-sidebar .sidebar-online i {
        margin-right: 0.3rem;
        font-size: 8px;
        flex-shrink: 0;
    }
    
    .map-sidebar .sidebar-online strong {
        font-size: 0.85rem;
        max-width: 50px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .map-sidebar.expanded .sidebar-online {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .map-sidebar.expanded .sidebar-online i {
        font-size: 8px;
        margin-right: 0.5rem;
    }
    
    .map-sidebar.expanded .sidebar-online strong {
        font-size: inherit;
        max-width: none;
    }
    
    .map-sidebar.expanded .sidebar-online .online-text {
        display: inline;
        margin-right: 0.3rem;
    }
    
    .map-sidebar .ditich-info,
    .map-sidebar .ditich-delete-btn {
        display: none;
    }
    
    .map-sidebar.expanded .ditich-info {
        display: block;
    }
    
    .map-sidebar.expanded .ditich-delete-btn {
        display: flex;
    }
    
    .map-sidebar .route-list-header {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        margin-bottom: 0;
        padding: 0 12px;
        transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    }
    
    .map-sidebar.expanded .route-list-header {
        max-height: 60px;
        opacity: 1;
        margin-bottom: 8px;
        padding: 10px 12px;
    }
    
    .map-sidebar .ditich-item {
        padding: 0.2rem;
        justify-content: center;
        margin: 0;
        background: var(--mau-nen);
        border-radius: 6px;
        border: 2px solid var(--mau-nen);
        transition: border-color 0.15s ease;
        cursor: pointer;
    }
    
    .map-sidebar .ditich-item:hover {
        border-color: var(--mau-chinh);
    }
    
    .map-sidebar.expanded .ditich-item {
        padding: 0.6rem;
        justify-content: flex-start;
        margin-bottom: 0.4rem;
        background: var(--mau-nen-card);
        border-radius: var(--bo-goc-md);
        border: 1px solid transparent;
        transition: background 0.15s ease, border-color 0.15s ease;
        cursor: pointer;
    }
    
    .map-sidebar.expanded .ditich-item:hover {
        background: var(--mau-nen-xam);
        border-color: var(--mau-vien);
    }
    
    .map-sidebar .ditich-thumb {
        width: 65px;
        height: 50px;
        min-width: 65px;
        min-height: 50px;
        border-radius: 6px;
        object-fit: cover;
    }
    
    .map-sidebar.expanded .ditich-thumb {
        width: 65px;
        height: 50px;
        min-width: 65px;
        min-height: 50px;
    }
    
    .map-sidebar .loading-message {
        flex-direction: column;
        justify-content: center;
        padding: 1rem 0.3rem;
    }
    
    .map-sidebar .loading-message span {
        display: none;
    }
    
    .map-sidebar.expanded .loading-message {
        flex-direction: row;
        justify-content: center;
        padding: 1.5rem;
    }
    
    .map-sidebar.expanded .loading-message span {
        display: inline;
    }
    
    .map-sidebar::after {
        content: '›';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 15px;
        height: 40px;
        background: rgba(255,255,255,0.9);
        border-radius: 0 5px 5px 0;
        font-size: 1rem;
        color: #666;
        cursor: pointer;
        line-height: 40px;
        text-align: center;
        z-index: 10;
        transition: opacity 0.3s ease;
    }
    
    .map-sidebar.expanded::after {
        opacity: 0;
        pointer-events: none;
    }
    
    .map-controls .map-category {
        display: none !important;
    }
}
.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Đảm bảo map và các pane của nó không có z-index quá cao */
@media (min-width: 1024px) {
    #map {
        z-index: 1;
    }
    
    .leaflet-pane {
        z-index: auto;
    }
    
    .leaflet-top,
    .leaflet-bottom {
        z-index: 1000;
    }
}
.map-controls {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 90%;
    max-width: 500px;
    user-select: none;
    -webkit-user-select: none;
}

@media (min-width: 1024px) {
    .map-controls {
        left: 51%;
        transform: translateX(-50%);
    }
}
.map-search-box {
    position: relative;
    width: 100%;
}

.map-search-box > i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mau-chu-phu);
    font-size: 0.9rem;
    z-index: 1;
}

.map-search-box input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border: none;
    border-radius: var(--bo-goc-full);
    font-size: 0.9rem;
    background: white;
    box-shadow: var(--bong-md);
}

.map-search-box input:focus {
    outline: none;
    box-shadow: var(--bong-lg), 0 0 0 2px var(--mau-chinh);
}

.map-search__results {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--bo-goc-md);
    box-shadow: var(--bong-lg);
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.map-search__results.show {
    display: block;
}

.search-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--mau-vien);
    font-size: 0.85rem;
}

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

.search-item:hover {
    background: var(--mau-nen-xam);
}

.search-item strong {
    display: block;
    color: var(--mau-chu-chinh);
}

.search-item small {
    color: var(--mau-chu-phu);
}
.map-category {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.map-category-item {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 0.8rem;
    background: white;
    border-radius: var(--bo-goc-full);
    box-shadow: var(--bong-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.map-category-item:hover {
    box-shadow: var(--bong-md);
}

.map-category-item.active {
    background: var(--mau-chinh);
    color: white;
}

.map-category-item i {
    font-size: 0.75rem;
}

.map-controls-sidebar {
    display: none;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.5rem 0.75rem;
}

.map-controls-sidebar .map-category-item {
    cursor: pointer;
}

.route-button {
    margin: 0.75rem;
    padding: 0.7rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--bo-goc-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.route-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.route-button i {
    font-size: 1.1rem;
}
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    display: none;
    background: var(--mau-nen);
}
.sidebar-content.ditich-detail.active {
    display: flex !important;
    overflow: hidden !important;
}

#sidebarListView {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: var(--mau-nen);
}
#sidebarListView .ditich-list {
    flex: 1;
    overflow-y: auto;
}
#sidebarListView.hidden {
    display: none !important;
}

.sidebar-content.active {
    display: block;
}
.ditich-list {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--mau-nen);
}

.ditich-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.6rem;
    border-radius: var(--bo-goc-md);
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 0.4rem;
    background: var(--mau-nen-card);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ditich-item:hover {
    background: var(--mau-nen-xam);
    border-color: var(--mau-vien);
}

.ditich-item:hover {
    background: var(--mau-nen-xam);
    border-color: var(--mau-vien);
}

.ditich-item.active {
    background: #e3f2fd;
    border-color: var(--mau-chinh);
}

.ditich-thumb {
    width: 65px;
    height: 50px;
    border-radius: var(--bo-goc-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.ditich-info {
    flex: 1;
    min-width: 0;
}

.ditich-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--mau-chu-chinh);
}

.ditich-address {
    font-size: 0.75rem;
    color: var(--mau-chu-phu);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.ditich-distance {
    font-size: 0.7rem;
    color: var(--mau-chinh);
    margin-top: 0.2rem;
}
.ditich-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: white;
    color: #999;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: center;
}

.ditich-delete-btn:hover {
    background: #fee2e2;
    border-color: #e74c3c;
    color: #e74c3c;
}

.ditich-delete-btn i {
    font-size: 12px;
}
.ditich-detail {
    padding: 0.75rem;
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    user-select: text;
    -webkit-user-select: text;
}

.ditich-detail.active {
    display: flex;
}

.ditich-detail__back {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--mau-chinh);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 0.6rem;
    padding: 0.4rem;
    border-radius: var(--bo-goc-sm);
    user-select: none;
    -webkit-user-select: none;
}

.ditich-detail__back:hover {
    background: var(--mau-nen-xam);
}

.ditich-detail__gallery {
    position: relative;
    width: 100%;
    height: 160px;
    border-radius: var(--bo-goc-md);
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.ditich-detail__gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ditich-detail__video {
    width: 100%;
    border-radius: var(--bo-goc-md);
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.ditich-detail__video iframe {
    width: 100%;
    height: 200px;
    border: none;
}

.ditich-detail__gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.ditich-detail__gallery-nav--prev { left: 0.3rem; border-radius: 0 4px 4px 0; }
.ditich-detail__gallery-nav--next { right: 0.3rem; border-radius: 4px 0 0 4px; }

.ditich-detail__gallery-count {
    position: absolute;
    bottom: 0.3rem;
    right: 0.3rem;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: var(--bo-goc-full);
    font-size: 0.7rem;
}

.ditich-detail__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--mau-chu-chinh);
    flex: 1;
}

.ditich-detail__title-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.ditich-detail__edit-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mau-chu-phu);
    transition: all 0.2s;
    flex-shrink: 0;
}

.ditich-detail__edit-btn:hover {
    background: var(--mau-chinh);
    color: white;
    border-color: var(--mau-chinh);
}

.ditich-detail__meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    padding: 0.6rem;
    background: var(--mau-nen-xam);
    border-radius: var(--bo-goc-md);
    font-size: 0.8rem;
}

.ditich-detail__meta-item {
    display: flex;
    gap: 0.4rem;
    line-height: 1.4;
}

.ditich-detail__meta-item i {
    width: 16px;
    color: var(--mau-chinh);
    flex-shrink: 0;
}

.ditich-detail__desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--mau-chu-chinh);
    margin-bottom: 0.6rem;
}

/* Reset tất cả inline styles từ copy/paste */
.ditich-detail__desc * {
    font-size: inherit !important;
    line-height: inherit !important;
    font-family: inherit !important;
    color: inherit !important;
    background: transparent !important;
}

.ditich-detail__desc p,
.ditich-detail__desc span,
.ditich-detail__desc div,
.ditich-detail__desc li,
.ditich-detail__desc b,
.ditich-detail__desc strong,
.ditich-detail__desc i,
.ditich-detail__desc em,
.ditich-detail__desc u,
.ditich-detail__desc a,
.ditich-detail__desc h1,
.ditich-detail__desc h2,
.ditich-detail__desc h3,
.ditich-detail__desc h4,
.ditich-detail__desc h5,
.ditich-detail__desc h6 {
    font-size: inherit !important;
    line-height: inherit !important;
    font-family: inherit !important;
}

/* Giữ lại bold/italic nhưng reset size */
.ditich-detail__desc b,
.ditich-detail__desc strong {
    font-weight: 600 !important;
}

.ditich-detail__desc i,
.ditich-detail__desc em {
    font-style: italic !important;
}

.ditich-detail__desc a {
    color: var(--mau-chinh) !important;
    text-decoration: underline;
}

.ditich-detail__desc p {
    margin: 0 0 0.5rem 0;
}

.ditich-detail__desc p:last-child {
    margin-bottom: 0;
}

.ditich-detail__actions {
    display: flex;
    gap: 0.4rem;
}

.ditich-detail__actions .btn {
    flex: 1;
    font-size: 0.8rem;
    min-height: 38px;
}
.ditich-detail-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.ditich-detail__fixed {
    flex-shrink: 0;
}
.ditich-detail__scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin: 0.5rem 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}
.ditich-detail__actions-sticky {
    flex-shrink: 0;
    padding: 0.5rem 0 0;
    background: white;
    border-top: 1px solid var(--mau-vien);
}

.ditich-detail__actions-sticky .btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 600;
}

.btn--full {
    width: 100%;
}
.route-panel {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
    user-select: none;
    -webkit-user-select: none;
}

.route-panel.active {
    display: block;
}

.route-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--mau-vien);
    user-select: none;
    -webkit-user-select: none;
}

.route-panel__title {
    font-size: 1rem;
    font-weight: 600;
    user-select: none;
    -webkit-user-select: none;
}

.route-panel__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--mau-nen-xam);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}
.route-input-group {
    margin-bottom: 0.75rem;
}

.route-input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--mau-chu-chinh);
}

.route-input-wrapper {
    position: relative;
}

.route-input-wrapper input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2rem;
    border: 1px solid var(--mau-vien);
    border-radius: var(--bo-goc-md);
    font-size: 0.9rem;
    background: var(--mau-nen-xam);
}

.route-input-wrapper input:focus {
    outline: none;
    border-color: var(--mau-chinh);
    background: white;
}

.route-input-wrapper > i {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
}
.route-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--mau-vien);
    border-top: none;
    border-radius: 0 0 var(--bo-goc-md) var(--bo-goc-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.route-autocomplete.active {
    display: block;
}

.route-autocomplete__item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

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

.route-autocomplete__item:hover {
    background: var(--mau-nen-xam);
}

.route-autocomplete__item i {
    margin-right: 8px;
    color: var(--mau-chinh);
}
.route-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--bo-goc-md);
    margin-bottom: 8px;
    user-select: none;
    -webkit-user-select: none;
}

.route-list-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.route-list-header h4 i {
    margin-right: 6px;
}

.route-list-header .btn {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
    color: white;
    padding: 4px 10px;
    font-size: 0.75rem;
}

.route-list-header .btn:hover {
    background: rgba(255,255,255,0.3);
}
.ditich-item .route-item-number {
    position: absolute;
    left: 8px;
    top: 8px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    user-select: none;
    -webkit-user-select: none;
}
.route-sort {
    margin-bottom: 0.75rem;
}

.route-sort__label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--mau-chu-chinh);
}

.route-sort__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.route-sort__option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    background: var(--mau-nen-xam);
    border-radius: var(--bo-goc-md);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.route-sort__option:hover {
    background: #e3f2fd;
}

.route-sort__option:has(input:checked) {
    background: #e3f2fd;
    border-color: var(--mau-chinh);
}

.route-sort__option input {
    display: none;
}

.route-sort__option span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.route-sort__option i {
    font-size: 0.8rem;
    color: var(--mau-chu-phu);
}

.route-sort__option:has(input:checked) i {
    color: var(--mau-chinh);
}

.route-sort__option:has(input:checked) span {
    color: var(--mau-chinh);
    font-weight: 500;
}
.route-preview {
    margin-bottom: 0.75rem;
}

.route-preview__label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--mau-chu-chinh);
}

.route-preview__list {
    background: var(--mau-nen-xam);
    border-radius: var(--bo-goc-md);
    max-height: 180px;
    overflow-y: auto;
}

.route-preview__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--mau-vien);
    font-size: 0.8rem;
}

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

.route-preview__number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--mau-chinh);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.route-preview__name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-preview__distance {
    color: var(--mau-chu-phu);
    font-size: 0.75rem;
}

.route-preview__empty {
    padding: 1rem;
    text-align: center;
    color: var(--mau-chu-phu);
    font-size: 0.85rem;
}
.route-actions {
    display: flex;
    gap: 0.5rem;
}

.route-actions .btn {
    flex: 1;
    font-size: 0.85rem;
    min-height: 40px;
}

.route-status {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #e8f5e9;
    border-radius: var(--bo-goc-md);
    font-size: 0.8rem;
    text-align: center;
    color: #2e7d32;
    display: none;
}

.route-status.show {
    display: block;
}

.route-status.error {
    background: #ffebee;
    color: #c62828;
}
@media (max-width: 1023px) {
    .map-layout {
        flex-direction: column;
        height: calc(100vh - 60px);
    }
    
    .map-container {
        height: 100%;
    }
    
    
    .map-controls {
        top: 0.5rem;
        width: 95%;
        max-width: none;
    }
    
    .map-search-box {
        display: none;
    }
    
    .map-category {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .map-category::-webkit-scrollbar {
        display: none;
    }
    
    .map-category-item {
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }
}
.empty-state {
    text-align: center;
    padding: 1.5rem 0.75rem;
    color: var(--mau-chu-phu);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.85rem;
}

.loading-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
    color: var(--mau-chu-phu);
}

.loading-message i {
    font-size: 2rem;
    color: var(--mau-chinh);
}

.loading-message span {
    font-size: 0.9rem;
}

.route-panel-mobile {
    padding: 0.5rem 0;
}

.route-panel-mobile .ditich-detail__back {
    margin-bottom: 8px;
}

.route-panel-mobile .route-input-group {
    margin-bottom: 1rem;
}

.route-panel-mobile .route-sort {
    margin-bottom: 1rem;
}

.route-panel-mobile .route-actions {
    margin-top: 0.5rem;
}

.route-panel-mobile .route-actions .btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}
.bottom-sheet--custom:has(.route-panel-mobile) {
    height: auto !important;
    max-height: 60vh !important;
}
.leaflet-routing-container {
    background: white;
    padding: 10px;
    border-radius: var(--bo-goc-md);
    box-shadow: var(--bong-md);
    max-width: 320px;
    max-height: 50vh;
    overflow-y: auto;
    font-size: 0.85rem;
}

@media (min-width: 1024px) {
    .leaflet-routing-container {
        position: fixed !important;
        right: 20px !important;
        bottom: 20px !important;
        left: auto !important;
        top: auto !important;
    }
}

.leaflet-routing-alt {
    padding: 8px;
}

.leaflet-routing-alt h2 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--mau-chinh);
}

.leaflet-routing-alt h3 {
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.leaflet-routing-alt table {
    width: 100%;
    font-size: 0.8rem;
}

.leaflet-routing-alt td {
    padding: 4px 0;
}
.route-marker {
    background: transparent !important;
    border: none !important;
}
@media (max-width: 1023px) {
    .leaflet-routing-container {
        max-width: 280px;
        font-size: 0.8rem;
        max-height: 40vh;
    }
    
    .leaflet-routing-alt {
        padding: 6px;
    }
}
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Đảm bảo popup hiển thị trên sidebar */
.leaflet-popup-pane {
    z-index: 2000 !important;
}

.leaflet-popup {
    z-index: 2000 !important;
}

.leaflet-popup-content {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.leaflet-popup-close-button {
    font-size: 24px !important;
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    top: 8px !important;
    right: 8px !important;
    color: #666 !important;
    font-weight: bold !important;
    background: rgba(255,255,255,0.9) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    z-index: 10 !important;
}

.leaflet-popup-close-button:hover {
    color: #e74c3c !important;
    background: white !important;
}

.popup-ditich {
    font-family: inherit;
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    padding: 10px;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.popup-ditich h3 {
    text-align: center;
    margin: 0 25px 5px 0;
    font-weight: 700;
    font-size: 1rem;
    color: #1a5276;
    line-height: 1.3;
    word-wrap: break-word;
}

.popup-ditich p {
    margin: 4px 0;
    color: var(--mau-chu);
}

.popup-ditich p b {
    color: var(--mau-chu);
}
.popup-gallery {
    position: relative;
    width: 100%;
    height: 140px;
    margin: 8px 0;
    background: #eee;
    border-radius: 6px;
    overflow: hidden;
}

.popup-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
}

.popup-nav-prev { left: 3px; }
.popup-nav-next { right: 3px; }

.popup-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 10px;
}

.popup-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.popup-actions button {
    flex: 1;
    padding: 8px 6px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s;
}

.popup-actions button.btn-detail {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.popup-actions button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.popup-sukien {
    margin: 6px 0;
    padding: 0;
}

.popup-sukien-title {
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    font-size: 0.85rem;
}

.popup-sukien ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.popup-sukien li {
    padding: 2px 0;
    font-size: 0.8rem;
    color: #333;
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1.3;
}

.popup-sukien li::before {
    content: "•";
    color: #e74c3c;
    font-weight: bold;
    flex-shrink: 0;
}

.popup-sukien .sk-name {
    color: #c0392b;
    font-weight: 500;
}

.popup-sukien .sk-time {
    color: #666;
    font-size: 0.85em;
}
@media (max-width: 768px) {
    .popup-ditich {
        width: 240px !important;
        min-width: 240px !important;
        max-width: 240px !important;
        padding: 8px !important;
        font-size: 0.75rem !important;
    }
    
    .popup-ditich h3 {
        font-size: 0.85rem !important;
        margin: 0 20px 4px 0 !important;
    }
    
    .popup-gallery {
        height: 100px !important;
        margin: 6px 0 !important;
    }
    
    .popup-ditich p {
        margin: 3px 0 !important;
        font-size: 0.7rem !important;
    }
    
    .popup-sukien {
        margin: 4px 0 !important;
    }
    
    .popup-sukien-title {
        font-size: 0.7rem !important;
        margin-bottom: 2px !important;
    }
    
    .popup-sukien li {
        font-size: 0.65rem !important;
        padding: 1px 0 !important;
    }
    
    .popup-actions {
        margin-top: 6px !important;
        gap: 4px !important;
    }
    
    .popup-actions button {
        padding: 5px 4px !important;
        font-size: 0.7rem !important;
    }
}
.custom-tooltip {
    background: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.custom-tooltip::before {
    border-top-color: white;
}

.leaflet-routing-container .leaflet-routing-collapse-btn {
    display: none !important;
}
.sidebar-online {
    display: flex;
    align-items: center;
    gap: var(--khoang-cach-xs);
    padding: var(--khoang-cach-sm);
    margin: 0 0.5rem 0.5rem 0.5rem;
    background: var(--mau-nen-xam);
    border-radius: var(--bo-goc-md);
    font-size: var(--font-size-xs);
    color: var(--mau-chu-phu);
    flex-shrink: 0;
}
@media (max-width: 1023px) {
    .sidebar-online {
        display: none !important;
    }
}

.sidebar-online i {
    font-size: 8px;
    color: var(--mau-thanh-cong);
    animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sidebar-online strong {
    color: var(--mau-chu-chinh);
}

.sidebar-online .online-text {
    margin-right: 0.2rem;
}

/* Fix leaflet controls không đè lên sidebar */
@media (min-width: 1024px) {
    /* Di chuyển attribution sang bên phải */
    .leaflet-control-attribution {
        right: 10px !important;
        left: auto !important;
    }
    
    /* Leaflet control containers không chặn pointer events */
    .leaflet-control-container {
        pointer-events: none;
    }
    
    .leaflet-control-container .leaflet-control {
        pointer-events: auto;
    }
    
    /* Ẩn controls bên trái trên desktop */
    .leaflet-bottom.leaflet-left {
        display: none !important;
    }
    
    /* Đảm bảo sidebar luôn nhận pointer events và ở trên map */
    .map-sidebar {
        pointer-events: auto !important;
        z-index: 1500 !important;
    }
    
    .map-sidebar * {
        pointer-events: auto;
    }
}

/* Route panel user-select */
.route-panel {
    user-select: none;
    -webkit-user-select: none;
}

.route-panel input {
    user-select: text;
    -webkit-user-select: text;
}

.route-input-group,
.route-input-group label,
.route-sort,
.route-sort__label,
.route-sort__option,
.route-sort__options,
.route-actions {
    user-select: none;
    -webkit-user-select: none;
}
