/* Base Styles */
body {
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    color: white;
}

/* Navigation Menu */
#menu {
    position: absolute;
    z-index: 1000;
    top: 0;
    left: 0;
    right: 0;
}

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(51,51,51,0.8));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #333;
}

li {
    float: left;
}

li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 1px solid #444;
}

li a:hover {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    transform: translateY(-2px);
}

li a.active {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

/* Map Container */
#map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#weather-map {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7) contrast(1.1);
}

/* Weather Canvas Overlay */
#weather-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Legacy iframe for non-weather views */
#myIframe {
    position: absolute;
    width: 100%;
    height: 100%;
    border: none;
    top: 0;
    left: 0;
    display: none;
    z-index: 1;
}

/* API Status Panel */
#api-status {
    position: absolute;
    top: 70px;
    right: 20px;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(33,33,33,0.8));
    backdrop-filter: blur(15px);
    border: 1px solid #333;
    color: white;
    padding: 12px;
    border-radius: 12px;
    z-index: 1001;
    max-width: 280px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

#api-status h3 {
    margin: 0 0 8px 0;
    color: #4CAF50;
    text-align: center;
    font-size: 14px;
}

.api-section {
    margin: 8px 0;
    padding: 6px 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    border-left: 2px solid #4CAF50;
}

.api-section h4 {
    margin: 0 0 6px 0;
    font-size: 11px;
    color: #81C784;
}

