/* Bản đồ dự án: bản đồ phủ kín màn hình (trừ header), danh sách nổi bên trái */

.pmap {
    position: relative;
    height: calc(100vh - 72px);
    height: calc(100dvh - 72px);
    min-height: 560px;
    overflow: hidden;
    background: #E5E7EB;
}

.pmap.is-fullscreen {
    height: 100vh;
}

.pmap-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* Cột danh sách bên trái */

.pmap-panel {
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    width: 328px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    background: #FFF;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.pmap-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #E5E7EB;
}

.pmap-search-box {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 4px 4px 4px 12px;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
    background: #F8FAFC;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.pmap-search-box:focus-within {
    border-color: #EF0032;
    box-shadow: 0 0 0 3px rgba(239, 0, 50, 0.10);
}

.pmap-search-box svg {
    flex: 0 0 18px;
}

.pmap-search-box input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #1E293B;
    font: inherit;
    font-size: 14px;
    outline: none;
}

.pmap-search-box input::placeholder {
    color: #6B7280;
}

.pmap-search-box input::-webkit-search-cancel-button {
    display: none;
}

.pmap-search-submit {
    display: inline-flex;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #EF0032;
    cursor: pointer;
    transition: background 160ms ease;
}

.pmap-search-submit:hover {
    background: #FFA228;
}

.pmap-filter-btn {
    position: relative;
    display: inline-flex;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
    background: #F8FAFC;
    color: #6B7280;
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.pmap-filter-btn:hover,
.pmap-filter-btn.has-filter {
    border-color: #EF0032;
    background: #FFF1F3;
    color: #EF0032;
}

.pmap-filter-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #EF0032;
    color: #FFF;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.pmap-count {
    margin: 0;
    padding: 10px 14px 4px;
    color: #6B7280;
    font-size: 13px;
    line-height: 18px;
}

.pmap-count a {
    color: #EF0032;
    text-decoration: none;
}

.pmap-count a:hover {
    text-decoration: underline;
}

.pmap-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    margin: 0;
    padding: 8px 12px 12px;
    overflow-y: auto;
    list-style: none;
    scrollbar-width: thin;
}

.pmap-item {
    display: flex;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
    background: #FFF;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.pmap-item:hover {
    border-color: rgba(239, 0, 50, 0.40);
}

.pmap-item.is-active {
    border-color: #EF0032;
    background: #FFF5F7;
    box-shadow: 0 2px 8px rgba(239, 0, 50, 0.12);
}

.pmap-item img {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    object-fit: cover;
    background: #F1F5F9;
}

.pmap-item-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.pmap-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pmap-item-tags .project-row-category,
.pmap-item-tags .project-row-status {
    padding: 3px 5px;
    font-size: 11px;
    line-height: 11px;
}

.pmap-item-title {
    display: -webkit-box;
    overflow: hidden;
    color: #1E293B;
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.pmap-empty {
    padding: 24px 8px;
    color: #6B7280;
    font-size: 14px;
    text-align: center;
}

.pmap-empty a {
    color: #EF0032;
}

/* Chấm đỏ trên bản đồ */

.pmap-marker {
    border: 0;
    background: transparent;
}

.pmap-marker span {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 4px solid #FFF;
    background: #EF0032;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.30);
    transition: transform 160ms ease;
}

.pmap-marker:hover span {
    transform: scale(1.1);
}

.pmap-marker.is-active span {
    transform: scale(1.15);
    box-shadow: 0 0 0 8px rgba(239, 0, 50, 0.25), 0 2px 8px rgba(15, 23, 42, 0.30);
}

.pmap-cluster {
    border: 0;
    background: transparent;
}

.pmap-cluster span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 4px solid #FFF;
    background: #EF0032;
    box-shadow: 0 0 0 6px rgba(239, 0, 50, 0.20), 0 2px 8px rgba(15, 23, 42, 0.30);
    color: #FFF;
    font-size: 14px;
    font-weight: 700;
}

/* Popup thẻ dự án */

.pmap-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
}

.pmap-popup .leaflet-popup-content {
    width: min(408px, calc(100vw - 48px)) !important;
    margin: 0;
    font-family: var(--font-base);
    line-height: normal;
}

