/* =========================================
   1. GLOBAL RESET & LAYOUT
   ========================================= */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden; /* Prevents scrollbars on the main window */
    font-family: Arial, sans-serif;
}

/* =========================================
   2. TABS NAVIGATION
   ========================================= */
.tab-nav {
    position: absolute;
    top: 10px;
    left: 50px; /* Offset to not cover zoom controls */
    z-index: 1000; /* Above the map */
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    border-radius: 3px;
    margin-right: 5px;
    font-size: 14px;
}

.tab-btn:hover {
    background-color: #e2e6ea;
}

.tab-btn.active {
    background: #007bff; /* Blue active state */
    color: white;
}

/* =========================================
   3. TAB CONTENT & MAPS
   ========================================= */
.tab-content {
    display: none; /* Hidden by default */
    height: 100%;
    width: 100%;
    position: relative; /* Context for absolute children */
}

.tab-content.active {
    display: block;
}

.map-container {
    height: 100%;
    width: 100%;
    z-index: 1;
}


/* =========================================
   4. SLIDER CONTROLS (Realtime Tab)
   ========================================= */
.slider-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 360px; /* Increased width to fit button */
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    
    /* Flexbox for side-by-side layout */
    display: flex;
    align-items: center;
    gap: 15px; 
}

/* Play/Pause Button Styling */
.play-btn {
    background: #007bff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    flex-shrink: 0; /* Prevent button from shrinking */
    transition: background 0.2s;
}

.play-btn:hover {
    background: #0056b3;
}

.play-btn svg {
    pointer-events: none; /* Icon clicks pass through to button */
}

/* Helper to toggle icons */
#icon-stop.hidden, #icon-play.hidden {
    display: none;
}

/* Wrapper for the slider and text */
.slider-wrapper {
    flex-grow: 1; /* Takes up remaining space */
    text-align: center;
}

.slider-value {
    font-weight: bold;
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 5px;
    white-space: nowrap;
}

#time-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: #d3d3d3;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    display: block; /* Removes default inline spacing */
}


/* --- SLIDER THUMB (The Knot) Customization --- */

/* PAST / PRESENT (Blue) */
#time-slider.slider-past::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff; /* Blue */
    cursor: pointer;
    transition: background 0.3s;
}
#time-slider.slider-past::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}

/* FUTURE (Red) */
#time-slider.slider-future::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc3545; /* Red */
    cursor: pointer;
    transition: background 0.3s;
}
#time-slider.slider-future::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc3545;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}

/* =========================================
   5. CONTEXT MENU (Historical Tab)
   ========================================= */
#context-menu {
    position: absolute;
    top: 0;
    /* Visible state: anchored to right edge */
    right: 0; 
    
    width: 320px;
    height: 100%;
    background: white;
    
    /* High Z-Index to stay above map and zoom controls */
    z-index: 9999; 
    
    padding: 20px;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2); /* Shadow on the left */
    overflow-y: auto;
    box-sizing: border-box;
    
    /* Animation for sliding in/out */
    transition: right 0.3s ease-in-out;
}

/* Hidden state: Push it off-screen to the right by its own width */
#context-menu.hidden {
    right: -320px; 
}

/* Menu Content Styles */
.menu-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    padding: 0;
    line-height: 1;
}

.menu-close-btn:hover {
    color: #dc3545;
}

.menu-title {
    font-size: 1.2rem;
    margin: 30px 0 15px 0; /* Top margin clears the close button */
    color: #007bff;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.menu-image {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    display: block;
}

.menu-meta {
    font-size: 0.9rem;
    color: #555;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
}

.menu-label {
    font-weight: bold;
    color: #333;
}