/* Leave Map Button */
.leave-map-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.leave-map-button .leave-btn {
    background-color: rgba(45, 55, 72, 0.9);
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.leave-map-button .leave-btn:hover {
    background-color: rgba(45, 55, 72, 1);
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

/* Search Container */
.search-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 300px;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: rgba(45, 55, 72, 0.95);
    border-radius: 8px;
    padding: 8px 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    padding: 8px 0;
    outline: none;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-btn, .clear-search-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover, .clear-search-btn:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.search-results {
    margin-top: 8px;
    background-color: rgba(45, 55, 72, 0.95);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-result-item {
    padding: 12px 16px;
    color: white;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.search-result-name {
    font-weight: 500;
    font-size: 14px;
}

.search-result-stats {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.no-results {
    padding: 16px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    font-size: 14px;
}

/* Info Button */
.info-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.info-btn {
    background-color: rgba(45, 55, 72, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.info-btn:hover {
    background-color: rgba(45, 55, 72, 1);
    transform: scale(1.1);
}

/* Popup Overlay */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px 25px;
    border-bottom: 1px solid #34495e;
    background: #34495e;
    border-radius: 12px 12px 0 0;
}

.popup-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #bdc3c7;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background-color: #2c3e50;
    color: white;
}

.popup-body {
    padding: 20px 25px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
    background: white;
}

.popup-body h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 2px solid #34495e;
    padding-bottom: 8px;
}

.popup-body h4 {
    margin: 20px 0 10px 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.popup-body p {
    margin: 0 0 15px 0;
    line-height: 1.6;
    color: #2c3e50;
    font-size: 0.95rem;
}

.popup-body p:last-of-type {
    margin-bottom: 20px;
}

.popup-body ul {
    margin: 10px 0 15px 20px;
    padding: 0;
}

.popup-body li {
    margin: 8px 0;
    line-height: 1.5;
    color: #2c3e50;
    font-size: 0.95rem;
}

.popup-body strong {
    color: #2c3e50;
    font-weight: 600;
}

.popup-body em {
    color: #6c757d;
    font-style: italic;
}

.popup-actions {
    padding: 15px 25px 20px 25px;
    border-top: 1px solid #e9ecef;
    background: white;
    border-radius: 0 0 12px 12px;
    text-align: center;
}

.popup-actions .btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: #34495e;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #34495e;
    cursor: pointer;
}

.popup-actions .btn:hover {
    background-color: #2c3e50;
    transform: translateY(-1px);
    border-color: #2c3e50;
}

/* Custom scrollbar for popup */
.popup-body::-webkit-scrollbar {
    width: 6px;
}

.popup-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.popup-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.popup-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Map Header */
.map-header {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
}

.map-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

/* Map Controls */
.map-controls {
    background-color: #f8f9fa;
    padding: 1.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.map-filters {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    font-size: 0.9rem;
    min-width: 150px;
}

.map-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
}

.stat-label {
    font-size: 0.8rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Map Wrapper */
.map-wrapper {
    position: relative;
    height: 100vh;
    min-height: 600px;
    width: 100%;
}

.map {
    width: 100%;
    height: 100%;
    z-index: 1;
    background-color: #f0f0f0;
}

/* Map Legend */
.map-legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
}

.map-legend h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: #2d3748;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #4a5568;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.loading-content {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #2d3748;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    margin: 0.5rem 0;
    color: #4a5568;
    font-size: 1rem;
}

.loading-details {
    font-size: 0.9rem !important;
    color: #718096 !important;
}

/* Error Message */
.error-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-content {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.error-content h3 {
    color: #e53e3e;
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
}

.error-content p {
    color: #4a5568;
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
}

.error-content button {
    background-color: #2d3748;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.error-content button:hover {
    background-color: #4a5568;
}

/* City Popup Styling */
.city-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.city-popup {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    transform: scale(0.9);
    transition: transform 0.2s ease;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    display: flex;
    flex-direction: column;
}

.city-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px 12px 22px;
    border-bottom: 1px solid #34495e;
    background: #34495e;
    border-radius: 12px 12px 0 0;
}

.city-popup-header h3 {
    margin: 0;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.city-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #bdc3c7;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.city-close-btn:hover {
    background-color: #2c3e50;
    color: white;
}

.city-popup-body {
    padding: 18px 22px;
    background: white;
    flex: 1;
    overflow: visible;
}

.city-section {
    margin-bottom: 20px;
}

.city-section:last-child {
    margin-bottom: 0;
}

.city-section h4 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 2px solid #34495e;
    padding-bottom: 6px;
}

.city-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.city-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e9ecef;
}

.city-stats .stat-item:last-child {
    border-bottom: none;
}

.city-stats .stat-label {
    color: #2c3e50;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: none;
}

.city-stats .stat-value {
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Error color classes */
.city-stats .stat-value.error-green {
    color: #38a169;
    font-weight: 600;
}

.city-stats .stat-value.error-light-green {
    color: #68d391;
    font-weight: 600;
}

.city-stats .stat-value.error-orange {
    color: #ed8936;
    font-weight: 600;
}

.city-stats .stat-value.error-red {
    color: #e53e3e;
    font-weight: 600;
}

/* Legacy error class for compatibility */
.city-stats .stat-value.error {
    color: #e53e3e;
    font-weight: 600;
}



.no-detections {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-style: italic;
}

.no-detections p {
    margin: 0;
    font-size: 1rem;
}

/* Plot styling */
.plots-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 12px;
    justify-content: space-between;
}

.plot-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid #e9ecef;
    flex: 1;
    min-width: 0;
    pointer-events: none;
}

