/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Mobile responsiveness - hide side panels on small screens */
@media (max-width: 768px) {
    .data-panel,
    .symbol-panel {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* Adjust menu position to use the freed-up space */
    .menu-container {
        right: 8px;
        left: auto;
        width: 200px;
    }
    
    /* Ensure clock panel stays visible but maybe reposition if needed */
    .clock-panel {
        top: 8px;
        left: 8px;
        z-index: 610;
    }
    
    /* Optional: Make the menu button more prominent on mobile */
    .menuopts {
        background-color: rgba(117, 117, 117, 0.9);
        font-size: 0.8rem;
    }
}

/* For very small mobile devices */
@media (max-width: 480px) {
    .menu-container {
        width: 180px;
    }
    
    .clock-panel {
        width: 120px;
    }
    
    /* Optional: Reduce font size for better mobile fit */
    .menuopts {
        font-size: 0.7rem;
    }
}

    /* font-family: "Noto Sans", Verdana, Tahoma, Geneva, sans-serif; */

html, body {
    background-color: black;
    overflow: hidden;
    width: 100vw;
    height: 100% !important;
    overflow: hidden !important;   
    margin: 0 !important;
    padding: 4px !important;
}

.content {
    height: calc(100vh - 136px) !important;
    min-height: 600px !important;
    overflow: hidden !important; /* Change from auto to hidden */
    position: relative !important;
    /* Restore original website spacing */
    padding: 0 !important; /* Add back the original padding */
    margin: 8px 0 0 0 !important; /* ← Add 8px top margin */        
}

/* Main App Container */
.app-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    /* top: 0 !important;
    left: 0 !important; */
    top: 0 !important; /* Match content padding */
    left: 0 !important; /* Match content padding */
    transform: translateZ(0); /* Force hardware layer */
    backface-visibility: hidden; /* Prevent rendering artifacts */ 
}

.map-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    transform: translateZ(0);
}

/* Map Container - Full viewport, Leaflet will control this */
#map {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    background-color: black;
    z-index: 100;
}

/* Overlay Container - positioned over map */
.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
    z-index: 600;
}

/* Base overlay element styles */
.overlay-element {
    position: absolute;
    pointer-events: auto;
    /* background: rgba(255, 255, 255, 0.1); */
    isolation: isolate; /* ADD THIS LINE */
    background: transparent; /* Default to transparent */

}

/* Specific overlay positioning - FIXED positions */
.clock-panel {
    top: 8px;
    left: 8px;
    width: 150px;
    height: 18px;
    z-index: 610;
    background-color: rgba(30, 30, 30, 0.7) !important; /* ADD THIS */
    isolation: isolate; /* ADD THIS */    
}

.data-panel {
    top: 8px;
    right: 8px;
    width: 245px;
    height: 292px;
    z-index: 610;
    background-color: rgba(30, 30, 30, 0.7) !important; /* ADD THIS */
    isolation: isolate; /* ADD THIS */    
}

.symbol-panel {
    top: 305px; /* Position it below the data panel (8px top + 292px height + 5px gap) */
    right: 8px;
    width: 245px;
    height: 65px;
    z-index: 610;
    background-color: rgba(30, 30, 30, 0.7) !important; /* ADD THIS */
    isolation: isolate; /* ADD THIS */    
}

/* .symbol-panel {
    bottom: 8px;
    right: 8px;
    width: 245px;
    height: 65px;
    z-index: 610;
} */

/* CRITICAL: animCanvas must match Leaflet map exactly */
.anim-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 605;
    pointer-events: none;
    /* Visual debug - remove in production */
    /* 
    background-color: rgba(255, 0, 0, 0.1); 
    border: 1px dashed rgba(255, 255, 255, 0.3);
    */
    background-color: transparent !important;
    mix-blend-mode: normal !important;    
}

/* Menu Container */
.menu-container {
    position: absolute;
    top: 8px;
    left: 165px;
    z-index: 620;
    pointer-events: auto;
    width: 200px; /* Fixed width */
    height: 18px; /* Fixed height when collapsed */
}

.menu-container .panel {
    width: 200px !important;
    min-width: 200px !important;
    max-width: 200px !important;
    left: 0 !important;
    right: auto !important;
    background-color: rgba(107, 107, 107, 0.75) !important; /* Less transparent */
    backdrop-filter: none !important; /* Remove blur if it's causing issues */
}

