/* Home Page Split Pane Layout CSS */

/* Split Pane Container - Compatible with Split.js */
.split-container {
    position: fixed !important;
    top: 50px !important; /* Directly below 50px navbar */
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 50px) !important; /* Adjust height calculation */
    z-index: 1;
    margin: 0 !important;
    /* Split.js requires container with display:flex and flex-direction:column */
    display: flex !important;
    flex-direction: column !important;
    background: transparent; /* Transparent to show map background */
}

/* Upper Split Pane - Contains map background and controls */
.split-pane-upper {
    position: relative;
    width: 100%;
    /* Add initial height (will be overridden by Split.js) */
    height: 70%;
    flex: 1 0 70%;
    overflow: hidden;
    background: transparent; /* Transparent to show map */
    /* For debugging - to see the extent of the upper pane */
    border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
}

/* Lower Split Pane - Contains feature stats table with glass theme */
.split-pane-lower {
    position: relative;
    width: 100%;
    /* Add initial height (will be overridden by Split.js) */
    height: 30%;
    flex: 0 0 30%;
    overflow-y: auto;
    /* Glass theme styling */
    background: rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* Sharp edges - no border radius on top edge where it meets upper pane */
    border-radius: 0 0 12px 12px; /* Only round bottom corners */
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Map Background - Positioned behind both split panes */
.map-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0; /* Behind everything */
    width: 100%;
    height: 100%;
}

/* Product Controls - Constrained to max 20% width to avoid covering map */
.product-controls {
    position: absolute;
    top: 20px; /* Some spacing from top */
    left: 2rem;
    width: calc(20% - 2rem); /* Max 20% width minus margins */
    max-width: calc(20% - 2rem); /* Ensure it never exceeds 20% */
    min-width: 280px; /* Minimum usable width */
    z-index: 900; /* Above map but below navbar */
    overflow-x: auto; /* Enable horizontal scrolling when needed */
}

/* Main product controls container - Bootstrap row with responsive columns */
.product-controls-main {
    /* Bootstrap row handles the layout */
}

/* Colorbar column styling */
.colorbar-column {
    /* Responsive sizing and constraints */
}

/* Colorbar container - positioned within its column */
#colorbar-container {
    position: relative !important; /* Override any fixed positioning */
    display: block !important; /* Ensure it's always visible */
    width: 100%;
    margin: 0;
}

/* Compact colorbar for constrained width */
#colorbar-container .glass-card {
    min-width: 180px;
    max-width: 220px;
}

#colorbar-gradient {
    width: 160px !important; /* Smaller width for constrained layout */
}

/* Time slider container */
.time-slider-container {
    position: relative;
}

/* Map UI Elements - Positioned in upper pane */
.map-ui-elements {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 850; /* Above map but below controls */
    pointer-events: none; /* Allow clicks to pass through to map */
}

/* Individual map UI elements should have pointer-events: auto */
.map-ui-elements > * {
    pointer-events: auto;
}

/* Split.js Gutter Styling */
.gutter {
    background-color: rgba(255, 255, 255, 0.4) !important;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    cursor: row-resize !important;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1000;
}

.gutter:hover {
    background-color: rgba(255, 255, 255, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
}

.gutter.gutter-vertical {
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+YMAxAhkZxAhhIJAFABBRABJdQAHhLJACAAVgAOTgAAAABJRU5ErkJggg==');
    cursor: row-resize;
    width: 100%;
    height: 11px;
}

/* Enhanced gutter visual indicator */
.gutter.gutter-vertical::before {
    content: '⋯';
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    display: block;
    text-align: center;
}

.gutter.gutter-vertical:hover::before {
    color: rgba(255, 255, 255, 1);
}

/* Feature Stats Table Styling in Lower Pane */

/* Remove all margins and padding from table container in lower pane */
.split-pane-lower #feature_stats_table {
    margin: 0 !important;
    padding: 0 !important;
    /* Fill entire lower pane with scrolling */
    width: 100% !important;
    height: 100% !important;
    overflow: auto; /* Enable scrolling for table container */
}

/* Override lower pane padding to remove space around table */
.split-pane-lower {
    padding: 0 !important;
    overflow: hidden; /* Prevent double scrollbars */
}

/* Standard AG Grid dark theme with scrolling */
.split-pane-lower .ag-theme-alpine-dark {
    /* Use default ag-theme-alpine-dark styling */
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    /* Enable internal scrolling */
    overflow: auto;
}

/* AG Grid body viewport scrolling */
.split-pane-lower .ag-body-viewport {
    overflow-x: auto !important;
    overflow-y: auto !important;
}