.plot-item h5 {
    margin: 0 0 6px 0;
    color: #2c3e50;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.plot-item canvas {
    width: 100% !important;
    height: 180px !important;
    pointer-events: none;
}

/* Azimuth direction indicators */
.azimuth-plot-container {
    position: relative;
    display: inline-block;
}



.direction-east {
    position: absolute;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    z-index: 10;
}

.direction-south {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    z-index: 10;
}

.direction-west {
    position: absolute;
    top: 50%;
    left: 10%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    z-index: 10;
}

/* Legacy PV Popup Styling (keeping for compatibility) */
.pv-popup {
    font-family: 'Inter', sans-serif;
    min-width: 250px;
}

.pv-popup h4 {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 600;
}

.pv-popup p {
    margin: 0.5rem 0;
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.4;
}

.pv-popup strong {
    color: #2d3748;
    font-weight: 600;
}

/* Custom Marker Styling */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-dot {
    width: 16px;
    height: 16px;
    background-color: #34495e;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.marker-dot:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    background-color: #2c3e50;
}

/* Marker Tooltip Styling */
.marker-tooltip {
    background-color: rgba(45, 55, 72, 0.95);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.marker-tooltip::before {
    border-top-color: rgba(45, 55, 72, 0.95);
}

.marker-dot.search-highlight {
    width: 20px;
    height: 20px;
    background-color: #f39c12;
    border: 3px solid white;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Marker Cluster Customization */
.marker-cluster {
    background-color: rgba(45, 55, 72, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    color: white;
    text-align: center;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.marker-cluster:hover {
    background-color: rgba(45, 55, 72, 1);
    transform: scale(1.1);
}

.marker-cluster-small {
    background-color: rgba(145, 207, 96, 0.8);
}

.marker-cluster-medium {
    background-color: rgba(254, 224, 139, 0.8);
}

.marker-cluster-large {
    background-color: rgba(215, 48, 39, 0.8);
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar .container {
        padding: 0 1rem;
    }
    
    .nav-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .map-header h1 {
        font-size: 1.5rem;
    }
    
    .controls-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .map-filters {
        justify-content: center;
    }
    
    .map-stats {
        justify-content: center;
    }
    
    .map-wrapper {
        height: 80vh;
    }
    
    .popup-content {
        width: 95%;
        margin: 1rem;
    }
    
    .popup-header h2 {
        font-size: 1.2rem;
    }
    
    .popup-body {
        padding: 1.5rem;
    }
    
    .city-popup {
        width: 95%;
        max-width: 500px;
        max-height: 90vh;
        margin: 10px;
    }
    
    .city-popup-header h3 {
        font-size: 1.1rem;
    }
    
    .city-popup-body {
        padding: 15px 20px;
        max-height: none;
        overflow-y: auto;
    }
    
    .plots-container {
        flex-direction: column;
        gap: 12px;
    }
    
    .plot-item {
        padding: 8px;
    }
    
    .plot-item h5 {
        font-size: 0.8rem;
    }
    
    .plot-item canvas {
        height: 140px !important;
    }
    

    
    .direction-east {
        right: 8%;
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .direction-south {
        bottom: -6px;
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .direction-west {
        left: 8%;
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .search-container {
        width: calc(100% - 30px);
        top: 15px;
        left: 15px;
        transform: none;
    }
    
    .leave-map-button {
        bottom: 15px;
    }
    
    .leave-map-button .leave-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .search-box {
        padding: 6px 10px;
    }
    
    .search-input {
        font-size: 13px;
    }
    
    .search-results {
        max-height: 250px;
    }
    
    .search-result-item {
        padding: 10px 12px;
    }
    
    .search-result-name {
        font-size: 13px;
    }
    
    .search-result-stats {
        font-size: 11px;
    }
    
    .map-legend {
        position: relative;
        top: auto;
        right: auto;
        margin: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .map-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group select {
        min-width: auto;
        width: 100%;
    }
    
    .map-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .map-wrapper {
        height: 70vh;
    }
    
    .city-popup {
        width: 98%;
        max-height: 95vh;
        margin: 5px;
    }
    
    .city-popup-header h3 {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .city-popup-body {
        padding: 12px 16px;
        max-height: none;
        overflow-y: auto;
    }
    
    .city-section h4 {
        font-size: 0.9rem;
    }
    
    .city-stats .stat-label {
        font-size: 0.8rem;
    }
    
    .city-stats .stat-value {
        font-size: 0.85rem;
    }
} 