.api-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0;
    font-size: 11px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-connected { background: #4CAF50; }
.status-error { background: #f44336; }
.status-loading { background: #ffaa00; animation: pulse 1s infinite; }

/* Buttons */
.btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin: 2px;
    font-size: 10px;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn.primary { background: linear-gradient(135deg, #2196F3, #1976D2); }
.btn.danger { background: linear-gradient(135deg, #f44336, #d32f2f); }

/* Weather Data Panel */
#weather-data {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(33,33,33,0.8));
    backdrop-filter: blur(15px);
    border: 1px solid #333;
    color: white;
    padding: 15px;
    border-radius: 10px;
    z-index: 1001;
    min-width: 350px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.data-item {
    margin: 6px 0;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-label {
    color: #bbb;
    font-weight: normal;
}

.data-value {
    font-weight: bold;
    color: white;
}

.high-risk { color: #ff4444; }
.medium-risk { color: #ffaa00; }
.low-risk { color: #4CAF50; }

/* Location Controls Panel */
#location-controls {
    position: absolute;
    top: 70px;
    left: 20px;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(33,33,33,0.8));
    backdrop-filter: blur(15px);
    border: 1px solid #333;
    color: white;
    padding: 15px;
    border-radius: 10px;
    z-index: 1001;
}

#location-input {
    background: rgba(255,255,255,0.1);
    border: 1px solid #555;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    width: 200px;
    margin-right: 10px;
}

#location-input::placeholder {
    color: #888;
}

#api-key-input {
    background: rgba(255,255,255,0.1);
    border: 1px solid #555;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    width: 250px;
    margin: 5px 0;
    font-size: 11px;
}

#api-key-input::placeholder {
    color: #888;
}

/* Map Controls Panel */
#map-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(33,33,33,0.8));
    backdrop-filter: blur(15px);
    border: 1px solid #333;
    color: white;
    padding: 15px;
    border-radius: 15px;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

#map-controls h4 {
    margin: 0 0 10px 0;
    color: #4CAF50;
    text-align: center;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    gap: 10px;
}

.zoom-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-level {
    font-size: 12px;
    color: #bbb;
    min-width: 40px;
    text-align: center;
}

.map-option {
    margin: 8px 0;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.map-option:hover {
    background: rgba(255,255,255,0.1);
    border-color: #4CAF50;
}

.map-option.active {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
}

.map-option-title {
    font-weight: bold;
    color: #4CAF50;
    font-size: 12px;
}

.map-option-desc {
    font-size: 11px;
    color: #bbb;
    margin-top: 2px;
}

/* Messages */
.message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    z-index: 2000;
    text-align: center;
    max-width: 500px;
    border: 1px solid #333;
}

.message.error {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.message.info {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
}

/* Loading Spinner */
.loading-spinner {
    border: 2px solid #333;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

/* Map Loading State */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    z-index: 10;
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.8);
    padding: 20px;
    border-radius: 10px;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MOBILE RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
    /* Mobile Icon Bar */
    .mobile-icon-bar {
        position: fixed;
        bottom: 60px;
        right: 10px;
        display: none; /* Hidden by default, shown by JavaScript */
        flex-direction: column;
        gap: 8px;
        z-index: 1002;
    }
    
    /* Force show mobile icon bar in mobile weather view */
    body.mobile-weather-view .mobile-icon-bar {
        display: flex !important;
    }
    
    .panel-icon {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(33,33,33,0.8));
        backdrop-filter: blur(15px);
        border: 1px solid #333;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    .panel-icon:hover {
        transform: scale(1.1);
        background: linear-gradient(135deg, #2196F3, #1976D2);
    }
    
    .panel-icon.active {
        background: linear-gradient(135deg, #4CAF50, #45a049);
        transform: scale(1.15);
    }
    
    /* Hide panels by default on mobile */
    #api-status,
    #location-controls,
    #weather-data,
    #map-controls {
        display: none !important;
        position: fixed;
        top: 100px;
        left: 10px;
        right: 10px;
        max-height: 45vh;
        overflow-y: auto;
        z-index: 1001;
        animation: slideIn 0.3s ease;
        background: linear-gradient(135deg, rgba(0,0,0,0.95), rgba(33,33,33,0.9)) !important;
        backdrop-filter: blur(15px);
        border: 1px solid #333;
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    }
    
    /* Show active panel */
    #api-status.mobile-active,
    #location-controls.mobile-active,
    #weather-data.mobile-active,
    #map-controls.mobile-active {
        display: block !important;
    }
    
    /* Specific compact heights for each panel */
    #weather-data.mobile-active {
        max-height: 40vh;
    }
    
    #map-controls.mobile-active {
        max-height: 42vh;
    }
    
    #api-status.mobile-active {
        max-height: 30vh;
    }
    
    #location-controls.mobile-active {
        max-height: 25vh;
    }
    
    /* Panel close button */
    .panel-close {
        position: absolute;
        top: 5px;
        right: 5px;
        width: 25px;
        height: 25px;
        border-radius: 50%;
        background: rgba(255,255,255,0.2);
        border: none;
        color: white;
        cursor: pointer;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
    }
    
    .panel-close:hover {
        background: rgba(255,255,255,0.3);
        transform: scale(1.1);
    }
    
    /* Mobile API Status */
    #api-status {
        padding: 6px;
        font-size: 10px;
        max-width: none;
    }
    
    #api-status h3 {
        font-size: 11px;
        margin: 0 0 4px 0;
    }
    
    .api-section {
        margin: 4px 0;
        padding: 3px 4px;
    }
    
    .api-section h4 {
        font-size: 9px;
        margin: 0 0 3px 0;
    }
    
    .api-item {
        font-size: 8px;
        margin: 1px 0;
        line-height: 1.3;
    }
    
    .btn {
        padding: 3px 4px;
        font-size: 7px;
        margin: 1px;
        border-radius: 3px;
    }
    
    /* Mobile Location Controls */
    #location-controls {
        padding: 10px;
    }
    
    #location-input {
        width: calc(100% - 120px);
        padding: 6px 8px;
        font-size: 12px;
        margin-right: 5px;
        margin-bottom: 5px;
    }
    
    .api-key-container {
        width: 100%;
        margin: 3px 0;
    }
    
    #api-key-input {
        width: calc(100% - 35px);
        padding: 4px 30px 4px 6px;
        font-size: 10px;
        box-sizing: border-box;
    }
    
    .paste-btn {
        width: 22px;
        height: 18px;
        font-size: 10px;
        right: 3px;
    }
    
    #location-controls .btn {
        padding: 6px 8px;
        font-size: 10px;
        margin: 2px;
    }
    
    /* Mobile Weather Data */
    #weather-data {
        padding: 6px;
        min-width: auto;
    }
    
    #weather-data h4 {
        font-size: 11px;
        margin: 0 0 4px 0;
        line-height: 1.2;
    }
    
    .data-item {
        font-size: 10px;
        margin: 1px 0;
        padding: 1px 0;
        line-height: 1.3;
    }
    
    .data-item:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .data-label {
        font-size: 9px;
    }
    
    .data-value {
        font-size: 10px;
    }
    
    /* Remove extra bottom space in weather data panel */
    #weather-data.mobile-active {
        padding-bottom: 6px !important;
    }
    
    /* Mobile Map Controls */
    #map-controls {
        padding: 6px;
    }
    
    #map-controls h4 {
        font-size: 11px;
        margin: 0 0 4px 0;
    }
    
    .zoom-controls {
        margin: 4px 0;
        gap: 4px;
    }
    
    .zoom-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .zoom-level {
        font-size: 8px;
        min-width: 25px;
        line-height: 1.1;
    }
    
    .map-option {
        margin: 2px 0;
        padding: 3px 4px;
        border-radius: 4px;
    }
    
    .map-option-title {
        font-size: 9px;
        margin-bottom: 1px;
        line-height: 1.2;
    }
    
    .map-option-desc {
        font-size: 7px;
        line-height: 1.1;
        margin-top: 1px;
    }
    
    #map-controls .btn {
        padding: 3px 4px;
        font-size: 7px;
        margin: 1px 0;
        line-height: 1.2;
    }
    
    /* Compact button container */
    #map-controls > div:last-child {
        margin-top: 6px;
    }
    
    /* Mobile Menu */
    li a {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    /* General Mobile Optimizations */
    body {
        font-size: 12px;
    }
    
    .message {
        max-width: 90%;
        padding: 15px;
        font-size: 12px;
    }
    
    .loading-spinner {
        width: 16px;
        height: 16px;
    }
    
    /* Map background adjustments for mobile */
    #map-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 0;
    }
    
    #weather-canvas {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1;
    }
}

