/* Base page layout */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden; 
    background-color: #ffffff;
    display: flex;
    flex-direction: column; /* Stack controls panel on top of the graph */
}

/* Fixed Header Panel - Single row that NEVER wraps */
#controls-container {
    position: relative; 
    z-index: 10;
    color: #333333; 
    font-family: Arial, sans-serif;
    background: #ffffff; 
    padding: 10px 20px;
    border-bottom: 1px solid #ddd; 
    display: flex;
    flex-direction: row;      /* Force everything on one single level */
    align-items: center;      /* Vertically center align everything */
    justify-content: space-between;
    gap: 16px;                /* Optimized spacing to prevent crowding */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    flex-shrink: 0; 
    flex-wrap: nowrap;        /* CRITICAL: Absolutely forbids wrapping to a second row */
}

/* Container wrapper for the file uploading block */
.file-input-block {
    display: flex;
    flex-direction: column;   /* Stack file name closely underneath the button */
    align-items: flex-start;
    gap: 2px;
    min-width: 130px;
    flex-shrink: 0;           /* Prevents the file button from compressing */
}

/* Hide the native browser input */
#fileInput {
    display: none;
}

/* Custom File Button Styling */
.custom-file-upload {
    display: inline-block;
    background: #28a745; 
    color: white;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

.custom-file-upload:hover {
    background: #218838;
}

/* Small file display positioned tightly beneath button */
#fileNameDisplay {
    font-size: 11px;
    color: #777777;
    font-style: italic;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;  
    white-space: nowrap;
}

/* Group for slider elements - Swallows all flexible space */
.slider-group {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;             /* Absorb empty space */
    flex-shrink: 1;           /* Allowed to compress down cleanly when window shrinks */
    min-width: 100px;         /* Low boundary to let slider squeeze tightly */
}

.slider-group label {
    white-space: nowrap;      /* Prevents text from breaking into two lines */
}

/* Forces slider track to span across the flexible parent bounds */
#eventSlider {
    flex-grow: 1;
    width: 100%;              
    cursor: pointer;
    min-width: 50px;          /* Allows slider line to get tiny instead of wrapping */
}

#sliderVal {
    font-weight: bold;
    font-size: 13px;
    min-width: 75px;          
    white-space: nowrap;
}

/* Right-aligned input group block */
.input-group {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;           /* Protects inputs from squeezing */
}

.input-group label {
    white-space: nowrap;      /* Keeps text crisp on one line */
}

#timeInput {
    width: 60px;
    background: #ffffff;
    color: #333;
    border: 1px solid #ccc;
    padding: 5px;
    border-radius: 4px;
    outline: none;
}

#jumpBtn {
    background: #007bff; 
    color: white;
    border: none;
    padding: 5px 12px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

#jumpBtn:hover {
    background: #0056b3;
}

#jumpBtn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* safe structural area for the plot container */
.plot-container-wrapper {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    position: relative;
    box-sizing: border-box;
    padding-top: 45px; /* Pushes graph below control bar so titles never overlap */
}

/* Plotly Canvas space */
#myPlot {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}