/* Alife Virtual World Map Styles */

body {
    overflow: hidden;
}

/* Map Header Bar */
.map-header-bar {
    position: fixed;
    top: 0; /* At the very top now */
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 1020;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.header-left h1 {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: #ffffff;
}

.grid-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    color: #ffffff;
}

.stat .icon {
    font-style: normal;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1em;
}

.btn-home {
    background: rgba(255,255,255,0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.btn-home:hover {
    background: rgba(255,255,255,0.3);
    transform: translateX(-3px);
}

/* Search Panel */
.search-panel {
    position: fixed;
    top: 60px; /* Below map header only */
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 999;
    max-height: 500px;
    overflow: hidden;
}

.search-box {
    display: flex;
    padding: 10px;
    background: white;
}

#searchInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px 0 0 8px;
    font-size: 1em;
    outline: none;
}

#searchInput:focus {
    border-color: #667eea;
}

.btn-search {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-weight: 600;
}

.btn-search:hover {
    background: #5568d3;
}

.btn-clear {
    padding: 12px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-left: 5px;
    font-size: 1.2em;
    line-height: 1;
}

.btn-clear:hover {
    background: #ee5a52;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    background: white;
    color: #333;
}

.search-result-item {
    padding: 12px 15px;
    border-top: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #f5f5f5;
}

.search-result-item strong {
    display: block;
    color: #667eea;
    margin-bottom: 4px;
}

.search-result-item small {
    color: #666;
}

/* Map Container */
#map {
    position: fixed;
    top: 60px; /* Below map header only */
    left: 0;
    right: 0;
    bottom: 0; /* No footer, use full height */
    z-index: 1;
    background: #1e465f; /* OpenSim water color - matches map tiles */
}

/* Hide broken image icons - blend with water */
.leaflet-image-layer {
    image-rendering: auto;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* Hide broken images */
img[src*="map-"][src$=".jpg"] {
    background: transparent;
}

img[src*="map-"][src$=".jpg"]:not([src=""]):not([src*="data:"]) {
    opacity: 1;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 1.2em;
    color: white;
}

/* Map Legend */
.map-legend {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 999;
    color: #333;
}

.map-legend h3 {
    font-size: 1em;
    margin-bottom: 10px;
    color: #667eea;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-size: 0.9em;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #333;
}

.legend-marker.online {
    background: #4caf50;
}

.legend-marker.offline {
    background: #9e9e9e;
}

.legend-marker.event {
    background: #ff9800;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Custom Leaflet Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

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

.region-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.region-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
}

.region-popup-header h3 {
    margin: 0 0 5px 0;
    font-size: 1.3em;
}

.region-popup-header .status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    background: rgba(255,255,255,0.2);
}

.region-popup-body {
    padding: 15px 20px;
    color: #333;
}

.region-info-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    font-size: 0.95em;
}

.region-info-row strong {
    color: #667eea;
}

.region-events {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.region-events h4 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 1em;
}

.event-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.region-popup-footer {
    padding: 15px 20px;
    background: #f5f5f5;
    text-align: center;
}

.btn-teleport {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.3s;
}

.btn-teleport:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white !important;
}

/* Responsive */
@media (max-width: 768px) {
    .header-left h1 {
        font-size: 1.3em;
    }
    
    .grid-stats {
        gap: 10px;
    }
    
    .stat {
        font-size: 0.8em;
        padding: 4px 8px;
    }
    
    .search-panel {
        max-width: calc(100% - 40px);
    }
    
    .map-legend {
        bottom: 10px;
        right: 10px;
        padding: 10px 15px;
        font-size: 0.9em;
    }
}