/* Tablet Responsive Styles */
@media (min-width: 769px) and (max-width: 1024px) {
    #api-status {
        max-width: 240px;
        padding: 10px;
    }
    
    #weather-data {
        min-width: 300px;
        padding: 12px;
    }
    
    #location-input {
        width: 180px;
    }
    
    #api-key-input {
        width: 220px;
    }
    
    li a {
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* Large Desktop Styles */
@media (min-width: 1200px) {
    #api-status {
        max-width: 320px;
        padding: 15px;
    }
    
    #weather-data {
        min-width: 380px;
        padding: 18px;
    }
    
    #location-input {
        width: 240px;
    }
    
    #api-key-input {
        width: 280px;
    }
    
    .data-item {
        font-size: 14px;
    }
    
    .api-item {
        font-size: 12px;
    }
}

/* Fix to remove empty space in mobile panels */
@media (max-width: 768px) {
    /* Adjust panel positioning to eliminate empty space */
    #api-status,
    #location-controls,
    #weather-data,
    #map-controls {
        top: 100px !important; /* Changed from 100px to 60px */
    }
    
    /* Make panels more compact to fit content properly */
    #weather-data.mobile-active {
        max-height: 35vh !important; /* Reduced from 40vh */
        padding-bottom: 3px !important; /* Minimal bottom padding */
    }
    
    #map-controls.mobile-active {
        max-height: 38vh !important; /* Reduced from 42vh */
        padding-bottom: 3px !important; /* Minimal bottom padding */
    }
    
    /* Remove any extra margins/padding from last elements */
    #weather-data .data-item:last-child,
    #map-controls .btn:last-child,
    #map-controls > div:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
}
