/* ----- GLOBAL STYLING ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* ----- HEADER ----- */
.map-header {
    width: 100%;
    max-width: 1300px;
    background: linear-gradient(135deg, #1e3c2c, #2d5a3d);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 8px 24px rgba(0, 20, 0, 0.3);
    margin-bottom: 8px;
    color: #f5faf5;
}

.map-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.map-header h1 small {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.8;
    margin-left: 6px;
}

.map-header .badge {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    padding: 8px 18px;
    border-radius: 40px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-header .badge span {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #7fc97f;
    animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

/* ----- MAP CONTAINER ----- */
#map {
    width: 100%;
    max-width: 1300px;
    height: 620px;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    border: 3px solid #ffffff;
    margin: 0 20px;
    transition: all 0.2s;
    background: #e8edf0; /* svetlo ozadje, ki se ujema s CartoDB */
}

/* ----- LEGEND (pod zemljevidom) ----- */
.map-footer {
    width: 100%;
    max-width: 1300px;
    margin-top: 14px;
    padding: 0 10px 20px 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #2a3f2a;
    font-size: 0.9rem;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 28px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    padding: 10px 22px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.legend-marker.town {
    background: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.25);
}
.legend-marker.hill {
    background: #2c6e49;
    box-shadow: 0 0 0 3px rgba(44, 110, 73, 0.25);
}
.legend-marker.view {
    background: #2980b9;
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.25);
}
.legend-marker.trail {
    background: #8e44ad;
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.25);
}

.map-footer .credit {
    opacity: 0.6;
    font-size: 0.8rem;
    text-align: right;
}

.map-footer .credit a {
    color: #1e3c2c;
    text-decoration: none;
    border-bottom: 1px dotted rgba(30, 60, 44, 0.3);
}
.map-footer .credit a:hover {
    border-bottom: 1px solid #1e3c2c;
}

/* ----- POPUP (Leaflet) ----- */
.leaflet-popup-content {
    font-size: 0.95rem;
    line-height: 1.5;
    min-width: 150px;
    color: #1e2e1e;
}
.leaflet-popup-content strong {
    color: #1e3c2c;
    font-size: 1.05rem;
}
.leaflet-popup-content .elev {
    display: inline-block;
    background: #eef4ee;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #2d5a3d;
    margin-top: 4px;
}
.leaflet-popup-content .desc {
    font-size: 0.85rem;
    opacity: 0.75;
    margin-top: 4px;
}

/* ----- MODAL (obvestilo ob odprtju) ----- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 40, 30, 0.4);
    backdrop-filter: blur(6px) saturate(1.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-glass {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-radius: 40px;
    padding: 2px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    max-width: 480px;
    width: 90%;
}

.modal-content {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 38px;
    padding: 32px 28px;
    text-align: center;
    color: #1a2a1a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.modal-content h2 {
    font-size: 1.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.modal-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 8px 0;
    opacity: 0.9;
}

.modal-content strong {
    color: #1e3c2c;
    font-weight: 600;
}

.modal-btn {
    background: rgba(30, 60, 44, 0.9);
    border: none;
    border-radius: 60px;
    padding: 12px 34px;
    font-size: 1rem;
    font-weight: 500;
    color: #f5faf5;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.2s;
    box-shadow: 0 6px 20px rgba(30, 60, 44, 0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.modal-btn:hover {
    background: rgba(44, 90, 60, 0.95);
    transform: scale(1.02);
    box-shadow: 0 8px 28px rgba(30, 60, 44, 0.3);
}

.modal-btn:active {
    transform: scale(0.97);
}

/* ----- RESPONSIVE ----- */
@media (max-width: 760px) {
    .map-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 16px 20px;
    }
    .map-header h1 {
        font-size: 1.3rem;
        flex-wrap: wrap;
    }
    .map-header h1 small {
        font-size: 0.85rem;
        display: block;
        margin-left: 0;
    }
    #map {
        height: 450px;
        margin: 0 8px;
    }
    .legend {
        padding: 10px 16px;
        gap: 10px 18px;
        border-radius: 28px;
    }
    .map-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .map-footer .credit {
        text-align: left;
        width: 100%;
    }
    .modal-glass {
        max-width: 92%;
    }
    .modal-content {
        padding: 24px 18px;
    }
    .modal-content h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    #map {
        height: 340px;
    }
    .map-header h1 {
        font-size: 1.1rem;
    }
    .legend-item {
        font-size: 0.75rem;
    }
    .legend-marker {
        width: 16px;
        height: 16px;
    }
}