.pmap-popup .project-row {
    box-shadow: none;
}

/* Bỏ style mặc định của Leaflet (link xanh, lề đoạn văn) trong thẻ dự án */
.pmap-popup .leaflet-popup-content p {
    margin: 0;
}

.pmap-popup .project-row-title a {
    color: inherit;
}

.pmap-popup .project-row-foot {
    color: inherit;
}

.pmap-popup .leaflet-popup-close-button {
    top: 6px !important;
    right: 6px !important;
    z-index: 5;
    width: 26px !important;
    height: 26px !important;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92) !important;
    color: #1E293B !important;
    font-size: 18px !important;
    line-height: 24px !important;
}

/* Nút điều khiển góc phải */

.pmap-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 16px 20px 0 !important;
}

.pmap-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    background: #FFF;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    color: #1E293B;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.pmap-controls button:hover {
    border-color: #EF0032;
    color: #EF0032;
}

.pmap-controls button.is-primary {
    border-color: #EF0032;
    background: #EF0032;
    color: #FFF;
}

.pmap-controls button.is-primary:hover {
    border-color: #FFA228;
    background: #FFA228;
    color: #FFF;
}

@media (max-width: 767px) {
    .pmap {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .pmap-canvas {
        position: relative;
        order: 1;
        height: 60vh;
        min-height: 380px;
    }

    .pmap-controls {
        margin: 0 12px 12px 0 !important;
    }

    .pmap-panel {
        position: static;
        order: 2;
        width: auto;
        margin: 12px 15px 24px;
    }

    /* Danh sách dự án cuộn ngang: mỗi lần 1 thẻ, hé thẻ kế tiếp, vuốt dừng đúng mép thẻ */
    .pmap-list {
        flex-direction: row;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 12px;
        scrollbar-width: none;
    }

    .pmap-list::-webkit-scrollbar {
        display: none;
    }

    .pmap-list > li {
        display: flex;
        flex: 0 0 86%;
        scroll-snap-align: start;
    }

    .pmap-list > li.pmap-empty {
        flex-basis: 100%;
    }

    .pmap-list .pmap-item {
        height: 100%;
    }
}

/* Ngăn "Tìm kiếm nâng cao" trượt ra cạnh danh sách */

.pmap-filter {
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 352px;
    z-index: 499;
    display: flex;
    flex-direction: column;
    width: 328px;
    margin: 0;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    background: #FFF;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-24px);
    transition: opacity 200ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 240ms;
}

.pmap-filter.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 200ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

.pmap-filter-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #F1F5F9;
    background: rgba(248, 250, 252, 0.50);
}

.pmap-filter-head > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.pmap-filter-head h2 {
    margin: 0;
    color: #0F172A;
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;
}

.pmap-filter-close {
    display: inline-flex;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.pmap-filter-close:hover {
    background: #F1F5F9;
}

.pmap-filter-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.pmap-filter-foot {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #F1F5F9;
}

.pmap-filter-foot .project-advanced-btn {
    min-width: 0;
    text-decoration: none;
}

/* Chấm đỏ: 24px, chấm đang chọn 34px */

.pmap-marker span {
    width: 24px;
    height: 24px;
    margin: 5px;
    border-width: 3px;
    transition: width 160ms ease, height 160ms ease, margin 160ms ease, box-shadow 160ms ease;
}

.pmap-marker:hover span {
    transform: none;
    width: 28px;
    height: 28px;
    margin: 3px;
}

.pmap-marker.is-active span {
    transform: none;
    width: 34px;
    height: 34px;
    margin: 0;
    border-width: 4px;
}

@media (max-width: 767px) {
    .pmap-filter {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        z-index: 1300;
        width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(40px);
    }
}

/* Ghi công nguồn bản đồ (bắt buộc theo giấy phép): thu nhỏ, làm mờ */
.leaflet-control-attribution {
    padding: 0 6px !important;
    background: rgba(255, 255, 255, 0.6) !important;
    color: #94A3B8 !important;
    font-size: 9px !important;
    line-height: 14px !important;
}
