﻿#map {
    width: 100%;
    height: calc(100vh - 70px);
}

/* Logo */
.map-container .logo {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1;
}

/* Drawer */
.map-container .drawer-container {
    position: absolute;
    height: 100%;
    width: 350px;
    z-index: 3;
    top: 0;
    left: -100%;
    transition: all 0.5s ease;
}


.map-container .drawer-container.active {
    left: 0;
}

.map-container .js-show-drawer-btn {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    border-radius: 0 5px 5px 0;
}

.map-container .drawer-container .js-hide-drawer-btn {
    position: absolute;
    top: 50%;
    right: -20px;
    height: 60px;
    width: 20px;
    z-index: 3;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}

.map-container .drawer-container .js-hide-drawer-btn:hover {
    height: 65px;
    width: 25px;
    right: -25px;
}

.map-container .drawer-container .js-hide-drawer-btn::after,
.map-container .drawer-container .js-hide-drawer-btn::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 0;
    border-radius: 50%;
    background-color: transparent;
    pointer-events: none;
}

.map-container .drawer-container .js-hide-drawer-btn::before {
    top: -20px;
    box-shadow: -7px 6px 0 -4.5px #F1F1F4;
}

.map-container .drawer-container .js-hide-drawer-btn::after {
    bottom: -20px;
    box-shadow: -7px -6px 0 -4.5px #F1F1F4;
}

.map-container .drawer-container .drawer-body {
    height: calc(100% - 65px);
}

.map-container .drawer-container .drawer-header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -20px;
    width: 100%;
    height: 20px;
    background: linear-gradient(0deg, transparent, #F1F1F4 100%);
    z-index: 3;
}

/* Region Labels */
.region-label {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 18px;
    color: #1e293b;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    white-space: nowrap;
    text-align: center;
    backdrop-filter: blur(10px);
}

/* Province / Project Markers */
.province-marker {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.25s ease;
}

.province-marker:hover {
    transform: translateY(-6px) scale(1.08);
}

.province-marker .pin-head {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(145deg, #d8bfa8, #c4a07d);
    border: 2.5px solid white;
    box-shadow: 0 4px 14px rgba(180, 140, 100, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 17px;
}

    .province-marker .pin-tail {
        width: 0;
        height: 0;
        border-left: 7px solid transparent;
        border-right: 7px solid transparent;
        border-top: 11px solid #c4a07d;
        margin: 0 auto;
    }

/* Cluster Marker */
.project-cluster-marker {
    position: relative;
    width: 54px;
    height: 54px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-cluster-marker .cluster-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid #c4a07d;
    animation: cluster-pulse 2.2s ease-out infinite;
    opacity: 0;
}

.project-cluster-marker .cluster-inner {
    position: relative;
    z-index: 1;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(145deg, #fff8f2, #f0e4d4);
    border: 3px solid #c4a07d;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 18px rgba(189, 162, 135, 0.3);
    transition: transform 0.2s ease;
}

.project-cluster-marker:hover .cluster-inner {
    transform: scale(1.12);
}

.project-cluster-marker .cluster-count {
    color: #8a6857;
    font-weight: 800;
    font-size: 17px;
    line-height: 1;
}

@keyframes cluster-pulse {
    0%   { transform: scale(0.9);  opacity: 0.75; }
    100% { transform: scale(1.65); opacity: 0; }
}

/* Info Panel */
.info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 1;
    min-width: 280px;
    backdrop-filter: blur(20px);
}

.info-panel h2 {
    margin: 0 0 10px 0;
    color: #1a5f3f;
    font-size: 18px;
    border-bottom: 2px solid #22c55e;
    padding-bottom: 8px;
}

.info-panel p {
    color: #64748b;
    font-size: 14px;
    margin: 8px 0;
    line-height: 1.6;
}

.back-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 15px;
    width: 100%;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 3px 12px rgba(34, 197, 94, 0.3);
}

.back-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(34, 197, 94, 0.4);
}

.project-list {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.project-item {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
    border-right: 3px solid #22c55e;
}

.project-item strong {
    color: #1a5f3f;
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.project-item small {
    color: #64748b;
    font-size: 12px;
}

/* Controls */
.controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.controls button {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    margin: 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.controls button:hover {
    background: #f8fafc;
}

/* Popup Customization */
.mapboxgl-popup-content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    backdrop-filter: blur(10px);
    min-width: 200px;
    max-width: 260px;
}

.popup-projects-list {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
    gap: 0;
}

.popup-project-link {
    display: block;
    text-decoration: none;
    padding: 8px 4px;
/*    border-bottom: 1px solid #f1f5f9;*/
    transition: background 0.15s, padding-inline-start 0.15s;
    border-radius: 4px;
}

.popup-project-link:last-child {
    border-bottom: none;
}

.popup-project-link:hover {
    background: var(--bs-light-active);
    padding-inline-start: 8px;
}

    .popup-project-link:focus-visible {
        outline: unset;
    }

.popup-project-name {
    color: #1e293b;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 3px;
}

.popup-project-meta {
    color: #94a3b8;
    font-size: 11px;
}

.popup-title {
    font-weight: 700;
    font-size: 16px;
    color: #1a5f3f;
    margin-bottom: 6px;
}

.popup-info {
    color: #64748b;
    font-size: 13px;
}

/* Loading */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    padding: 30px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    z-index: 1;
    display: none;
    backdrop-filter: blur(20px);
}

    .loading.active {
        display: block;
    }

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #22c55e;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========== Custom Region Labels ========== */
.custom-region-label {
    cursor: pointer;
}

.custom-region-label:hover {
    transform: scale(1.1);
    z-index: 3;
}

.label-container {
    background: rgb(126 126 126 / 43%);
    box-shadow: 0 2px 7px 0 rgba(0, 0, 0, 0.1490196078);
    padding: 12px 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.label-text {
    color: #fdfdfd;
    font-weight: 400;
    font-size: 18px;
    line-height: 22.5px;
    text-transform: uppercase;
}

.label-data {
    background: #ffffff;
    color: #707070;
    font-size: 14px;
    width: 24px;
    height: 24px;
    padding: 5px;
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animated pulse effect on hover */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.custom-region-label:hover .label-container {
    animation: pulse 1s infinite;
    width: auto;
    height: 52px;
    padding: 12px 20px;
    border-radius: 16px;
}
