/* MSC World Map Provider Styles */
/**
 * Wunderkammer Weather Plugin - MSC World Map CSS - msc-world-map.css
 * Copyright (c) 2025 Giuseppe Fraccalvieri. All rights reserved.
 * Licensed under proprietary license - See LICENSE.txt
 * Unauthorized use is strictly prohibited.
 */

/* Modal Styles */
.ww-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.ww-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10001;
}

.ww-modal-content {
    position: relative;
    background-color: #fff;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10002;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ww-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
}

.ww-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ww-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ww-modal-close:hover {
    color: #333;
}

.ww-modal-body {
    padding: 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Provider button style to match others */
.ww-provider-msc-world-map {
    /* This will inherit styles from .ww-provider-button */
}

.ww-msc-world-map-container {
    width: 100%;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ww-msc-world-map-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(90vh - 120px); /* Full modal height minus header/padding */
    min-height: 600px;
    position: relative;
}

.ww-modal-content {
    position: relative;
    background-color: #fff;
    margin: 2% auto;
    padding: 0;
    width: 95%;  
    max-width: 1600px;  
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10002;
    height: 90vh; /* Fixed height for full screen usage */
    overflow: hidden; /* Prevent scrolling, let map container handle it */
    display: flex;
    flex-direction: column;
}

/* Controls Container */
.ww-msc-controls-container {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 15px;
    flex-shrink: 0;
}

.ww-msc-controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Parameter Controls */
.ww-msc-parameter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ww-msc-parameter-label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    margin-right: 8px;
}

.ww-msc-parameter-btn {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    background-color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #495057;
}

.ww-msc-parameter-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.ww-msc-parameter-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Time Controls */
.ww-msc-time-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ww-msc-time-label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    margin-right: 8px;
}

.ww-msc-time-btn {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    background-color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #495057;
}

.ww-msc-time-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.ww-msc-time-btn.active {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

/* Refresh Controls */
.ww-msc-refresh-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.ww-msc-refresh-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background-color: #17a2b8;
    color: white;
}

.ww-msc-refresh-btn:hover {
    background-color: #138496;
}

.ww-msc-refresh-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.ww-msc-btn-text {
    font-size: 14px;
}

#ww-msc-time-display {
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    white-space: nowrap;
    flex: 1;
    text-align: right;
    min-width: 200px;
}

/* Map Container */
.ww-msc-map-container {
    flex: 1;
    position: relative;
}

#ww-msc-world-map {
    height: 100%;
    width: 100%;
    border-radius: 0;
}

/* Leaflet map fixes for MSC */
.ww-msc-map-container .leaflet-container {
    width: 100% !important;
    height: 100% !important;
}

.ww-msc-map-container .leaflet-control-attribution {
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
}

/* Loading and Status Overlays */
.ww-msc-loading-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: white;
    padding: 20px;
    text-align: center;
    z-index: 1000;
}

.ww-msc-loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ww-msc-loading-text {
    font-size: 14px;
    font-weight: 500;
}

.ww-msc-status-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.ww-msc-status-content {
    text-align: center;
    padding: 20px;
}

.ww-msc-status-content .ww-error {
    color: #dc3545;
    font-size: 14px;
}

.ww-msc-status-content .ww-loading {
    color: #007bff;
    font-size: 14px;
}

/* Legend - overlay with transparency */
.ww-msc-legend-external {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.9);  /* Semi-transparent white */
    border: 1px solid rgba(222, 226, 230, 0.8);
    border-radius: 4px;
    padding: 10px;
    z-index: 1000;
    max-width: 200px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ww-msc-legend-title {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
    text-align: center;
}

.ww-msc-legend-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ww-msc-legend-image {
    max-width: 100%;
    height: auto;
}

/* Attribution */
.ww-msc-attribution {
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 11px;
    color: #6c757d;
    text-align: center;
}

.ww-msc-attribution a {
    color: #007bff;
    text-decoration: none;
}

.ww-msc-attribution a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ww-msc-world-map-wrapper {
        height: 100vh; /* Full viewport height */
        min-height: 100vh;
        position: relative;
    }
    
    .ww-modal-body {
        padding: 0; /* Remove padding to maximize map space */
    }
    
    .ww-msc-controls-container {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        background-color: rgba(248, 249, 250, 0.95); /* Semi-transparent background */
        backdrop-filter: blur(5px); /* Add blur effect */
        border: none;
        border-radius: 0 0 8px 8px;
        padding: 10px;
        z-index: 1001;
        transition: transform 0.3s ease, opacity 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    .ww-msc-controls-container.mobile-hidden {
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }
    
    .ww-msc-controls-wrapper {
        gap: 8px;
    }
    
    .ww-msc-parameter-controls,
    .ww-msc-time-controls {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .ww-msc-parameter-label,
    .ww-msc-time-label {
        margin-bottom: 3px;
        color: rgba(73, 80, 87, 0.9);
    }
    
    .ww-msc-parameter-btn,
    .ww-msc-time-btn {
        font-size: 11px;
        padding: 4px 8px;
        background-color: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(206, 212, 218, 0.8);
    }
    
    .ww-msc-parameter-btn.active,
    .ww-msc-time-btn.active {
        background-color: rgba(0, 123, 255, 0.9);
        border-color: rgba(0, 123, 255, 0.9);
    }
    
    .ww-msc-refresh-controls {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        justify-content: space-between;
    }
    
    /* Legend transparency and auto-hide */
    .ww-msc-legend-external {
        background-color: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(3px);
        transition: transform 0.3s ease, opacity 0.3s ease;
        border: 1px solid rgba(222, 226, 230, 0.6);
    }
    
    .ww-msc-legend-external.mobile-hidden {
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
    }
}

@media (max-width: 480px) {
    .ww-msc-world-map-wrapper {
        height: 100vh;
        min-height: 100vh;
    }
    
    .ww-modal-body {
        padding: 0;
    }
    
    .ww-msc-controls-container {
        padding: 8px;
        background-color: rgba(248, 249, 250, 0.9);
    }
    
    .ww-msc-parameter-btn,
    .ww-msc-time-btn {
        flex: 1;
        min-width: 50px;
        font-size: 10px;
        padding: 3px 6px;
        background-color: rgba(255, 255, 255, 0.85);
    }
    
    .ww-msc-controls-wrapper {
        gap: 6px;
    }
    
    /* Mobile toggle button */
    .ww-msc-mobile-toggle {
        position: absolute;
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        border: none;
        border-radius: 20px;
        padding: 8px 16px;
        font-size: 12px;
        cursor: pointer;
        z-index: 1002;
        display: none;
        backdrop-filter: blur(3px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .ww-msc-mobile-toggle.visible {
        display: block;
    }
    
    .ww-msc-mobile-toggle:active {
        background: rgba(0, 0, 0, 0.8);
    }
    
    /* Ensure map container fills full space */
    #ww-msc-world-map {
        height: 100vh !important;
        width: 100% !important;
    }
}
    
    /* Show/hide toggle button for mobile */
    .ww-msc-mobile-toggle {
        position: absolute;
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        border: none;
        border-radius: 4px;
        padding: 8px 12px;
        font-size: 12px;
        cursor: pointer;
        z-index: 1002;
        display: none;
    }
    
    .ww-msc-mobile-toggle.visible {
        display: block;
    }
}

/* Map Opacity Control for Layer Visibility */
.ww-msc-map-container .leaflet-layer {
    transition: opacity 0.3s ease;
}