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

.maps-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

.maps-header {
    flex-shrink: 0;
    z-index: 1000;
}

.maps-header .glass-header {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#map {
    flex: 1;
    width: 100%;
    z-index: 1;
}

/* Custom Leaflet Popup */
.leaflet-popup-content-wrapper {
    background: #232323d6;
    border: 1px solid #454545c7;
    border-radius: 10px;
    color: #353535;
}

.leaflet-popup-tip {
    background: #232323d6;
}

.leaflet-popup-content {
    margin: 10px;
    min-width: 200px;
    max-width: 250px;
}

/* Let the map keep receiving drag/zoom gestures while a popup is open. */
.leaflet-popup,
.leaflet-popup-content-wrapper,
.leaflet-popup-content,
.leaflet-popup-tip {
    pointer-events: none;
}

.leaflet-popup-close-button,
.map-popup-slug,
.map-popup-link,
.map-popup-owner-link {
    pointer-events: auto;
}

.map-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.map-popup-slug {
    font-size: 13px;
    color: #ff9800;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.map-popup-slug:hover {
    opacity: 0.8;
}

.ios-note-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
}

.ios-note-badge.active {
    background: #10b981;
    color: #fff;
}

.ios-note-badge.inactive {
    background: #ffc107;
    color: #252525;
}

.map-popup-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 6px;
    color: #fff;
    word-break: break-word;
    line-height: 1.4;
}

.map-popup-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.map-popup-time {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.map-popup-time i {
    margin-right: 4px;
}

.map-popup-comments {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.map-popup-comments i {
    color: #f59e0b;
}

.map-popup-comments span {
    font-weight: 600;
}

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

.map-popup-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 6px 14px;
    background: #8f6220;
    color: #ffffff !important;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s;
}

.map-popup-link:hover {
    background: #a16c1c;
}

.map-popup-link i {
    margin-right: 8px;
}

/* Custom Note Marker */
.note-marker-icon {
    position: relative;
    width: 36px;
    height: 44px;
}

.note-marker-icon svg {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s;
}

.note-marker-icon:hover svg {
    transform: scale(1.1);
}

.map-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 200px;
    transform: translate(-50%, -50%);
    z-index: 500;
    backdrop-filter: blur(10px);
    padding: 2rem 2.5rem;
    border-radius: 1rem;
    background: #232323d6;
    border: 1px solid #454545c7;
    text-align: center;
    color: #e2e8f0;
}

.map-empty-state i {
    font-size: 2.5rem;
    color: #f59e0b;
    margin-bottom: 1rem;
    display: block;
}

.map-empty-state p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
    color: #94a3b8;
}

.map-note-count {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: #222222;
    padding: 10px;
    color: #ffffff;
    font-size: 11px;
}

.map-note-count i {
    margin-right: 6px;
    color: #ffbf0eff;
}

/* Custom Marker Cluster Styles */
.marker-cluster-small {
    background-color: rgba(251, 191, 36, 0.6);
}

.marker-cluster-small div {
    background-color: #ff9022;
    color: #ffffff;
}

.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(245, 158, 11, 0.9);
    color: #fff;
}

.marker-cluster-large {
    background-color: rgba(217, 119, 6, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(217, 119, 6, 0.9);
    color: #fff;
}

.marker-cluster {
    background-clip: padding-box;
    border-radius: 20px;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 700;
    line-height: 30px;
}

/* Leaflet controls z-index */
.leaflet-top,
.leaflet-bottom {
    z-index: 400;
}

/* Note List Drawer */
#note-drawer {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    max-width: 100vw;
    height: 100vh;
    background: #000000eb;
    z-index: 1050;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.5);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#note-drawer.open {
    right: 0;
}

#note-drawer-header {
    padding: 15px 20px;
    background: #252525d4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

#note-drawer-title {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

#note-drawer-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

#note-drawer-close:hover {
    color: white;
}

#note-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px 10px;
}

#note-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1040;
    display: none;
}