/* AG Grid center container scrolling */
.split-pane-lower .ag-center-cols-viewport {
    overflow-x: auto !important;
    overflow-y: auto !important;
}

/* Legacy glass table styling for fallback */
.split-pane-lower .glass-feature-table {
    background: transparent;
    border: none;
    box-shadow: none;
}

.split-pane-lower h5 {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Responsive Breakpoints for Product Controls */

/* Large screens (lg and above) - 4 columns side by side, but constrained to 20% width */
@media (min-width: 992px) {
    .product-controls {
        width: calc(20% - 2rem); /* Max 20% width minus margins */
        max-width: calc(20% - 2rem);
    }
    
    .product-controls-main .col-lg-3 {
        flex: 0 0 100%; /* Stack vertically even on large screens due to 20% width */
        max-width: 100%;
        margin-bottom: 0.75rem;
    }
    
    .product-controls-main .col-lg-3:last-child {
        margin-bottom: 0;
    }
    
    /* Compact colorbar for 20% constraint */
    .colorbar-column #colorbar-container .glass-card {
        min-width: 140px;
        max-width: 160px;
    }
    
    .colorbar-column #colorbar-gradient {
        width: 120px !important; /* Compact width for 20% constraint */
    }
}

/* Medium screens (md) - Stack in rows within 20% width */
@media (max-width: 991.98px) and (min-width: 768px) {
    .product-controls {
        width: calc(20% - 1.5rem); /* Still 20% width constraint */
        max-width: calc(20% - 1.5rem);
        left: 1.5rem;
    }
    
    .product-controls-main .col-lg-3 {
        flex: 0 0 100%; /* Stack vertically in single column */
        max-width: 100%;
        margin-bottom: 0.75rem;
    }
    
    .product-controls-main .col-lg-3:last-child {
        margin-bottom: 0;
    }
    
    /* Compact colorbar for medium screens */
    .colorbar-column #colorbar-container .glass-card {
        min-width: 120px;
        max-width: 140px;
    }
    
    .col/* Mobile screens - Stack vertically, maintain 20% width constraint */
@media (max-width: 767.98px) {
    .product-controls {
        width: calc(20% - 1rem); /* 20% width constraint on mobile */
        max-width: calc(20% - 1rem);
        left: 1rem;
        min-width: 220px; /* Ensure minimum usability */
        overflow-y: auto; /* Allow vertical scrolling if content is too tall */
        max-height: calc(100vh - 100px); /* Prevent covering entire screen vertically */
    }
    
    .product-controls-main .col-lg-3 {
        flex: 0 0 100%; /* Stack vertically */
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .product-controls-main .col-lg-3:last-child {
        margin-bottom: 0;
    }
    
    /* Compact colorbar for mobile */
    .colorbar-column #colorbar-container .glass-card {
        min-width: 120px;
        max-width: 140px;
        padding: 0.25rem !important;
    }
    
    .colorbar-column #colorbar-gradient {
        width: 100px !important;
    }
    
    /* Smaller text for mobile */
    .colorbar-column .glass-text {
        font-size: 0.7rem !important;
    }
    
    .split-pane-lower {
        padding: 0.5rem;
    }
}

/* Very small screens - Ultra compact, 20% constraint with scrolling */
@media (max-width: 576px) {
    .product-controls {
        width: calc(20% - 0.5rem); /* Strict 20% width */
        max-width: calc(20% - 0.5rem);
        left: 0.5rem;
        min-width: 180px; /* Absolute minimum for readability */
        overflow-y: auto; /* Vertical scrolling for content that doesn't fit */
        overflow-x: hidden; /* Hide horizontal overflow */
        max-height: calc(100vh - 80px); /* Prevent covering entire screen */
    }
    
    .product-controls-main .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.3rem;
    }
    
    .product-controls-main .col-lg-3:last-child {
        margin-bottom: 0;
    }
    
    /* Ultra compact colorbar */
    .colorbar-column #colorbar-container .glass-card {
        min-width: 80px;
        max-width: 100px;
        padding: 0.15rem !important;
    }
    
    .colorbar-column #colorbar-gradient {
        width: 60px !important;
        height: 6px !important;
    }
    
    /* Very small text for tiny screens */
    .colorbar-column .glass-text {
        font-size: 0.55rem !important;
        line-height: 1.1;
    }
    
    /* Compact labels */
    .colorbar-column label {
        font-size: 0.6rem !important;
        margin-bottom: 0.2rem !important;
    }
    
    .split-pane-lower {
        padding: 0.25rem;
    }
}