/* Menu Button */
.menuopts {
    font-family: "Noto Sans", Verdana, Tahoma, Geneva, sans-serif;
    font-size: 9pt; /*0.75rem;*/
    font-weight: 500;
    color: white;
    background-color: rgba(117, 117, 117, 0.7);
    cursor: pointer;
    padding: 2px 8px;
    width: 100%;
    height: 18px;
    text-align: left;
    border: none;
    border-radius: 3px;
    outline: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.menuopts::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("../img/config.png");
    background-size: contain;
    background-repeat: no-repeat;
}

.menuopts:hover,
.menuopts:focus {
    background-color: #0061a7;
    color: white;
    transform: translateY(-1px);
}

.menuopts.active {
    background-color: #0061a7;
}

/* Panel Styles */
.panel {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    padding: 12px;
    font-family: "Noto Sans", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 9pt; /*0.8rem;*/
    font-weight: 400;
    color: white;
    background-color: rgba(107, 107, 107, 0.65);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    min-width: 250px;
    max-width: 250px; /* Add this to constrain width */
    z-index: 630;
    pointer-events: auto;
    width: auto; /* Ensure it doesn't stretch */
}

.panel.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Menu Items */
.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    transition: background-color 0.2s ease;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.menu-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.menu-item label {
    cursor: pointer;
    user-select: none;
    flex: 1;
    line-height: 1.2;
}

/* Menu Divider */
.menu-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 8px 0;
}

/* Menu Actions */
.menu-actions {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 8px;
}

/* Button Styles */
.btnOpt1 {
    background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%);
    border: 1px solid #124d77;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    font-family: "Noto Sans", Arial, sans-serif;
    font-size: 9pt;
    font-weight: 400;
    padding: 4px 8px;
    text-decoration: none;
    text-shadow: 0px 1px 0px #154682;
    transition: all 0.2s ease;
    flex: 1;
    line-height: 1.2;
}

.btnOpt1:hover {
    background: linear-gradient(to bottom, #0061a7 5%, #007dc1 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btnOpt1:active {
    transform: translateY(0);
}

.btnOpt1:focus {
    outline: 2px solid #54a3f7;
    outline-offset: 1px;
}

/* Ensure canvas elements maintain their internal dimensions */
canvas {
    display: block;
}

.station-label {
    font-family: "Noto Sans", Tahoma, Geneva, Verdana, sans-serif;
    padding: 1px 3px 1px 3px;
    position: absolute;
    background-color: rgba(63, 63, 63, 0.75);
    border: 1px solid rgba(210, 210, 210, 0.75);
    width: auto;
    font-size: 7pt;
    color: white;
    font-weight: 600;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

/* Slider Styles */
.slider-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.slider-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* font-size: 0.8rem; */
    font-family: "Noto Sans", Arial, sans-serif;
    font-size: 9pt;
    font-weight: 400;    
}

#sensorThresholdValue {
    font-weight: bold;
    color: #54a3f7;
    min-width: 20px;
    text-align: right;
}

/* Custom Slider Styling */
/* Custom Slider Styling */
#sensorThreshold {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    appearance: none; /* Standard property */
    -webkit-appearance: none; /* Fallback for older WebKit browsers */
}

#sensorThreshold::-webkit-slider-thumb {
    appearance: none; /* Standard property */
    -webkit-appearance: none; /* Fallback */
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007dc1;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#sensorThreshold::-webkit-slider-thumb:hover {
    background: #0061a7;
    transform: scale(1.1);
}

#sensorThreshold::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007dc1;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: none; /* Firefox adds its own border */
}

#sensorThreshold::-moz-range-thumb:hover {
    background: #0061a7;
}

/* For even better browser support, you could also add */
#sensorThreshold::-ms-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007dc1;
    cursor: pointer;
    border: 2px solid white;
}

/* Slider track fill effect */
#sensorThreshold {
    background: linear-gradient(to right, #007dc1 0%, #007dc1 var(--slider-progress, 0%), rgba(255, 255, 255, 0.2) var(--slider-progress, 0%), rgba(255, 255, 255, 0.2) 100%);
}