#note-overlay.show {
    display: block;
}

/* Note List Items */
.note-list-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-list-item.note-list-item-selected {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 159, 11, 0.329);
}

.note-list-item.note-list-item-selected .note-list-title,
.note-list-item.note-list-item-selected .note-owner-name {
    color: #fff7e0;
}

.note-list-item.note-list-item-selected .note-list-address,
.note-list-item.note-list-item-selected .note-list-meta,
.note-list-item.note-list-item-selected .note-list-comments {
    color: #e2e8f0;
}

.note-list-item:hover {
    transform: translateY(-2px);
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 159, 11, 0.329);
}

.note-list-item:last-child {
    margin-bottom: 0;
}

.note-list-title {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 10px;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.note-list-address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: -4px;
    margin-bottom: 10px;
    font-size: 0.84rem;
    color: #94a3b8;
    line-height: 1.4;
}

.note-list-address i {
    flex-shrink: 0;
    color: #f59e0b;
    margin-top: 2px;
}

.note-list-address-text {
    display: block;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.note-list-meta {
    font-size: 0.82rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.note-list-comments {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    color: #cbd5e1;
}

.note-list-comments i {
    color: #f59e0b;
}

.note-list-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.note-list-status.pub {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.note-list-status.nhap {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Scrollbar cho drawer */
#note-drawer-body::-webkit-scrollbar {
    width: 6px;
}

#note-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

#note-drawer-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

#note-drawer-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 780px) {
    #note-drawer {
        width: 100vw;
        right: -100vw;
    }
}

/* Maps.php (public notes) enhancements */
.note-avatar-marker-wrapper {
    background: transparent;
    border: none;
}

.note-avatar-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid #ffffff;
    background: #ffffff;
    transition: transform 0.2s ease, z-index 0s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-avatar-marker:hover {
    transform: scale(1.15);
    z-index: 1000 !important;
}

.note-avatar-marker.is-pending {
    border: 2px dashed #ffc107;
    opacity: 0.85;
}

.note-avatar-marker.is-pending::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 193, 7, 0.6);
    pointer-events: none;
}

.note-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.note-avatar-initial {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.note-level-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.map-popup-tags {
    margin-bottom: 10px;
}

.map-popup-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.map-popup-tag.owner {
    border-color: #64748b;
    color: #94a3b8;
}

.map-popup-owner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.map-popup-owner-link,
.note-owner-link {
    color: inherit;
    text-decoration: none;
}

.map-popup-owner-link:hover .map-popup-owner-name,
.note-owner-link:hover .note-owner-name {
    color: #93c5fd;
}

.map-popup-owner-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(148, 163, 184, 0.26);
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    overflow: hidden;
}

.map-popup-owner-avatar img,
.note-owner-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-popup-owner-name {
    color: #cbd5e1;
    font-size: 0.84rem;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

#note-taxonomy-filter {
    position: static;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    border-bottom: none;
}

.note-taxonomy-title {
    color: #cbd5e1;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.note-taxonomy-title i {
    margin-right: 5px;
    color: #f59e0b;
}

.note-taxonomy-scroll-shell {
    position: relative;
    overflow: hidden;
    padding: 0 28px;
}

.note-taxonomy-scroll-shell::before,
.note-taxonomy-scroll-shell::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 26px;
    z-index: 2;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.note-taxonomy-scroll-shell::before {
    left: 0;
    background: linear-gradient(90deg, #272727 0%, rgba(30, 41, 59, 0) 100%);
}

.note-taxonomy-scroll-shell::after {
    right: 0;
    background: linear-gradient(270deg, #272727 0%, rgba(30, 41, 59, 0) 100%);
}

.note-taxonomy-scroll-shell.is-at-start::before {
    opacity: 0;
}

.note-taxonomy-scroll-shell.is-at-end::after {
    opacity: 0;
}

.note-taxonomy-dashed-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 6px;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-x;
}

.note-taxonomy-dashed-list::-webkit-scrollbar {
    display: none;
}

.note-tax-chip {
    border: none;
    border-radius: 5px;
    background: #444444;
    color: #cbd5e1;
    padding: 7px 10px;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex: 0 0 auto;
    transition: all 0.2s ease;
    position: relative;
}

.note-tax-chip.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    filter: grayscale(0.5);
}

