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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f2f2f2;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

.header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 2.5rem;
    padding: 10px 0;
}

.header-logo {
    height: 60px;
    width: auto;
}

.header-text {
    flex: 1;
}

.more-info-btn {
    background: #401338;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.more-info-btn:hover {
    background: #5a1c4e;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #666666;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #401338;
}

.modal h2 {
    color: #401338;
    font-size: 1.4rem;
    margin-bottom: 16px;
    padding-right: 30px;
}

.modal p {
    color: #333333;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.modal p:last-child {
    margin-bottom: 0;
}

.modal ul {
    color: #333333;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
    margin-left: 20px;
}

.modal ul li {
    margin-bottom: 8px;
}

h1 {
    color: #401338;
    font-size: 2rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    text-align: left;
}

.subtitle {
    color: #666666;
    font-size: 0.95rem;
    text-align: left;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

#map {
    flex: 1;
    height: 80vh;
    min-height: 500px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Info Panel / Legend */
.info-panel {
    flex-shrink: 0;
    width: 220px;
    background: rgba(64, 19, 56, 0.95);
    color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.info-panel h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #ffffff;
}

.info-panel .panel-subtitle {
    font-size: 0.8rem;
    color: #a07898;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend {
    margin-bottom: 16px;
}

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

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.legend-label {
    flex: 1;
    font-size: 0.9rem;
    color: #f0e6ee;
}

.legend-count {
    font-size: 0.85rem;
    color: #c9a0c1;
    font-weight: 500;
}

.total-count {
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    color: #ffffff;
}

.total-count strong {
    color: #ffffff;
    font-size: 1rem;
}

.panel-hint {
    margin-top: 12px;
    font-size: 0.95rem;
    color: #a07898;
    font-style: italic;
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    background: #e2e2e2;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: none;
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 280px;
}

.leaflet-popup-tip {
    background: #e2e2e2;
    border: none;
}

.leaflet-popup-close-button {
    color: #666666 !important;
    font-size: 20px !important;
    top: 4px !important;
    right: 8px !important;
}

.leaflet-popup-close-button:hover {
    color: #401338 !important;
}

/* Popup Content */
.popup-content {
    color: #333333;
}

.popup-header {
    padding: 16px;
    background: #d4d4d4;
    border-radius: 12px 12px 0 0;
}

.popup-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-meta {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    background: #d9d9d9;
    font-size: 0.8rem;
    color: #555555;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.popup-challenges {
    padding: 12px 16px 16px;
    background: #ffffff;
}

.challenge-category {
    margin-bottom: 10px;
}

.challenge-category:last-child {
    margin-bottom: 0;
}

.challenge-category strong {
    display: block;
    font-size: 0.85rem;
    color: #401338;
    margin-bottom: 4px;
    font-weight: 600;
}

.challenge-category ul {
    margin: 0;
    padding-left: 24px;
}

.challenge-category li {
    font-size: 0.95rem;
    color: #1a1a1a;
    margin-bottom: 4px;
    line-height: 1.5;
}

/* Leaflet Tooltip */
.tclp-tooltip {
    background-color: #2d0f26 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px !important;
    color: #f0e6ee !important;
    font-size: 0.85rem !important;
    padding: 8px 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
    opacity: 1 !important;
}

.tclp-tooltip::before {
    border-top-color: #2d0f26 !important;
}

/* Ensure markers pane is above other layers */
.leaflet-markersPane-pane {
    z-index: 650 !important;
}

.leaflet-pane.leaflet-overlay-pane {
    z-index: 400;
}

/* Ensure tooltip appears above all markers */
.leaflet-tooltip-pane {
    z-index: 700 !important;
}

.leaflet-popup-pane {
    z-index: 750 !important;
}

/* Leaflet Controls */
.leaflet-container {
    background: #1a0a15;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-control-zoom a {
    background: rgba(45, 15, 38, 0.95) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(64, 19, 56, 0.95) !important;
}

.leaflet-control-attribution {
    background: rgba(26, 10, 21, 0.8) !important;
    color: #a07898 !important;
    font-size: 10px;
}

.leaflet-control-attribution a {
    color: #d4a5c9 !important;
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .info-panel {
        width: 100%;
        order: -1;
    }

    .legend {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }

    .legend-item {
        margin-bottom: 0;
    }

    .total-count {
        border-top: none;
        padding-top: 0;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 1rem;
    }

    .header-text {
        text-align: left;
    }

    .main-content {
        flex-direction: column;
    }

    #map {
        height: 60vh;
        min-height: 400px;
        width: 100%;
    }

    .info-panel {
        width: 100%;
        position: relative;
        top: auto;
        right: auto;
        margin-top: 15px;
    }

    .legend-label {
        margin-right: 12px;
    }

    .leaflet-popup-content {
        min-width: 240px;
    }
}

/* Footer */
.footer {
    background: transparent;
    color: #222222;
    text-align: center;
    padding: 20px;
    margin-top: 30px;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
}

.footer a {
    color: #222222;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}
