/* =========================================================
   TREE MAP STYLES
   Global (not scoped), because Leaflet creates its own HTML
   that scoped .razor.css can't reach.
   Used by: wwwroot/js/tree-map.js, TreeMap.razor (/map), TreeDetail.razor
   ========================================================= */

/* ---------- The <tree-map> element ---------- */
tree-map {
    display: block;
    position: relative;
    height: 420px;
    border-radius: 24px;
    overflow: hidden;
    background: #143220;
    box-shadow: 0 16px 40px rgba(20, 50, 32, 0.18);
}

    tree-map.map-full {
        height: calc(100vh - 260px);
        min-height: 460px;
    }

    tree-map.map-mini {
        height: 320px;
    }

.tree-map-canvas {
    position: absolute;
    inset: 0;
    font-family: inherit;
}

.tree-map-error {
    color: #f3ecd8;
    text-align: center;
    padding: 40px 16px;
}

/* ---------- Tree pins ---------- */
.tree-pin {
    background: #2E7D32;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    display: flex !important;
    align-items: center;
    justify-content: center;
    /* NOTE: never put "transform" on .tree-pin itself - Leaflet uses it to position the pin */
}

.tree-pin-emoji {
    font-size: 15px;
    line-height: 1;
    transition: transform 0.2s;
}

.tree-pin:hover .tree-pin-emoji {
    transform: scale(1.25);
}

.tree-pin-number {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #f2c66d;
    color: #143220;
    font-size: 10px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* The tree whose page you are on: gold and gently bouncing */
.tree-pin-focus {
    background: #f2c66d;
    border-color: #fff;
    animation: tree-pin-bounce 1.6s ease-in-out infinite;
}

    .tree-pin-focus .tree-pin-emoji {
        font-size: 24px;
    }

    .tree-pin-focus .tree-pin-number {
        background: #2E7D32;
        color: #fff;
    }

.tree-pin-dim {
    opacity: 0.65;
}

/* Tree passport: found trees fade with a ✓, missing trees pulse (a glow, NOT transform) */
.tree-pin-found {
    background: #7c8f82;
    opacity: 0.7;
}

    .tree-pin-found .tree-pin-number {
        background: #2E7D32;
        color: #fff;
    }

.tree-pin-missing {
    animation: tree-pin-pulse 1.8s ease-out infinite;
}

@keyframes tree-pin-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(242, 198, 109, 0.85), 0 4px 12px rgba(0, 0, 0, 0.35);
    }

    100% {
        box-shadow: 0 0 0 16px rgba(242, 198, 109, 0), 0 4px 12px rgba(0, 0, 0, 0.35);
    }
}

/* Passport score on the map page */
.map-passport {
    background: #fffaf0;
    border: 1.5px solid #f2c66d;
    color: #143220;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 999px;
    text-decoration: none;
}

/* Admin pin map: gold, can be dragged */
.tree-pin-edit {
    background: #f2c66d;
    cursor: grab;
}

    .tree-pin-edit .tree-pin-emoji {
        font-size: 20px;
    }

    .tree-pin-edit .tree-pin-number {
        background: #2E7D32;
        color: #fff;
    }

@keyframes tree-pin-bounce {
    0%, 100% {
        margin-top: -23px; /* = iconAnchor of the gold pin in tree-map.js; Leaflet sets the anchor with margins */
    }

    50% {
        margin-top: -31px;
    }
}

/* ---------- Card when you tap a tree ---------- */
.leaflet-popup-content-wrapper {
    border-radius: 18px;
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: auto !important;
}

.tree-card {
    font-family: Roboto, sans-serif;
    padding-bottom: 14px;
}

    .tree-card img {
        width: 100%;
        height: 130px;
        object-fit: cover;
        display: block;
    }

.tree-card-stop {
    margin: 12px 14px 0 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2E7D32;
}

.tree-card-name {
    margin: 2px 14px 0 14px;
    font-size: 17px;
    font-weight: 800;
    color: #1f2d24;
    line-height: 1.2;
}

.tree-card-en {
    margin: 2px 14px 0 14px;
    color: #6b7c72;
}

.tree-card-sci {
    margin: 4px 14px 0 14px;
    font-style: italic;
    color: #2E7D32;
    font-size: 13px;
}

.tree-card-link {
    display: inline-block;
    margin: 10px 14px 0 14px;
    font-weight: 700;
    color: #2E7D32 !important;
    text-decoration: none;
}

    .tree-card-link:hover {
        text-decoration: underline;
    }

/* ---------- "Waar is ek?" ---------- */
.tree-locate {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-width: calc(100vw - 60px);
}

.tree-locate-button {
    border: none;
    border-radius: 999px;
    padding: 12px 20px;
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    background: #f2c66d;
    color: #143220;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

    .tree-locate-button.active {
        background: #fff;
    }

.tree-locate-info {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    padding: 10px 14px;
    font-size: 14px;
    color: #1f2d24;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

    .tree-locate-info a {
        display: block;
        font-weight: 800;
        font-size: 16px;
        color: #2E7D32;
        text-decoration: none;
    }

.tree-locate-title {
    font-size: 12px;
    color: #6b7c72;
}

/* ---------- /map page ---------- */
.map-page {
    background: #faf8f3;
    padding: 32px 0 48px 0;
}

.map-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.map-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.8rem;
    font-weight: 700;
    color: #2E7D32;
    margin: 0 0 6px 0;
}

.map-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0;
    color: #1f2d24;
}

.map-subtitle {
    font-size: 1.1rem;
    color: #6b7c72;
    margin: 4px 0 0 0;
}

.map-count {
    background: #e8f3e9;
    color: #1b5e20;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 999px;
}

.map-tips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin-top: 16px;
    color: #6b7c72;
    font-size: 0.95rem;
}

/* ---------- Location block on a tree page ---------- */
.tree-location {
    margin-top: 40px;
}

.tree-location-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    color: #1f2d24;
}

.tree-location-sub {
    color: #6b7c72;
    margin: 2px 0 14px 0;
}

.tree-location-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.tree-location-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid #2E7D32;
    color: #2E7D32;
    transition: background 0.2s, color 0.2s;
}

    .tree-location-btn:hover {
        background: #2E7D32;
        color: #fff;
    }

    .tree-location-btn.primary {
        background: #2E7D32;
        color: #fff;
    }

.tree-location-coords {
    font-size: 0.85rem;
    color: #90a4ae;
    margin-top: 10px;
}

/* ---------- Phone ---------- */
@media (max-width: 600px) {
    .map-page {
        padding: 20px 0 32px 0;
    }

    .map-wrap {
        padding: 0 12px;
    }

    tree-map {
        border-radius: 18px;
    }

        tree-map.map-full {
            height: calc(100vh - 220px);
            min-height: 420px;
        }

        tree-map.map-mini {
            height: 260px;
        }
}

@media (prefers-reduced-motion: reduce) {
    .tree-pin-focus,
    .tree-pin-missing {
        animation: none;
    }
}