.note-taxonomy-dashed-list.note-taxonomy-bricks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px;
    background: #2f2f2f;
    border-bottom: 1px solid #444;
    ;
}

.note-taxonomy-dashed-list.note-taxonomy-bricks.is-collapsed {
    row-gap: 8px;
}

.note-drawer-login {
    background: #fff;
    padding: 20px;
    color: #333;
}

.note-drawer-login a {
    text-decoration: none;
    font-weight: 600;
    color: #9b783b;
}

.note-tax-toggle-btn {
    background: rgba(245, 158, 11, 0.08);
    color: #fbbf24;
}

.note-tax-toggle-btn:hover {
    color: #fff3cd;
    border-color: rgba(245, 158, 11, 0.7);
    background: rgba(245, 158, 11, 0.16);
}

.note-tax-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(calc(-50% - 3px));
    width: 24px;
    height: 24px;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.note-tax-scroll-btn.prev {
    left: 0;
}

.note-tax-scroll-btn.next {
    right: 0;
}

.note-tax-scroll-btn:hover:not(:disabled) {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(255, 255, 255, 0.2);
}

.note-tax-scroll-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.note-taxonomy-scroll-shell.is-dragging .note-taxonomy-dashed-list {
    cursor: grabbing;
}

.note-taxonomy-scroll-shell.is-dragging .note-tax-chip {
    pointer-events: none;
}

@media (max-width: 768px) {
    .note-taxonomy-scroll-shell {
        padding: 0;
    }

    .note-taxonomy-scroll-shell::before,
    .note-taxonomy-scroll-shell::after {
        width: 22px;
    }

    .note-tax-scroll-btn {
        display: none;
    }
}

.note-tax-chip:hover {
    color: #b6b6b6;
}

.note-tax-chip.active {
    border-style: solid;
    border: none;
    color: #fff;
    background: rgba(245, 158, 11, 0.2);
}

.chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.note-list-color-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 7px;
    flex-shrink: 0;
    vertical-align: middle;
}

.note-list-slug {
    font-size: 0.78rem;
    color: #f59e0b;
    font-weight: 500;
    margin-left: 6px;
}

.note-list-tax-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    border-bottom: 1px dashed #cccccc1c;
}

.note-tax-badge {
    font-size: 12px;
    padding-bottom: 10px;
}

.note-tax-badge {
    font-weight: 700;
}

.note-owner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.note-owner-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.26);
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    overflow: hidden;
}

.note-owner-name {
    color: #cbd5e1;
    font-size: 0.84rem;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Admin delete button on note list items */
.note-list-item {
    position: relative;
}

.map-admin-action-group {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.map-admin-action-btn {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s;
    z-index: 10;
    padding: 0;
}

.map-admin-approve-btn {
    background: #10b981;
}

.map-admin-delete-btn {
    background: #ef4444;
}

.note-list-item:hover .map-admin-action-btn {
    opacity: 1;
    transform: scale(1);
}

.map-admin-approve-btn:hover {
    background: #059669;
    transform: scale(1.12) !important;
}

.map-admin-delete-btn:hover {
    background: #dc2626;
    transform: scale(1.12) !important;
}

.chip-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 1.5px solid #1a1a1a;
    z-index: 12;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chip-badge {
    top: -8px;
    right: -4px;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
}

@keyframes fadeup {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#interests-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

#interests-modal {
    background: #161b229f;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 36px 32px 28px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    animation: fadeup 0.35s ease both;
    margin: 20px;
    box-sizing: border-box;
}

#btn-interests-save {
    padding: 10px 22px;
    border-radius: 10px;
    border: none;
    background: #33415594;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}