/**
 * KiteCalc Map Styles
 * Custom styling for the wind map feature
 */

/* Map Container */
#mapContainer {
    position: relative;
    width: 100%;
    height: 70vh; /* 70% of viewport height for better mobile experience */
    min-height: 500px; /* Minimum height on all devices */
    border-radius: 8px;
    overflow: hidden;
    margin: 15px 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: block; /* Shown by default */
}

/* Loading Indicator */
#mapLoadingIndicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(18, 41, 68, 0.9) 0%, rgba(32, 58, 92, 0.9) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

/* Loading container styles */
.loading-container {
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 80%;
}

/* Wind loading icon animation */
.wind-loading-icon {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wind-loading-icon i {
    position: relative;
    z-index: 5;
    animation: pulse 2s infinite ease-in-out;
}

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

/* Wind particles animation */
.wind-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.wind-particles span {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #17a2b8;
    border-radius: 50%;
    opacity: 0;
}

.wind-particles span:nth-child(1) {
    top: 20%;
    left: 20%;
    animation: particle 1.8s infinite ease-in-out 0.1s;
}

.wind-particles span:nth-child(2) {
    top: 60%;
    left: 40%;
    animation: particle 2.2s infinite ease-in-out 0.5s;
}

.wind-particles span:nth-child(3) {
    top: 40%;
    left: 70%;
    animation: particle 1.6s infinite ease-in-out 0.3s;
}

.wind-particles span:nth-child(4) {
    top: 70%;
    left: 30%;
    animation: particle 2s infinite ease-in-out 0.7s;
}

.wind-particles span:nth-child(5) {
    top: 30%;
    left: 50%;
    animation: particle 1.4s infinite ease-in-out 0.2s;
}

@keyframes particle {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1); opacity: 0.8; }
    100% { transform: translateX(20px); opacity: 0; }
}

/* Loading text styles */
.loading-text h5 {
    margin-bottom: 5px;
    font-weight: bold;
}

.text-light-50 {
    opacity: 0.5;
}

/* Show Map Button */
.wind-map-button {
    display: block;
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--surf-deep), var(--surf-blue));
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

.wind-map-button:hover {
    background: linear-gradient(135deg, var(--surf-blue), var(--surf-teal));
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.wind-map-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Custom Map Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 0;
    background-color: white;
    color: #333;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-content {
    margin: 10px 14px;
    font-family: var(--bs-body-font-family);
}

.leaflet-popup-tip {
    background-color: white;
}

/* Info Box Styles */
.map-info-box {
    background-color: white !important;
    color: #333 !important;
    border: 1px solid #ddd;
    border-left: 4px solid var(--surf-teal);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Wind Arrow Styling */
.wind-arrow {
    opacity: 0.85;
    transition: all 0.3s ease;
}

.wind-arrow:hover {
    opacity: 1;
    transform: scale(1.05) !important;
}

/* Location permission prompt styling */
.map-init-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
    width: 80%;
    max-width: 400px;
}

.location-permission-prompt {
    background: rgba(255,255,255,0.95);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    text-align: center;
    transition: all 0.3s ease;
    animation: permission-fade-in 0.6s ease-out;
}

.location-permission-prompt:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.location-permission-prompt .icon-container {
    font-size: 40px;
    margin-bottom: 15px;
    color: var(--duotone-yellow);
    animation: permission-pulse 2s infinite;
}

.location-permission-prompt h5 {
    margin-bottom: 15px;
    color: var(--duotone-navy-dark);
    font-weight: bold;
}

.location-permission-prompt p {
    margin-bottom: 20px;
    color: var(--duotone-navy);
    font-size: 14px;
    line-height: 1.4;
}

.location-permission-prompt .btn {
    background: var(--duotone-electric);
    border-color: var(--duotone-navy);
    color: white;
    font-weight: bold;
    padding: 10px 20px;
    transition: all 0.2s ease;
}

.location-permission-prompt .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(45, 156, 255, 0.3);
}

.location-permission-prompt .btn:active {
    transform: translateY(0);
}

/* Animation for permission prompt */
@keyframes permission-fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes permission-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Location hairpin marker styling */
.location-marker {
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
    transition: all 0.3s ease;
    z-index: 500 !important; /* Place location marker below wind marker */
}

.location-marker:hover {
    transform: scale(1.1) translateY(-3px) !important;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.5));
}

/* Wind direction marker specific styling */
.wind-direction-marker {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
    transition: all 0.3s ease;
    z-index: 600 !important; /* Ensure wind marker is above location marker */
}

.wind-direction-marker:hover {
    transform: scale(1.05) !important;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
}

/* Wind Direction Text Labels */
.wind-direction-label {
    background-color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Attribution Style */
.leaflet-control-attribution {
    background-color: rgba(255, 255, 255, 0.8) !important;
    color: #333 !important;
    font-size: 11px;
}

/* Zoom Controls */
.leaflet-control-zoom {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
}

.leaflet-control-zoom a {
    background-color: white !important;
    color: #333 !important;
}

.leaflet-control-zoom a:hover {
    background-color: #f5f5f5 !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #mapContainer {
        height: 65vh; /* Slightly smaller on tablets but still proportional */
        min-height: 450px;
    }
    
    .wind-map-button {
        padding: 14px;
        font-size: 16px;
    }
    
    .map-info-box {
        max-width: 90% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: 15px !important;
        padding: 8px 12px !important;
    }
}

@media (max-width: 576px) {
    #mapContainer {
        height: 60vh; /* Still large enough for phones */
        min-height: 400px;
        border-radius: 0; /* Full width on small screens */
    }
    
    .map-info-box {
        max-width: 95% !important;
        font-size: 0.9rem !important;
    }
    
    /* Mobile optimization for markers */
    .wind-direction-marker {
        transform: scale(1.3) !important; /* Make wind marker larger on mobile */
        z-index: 2000 !important; /* Ensure wind marker is ABOVE location marker */
    }
    
    .location-marker {
        z-index: 100 !important; /* Ensure location marker is BELOW wind marker */
        filter: drop-shadow(0 0 5px rgba(255,255,255,0.7)) !important; /* Add white glow for visibility */
    }
    
    /* Special styling for wind arrow when it's at the same position as location marker */
    .wind-direction-marker .wind-arrow-container {
        transform-origin: center !important;
    }
}