/* ===== MAP AMENITIES (TIỆN ÍCH XUNG QUANH) ===== */

/* Nút Xem tiện ích trên Popup */
.popup-amenities-btn {
    flex: 1;
    background-color: #f0fdf4;
    color: #059669;
    border: 1px solid #10b981;
    border-radius: 6px;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.popup-amenities-btn:hover {
    background-color: #d1fae5;
}

.popup-amenities-btn.active {
    background-color: #fef2f2;
    color: #ef4444;
    border-color: #f87171;
}

.popup-amenities-btn.active:hover {
    background-color: #fee2e2;
}

.popup-amenities-btn.loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

.popup-amenities-btn.loading i {
    animation: fa-spin 1s infinite linear;
}

/* Flexbox container cho 2 nút trong popup */
.popup-actions-container {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

/* Custom styles cho Amenities Marker */
.amenity-marker-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    /* Cho phép click */
    cursor: pointer;
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.amenity-marker-wrapper.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.amenity-icon-container {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    z-index: 2;
}

/* Màu sắc theo loại tiện ích */
.amenity-marker-wrapper.school .amenity-icon-container {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.amenity-marker-wrapper.hospital .amenity-icon-container {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.amenity-marker-wrapper.market .amenity-icon-container {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.amenity-marker-wrapper.park .amenity-icon-container {
    background: linear-gradient(135deg, #10b981, #059669);
}

.amenity-marker-wrapper.government .amenity-icon-container {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed); /* Tím */
}

/* Nhãn khoảng cách (vd: Trường học · 850 m) */
.amenity-label {
    background-color: white;
    color: #1e293b;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    margin-top: -6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 3;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.amenity-label-name {
    display: none;
    color: #64748b;
    font-weight: 500;
}

.amenity-marker-wrapper.expanded .amenity-label-name {
    display: block !important;
}

.amenity-marker-wrapper.expanded .amenity-label-name::after {
    content: " ·";
}

/* Điểm nháy nhỏ xíu ở dưới icon */
.amenity-pin-dot {
    width: 6px;
    height: 6px;
    background-color: #1e293b;
    border-radius: 50%;
    margin-top: 2px;
}

/* Ẩn các phần tử khác khi đang xem tiện ích */
body.hide-other-markers .property-marker-wrapper:not(.active-amenities-marker),
body.hide-other-markers .cluster-wrapper,
body.hide-other-markers .maplibre-highlight-marker,
body.hide-other-markers .custom-img-marker:not(.active-amenities-marker),
body.hide-other-markers .custom-camera-icon,
body.hide-other-markers .image-marker-tag-popup {
    display: none !important;
}

/* Đảm bảo marker tin đăng đang xem tiện ích luôn hiển thị */
body.hide-other-markers .property-marker-wrapper.active-amenities-marker,
body.hide-other-markers .custom-img-marker.active-amenities-marker {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Thu nhỏ điểm ảnh của tin đăng đang xem tiện ích */
body.hide-other-markers .custom-img-marker.active-amenities-marker .custom-img-marker-inner {
    width: 32px !important;
    height: 32px !important;
    border-width: 2px !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

/* Giao diện nút tắt tiện ích dạng tròn Maplibre Control */
.fixed-clear-amenities-btn {
    width: 29px;
    height: 29px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    outline: none;
    border-radius: 4px;
}

.fixed-clear-amenities-btn:hover {
    background-color: #f3f4f6;
}

.fixed-clear-amenities-btn i {
    color: #ef4444;
    /* Màu đỏ nổi bật hành động đóng */
    font-size: 16px;
}