/**
 * OpenSimulator WorldMap CSS Styles
 */

/* Main map container */
.opensim-worldmap {
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #334E5C; /* Deep blue-gray matching water tiles */
}

/* Region markers - hidden, we use click popups instead */
.opensim-region-marker {
    background: transparent;
    border: none;
    display: none;
}

.region-marker-inner {
    display: none;
}

.region-marker-inner:hover {
    display: none;
}

/* Region popup - NEW DESIGN */
.opensim-region-popup {
    min-width: 250px;
    font-family: 'Segoe UI', Arial, sans-serif;
    padding: 0;
}

/* Region name - big and bold */
.opensim-region-popup .region-name {
    font-size: 20px;
    font-weight: bold;
    color: #2563eb; /* Royal blue */
    margin: 0 0 15px 0;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

/* Teleport button */
.opensim-region-popup .teleport-button {
    display: block;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    text-align: center;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.opensim-region-popup .teleport-button:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
    color: white;
    text-decoration: none;
}

/* Join Free Today button */
.opensim-region-popup .join-button {
    display: block;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    text-align: center;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(96, 165, 250, 0.3);
}

.opensim-region-popup .join-button:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(96, 165, 250, 0.4);
    color: white;
    text-decoration: none;
}

/* Coordinates */
.opensim-region-popup .region-coords {
    text-align: center;
    color: #6b7280;
    font-size: 12px;
    margin: 0;
}

/* Message for no region */
.opensim-region-popup .region-message {
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    margin: 10px 0;
    font-style: italic;
}

/* Custom popup wrapper */
.opensim-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 5px;
}

.opensim-popup .leaflet-popup-content {
    margin: 15px;
}

/* Map controls */
.opensim-home-control,
.opensim-region-toggle {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.opensim-home-control button,
.opensim-region-toggle button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 16px;
    display: block;
    width: 100%;
}

.opensim-home-control button:hover,
.opensim-region-toggle button:hover {
    background: #f0f0f0;
}

/* Coordinate display */
.opensim-coord-display {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 11px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    min-width: 80px;
    text-align: center;
}

.opensim-coord-display span {
    color: #333;
    font-weight: bold;
}

/* Region boundaries */
.leaflet-interactive {
    cursor: crosshair;
}

/* Custom popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content {
    margin: 12px;
    line-height: 1.4;
}

/* Search box styles (if added) */
.opensim-search-control {
    background: white;
    border: 2px solid #2563eb;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 8px;
    position: relative;
}

.opensim-search-control input {
    border: none;
    outline: none;
    padding: 8px 12px;
    font-size: 14px;
    width: 200px;
    border-radius: 6px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.opensim-search-control input:focus {
    background: white;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.opensim-search-control input::placeholder {
    color: #9ca3af;
}

/* Search results dropdown */
.opensim-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2563eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-top: -8px;
    padding-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.search-result-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    color: #1f2937;
}

.search-result-item:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.search-result-item:last-child {
    border-radius: 0 0 6px 6px;
}

/* Loading indicator */
.opensim-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    z-index: 1000;
}

.opensim-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #0066cc;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .opensim-worldmap {
        height: 400px !important;
    }
    
    .opensim-coord-display {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    .opensim-search-control input {
        width: 100px;
        font-size: 11px;
    }
    
    .region-marker-inner {
        font-size: 10px;
        padding: 1px 4px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .opensim-worldmap {
        border-color: #555;
    }
    
    .opensim-coord-display {
        background: rgba(50, 50, 50, 0.9);
        border-color: #666;
    }
    
    .opensim-coord-display span {
        color: #fff;
    }
    
    .opensim-home-control,
    .opensim-region-toggle,
    .opensim-search-control {
        background: #333;
        border-color: #555;
    }
    
    .opensim-home-control button:hover,
    .opensim-region-toggle button:hover {
        background: #444;
    }
    
    .opensim-search-control input {
        background: #444;
        border-color: #666;
        color: #fff;
    }
}

/* NWG Welcome Marker - Glowing Pin */
.nwg-welcome-marker {
    background: transparent !important;
    border: none !important;
}

.nwg-pin {
    position: relative;
    width: 40px;
    height: 60px;
}

/* Pin shape */
.nwg-pin::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    width: 20px;
    height: 30px;
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 
        0 0 15px rgba(37, 99, 235, 0.6),
        0 0 30px rgba(37, 99, 235, 0.4),
        0 0 45px rgba(37, 99, 235, 0.2),
        inset 0 0 10px rgba(255, 255, 255, 0.3);
    animation: pinGlow 2s ease-in-out infinite;
}

/* Pin center dot */
.nwg-pin::after {
    content: '';
    position: absolute;
    top: 7px;
    left: 17px;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    z-index: 10;
}

/* Glow animation */
@keyframes pinGlow {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(37, 99, 235, 0.6),
            0 0 30px rgba(37, 99, 235, 0.4),
            0 0 45px rgba(37, 99, 235, 0.2),
            inset 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 
            0 0 25px rgba(37, 99, 235, 0.8),
            0 0 50px rgba(37, 99, 235, 0.6),
            0 0 75px rgba(37, 99, 235, 0.4),
            inset 0 0 15px rgba(255, 255, 255, 0.5);
    }
}