/* Natural Gas Scheduling & Trading Map - Styles */

:root {
    --primary-color: #1a5276;
    --secondary-color: #2e86ab;
    --accent-color: #f39c12;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --bg-dark: #1e2a38;
    --bg-light: #f5f6fa;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #dce1e6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-primary);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.help-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.help-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Main Layout - structured for Split.js resizable panels */
.main-container {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 100px); /* Account for header + footer */
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section h3 {
    margin: 0 0 15px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Layer Controls */
.layer-toggle {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.layer-toggle input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
}

.layer-toggle label {
    font-size: 0.95rem;
    cursor: pointer;
}

/* Time Slider */
.time-slider-container {
    padding: 10px 0;
}

.time-label {
    text-align: center;
    font-weight: 600;
    margin-top: 10px;
    color: var(--primary-color);
}

/* Simulation Controls */
.simulation-select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    background: white;
}

.apply-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

.apply-btn:hover {
    background: var(--secondary-color);
}

.reset-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 8px;
}

.reset-btn:hover {
    background: var(--bg-light);
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

/* Right Detail Panel */
.detail-panel {
    /* width controlled by Split.js */
    background: white;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

/* Left Sidebar */
.left-sidebar {
    /* width controlled by Split.js */
    background: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Search Box */
.search-container {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-container h3 {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.search-dropdown {
    width: 100%;
}

/* Fix dropdown menu item overflow/overlap */
.search-dropdown .Select-menu-outer {
    max-height: 300px;
    z-index: 1000;
}

.search-dropdown .VirtualizedSelectOption,
.search-dropdown .Select-option {
    padding: 12px 12px;
    line-height: 1.5;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    min-height: 44px;
    height: auto !important;
    display: block;
    box-sizing: border-box;
}

/* Ensure dropdown items don't overlap */
.Select-menu {
    max-height: 280px;
    overflow-y: auto;
}

.Select-option {
    box-sizing: border-box;
}

/* Quick Legend in sidebar */
.quick-legend {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.quick-legend h3 {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.quick-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.quick-legend-color {
    width: 16px;
    height: 4px;
    margin-right: 8px;
    border-radius: 2px;
}

.quick-legend-marker {
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border-radius: 50%;
}

/* Data Tab Content */
.data-tab-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.data-tab-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.data-tab-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Center Content Area (Map + Data Panels) */
.center-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.center-content .map-container {
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

/* Ensure the plotly graph stays within bounds */
.center-content .map-container .js-plotly-plot,
.center-content .map-container .plot-container,
.center-content .map-container .plotly {
    height: 100% !important;
    max-height: 100% !important;
}

/* Data Panels Row (3 columns below map) */
.data-panels-row {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--border-color);
    background: white;
}

.data-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    min-width: 0;
}

.data-column:last-of-type {
    border-right: none;
}

.data-column-header {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-column-content {
    padding: 12px 15px;
    flex: 1;
    overflow-y: auto;
    max-height: 200px;
}


@media (max-width: 1200px) {
    .data-column-content {
        max-height: 180px;
        padding: 10px 12px;
    }
}

@media (max-width: 992px) {
    .data-panels-row {
        flex-direction: column;
    }

    .data-column {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .data-column:last-of-type {
        border-bottom: none;
    }

    .data-column-content {
        max-height: 150px;
    }
}

.panel-header {
    background: var(--bg-dark);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
}

.panel-content {
    padding: 20px;
}

/* Price Display */
.price-card {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.price-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.price-card-title {
    font-weight: 600;
    color: var(--text-primary);
}

.price-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.price-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Basis Spread */
.basis-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.basis-row:last-child {
    border-bottom: none;
}

.basis-hub {
    font-weight: 500;
}

.basis-value {
    font-weight: 600;
}

.basis-positive {
    color: var(--success-color);
}

.basis-negative {
    color: var(--danger-color);
}

/* Forward Prices */
.forward-table {
    width: 100%;
    border-collapse: collapse;
}

.forward-table th, .forward-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.forward-table th {
    background: var(--bg-light);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* Educational Callout */
.callout {
    background: #fff9e6;
    border-left: 4px solid var(--accent-color);
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 4px 4px 0;
}

.callout-title {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.callout-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Nomination Timeline */
.timeline-container {
    padding: 20px 0;
}

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-time {
    font-weight: 600;
    color: var(--primary-color);
}

.timeline-title {
    font-weight: 500;
    margin: 5px 0;
}

.timeline-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Tabs */
.tabs-container {
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    background: var(--bg-light);
}

.tab {
    display: inline-block;
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Storage Indicator */
.storage-gauge {
    height: 20px;
    background: var(--bg-light);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--accent-color));
    border-radius: 10px;
    transition: width 0.5s ease;
}

/* Legend */
.legend {
    position: absolute;
    bottom: 30px;
    right: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.legend-title {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.legend-color {
    width: 20px;
    height: 4px;
    margin-right: 10px;
    border-radius: 2px;
}

.legend-marker {
    width: 12px;
    height: 12px;
    margin-right: 10px;
    border-radius: 50%;
}

/* Responsive - widths controlled by Split.js on larger screens */
@media (max-width: 1200px) {
    /* Split.js handles widths - just ensure min constraints */
    #left-sidebar {
        min-width: 180px;
    }
    #detail-panel {
        min-width: 280px;
    }
}

@media (max-width: 992px) {
    /* On small screens, disable Split.js layout and stack vertically */
    .main-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .sidebar,
    .left-sidebar,
    #left-sidebar {
        width: 100% !important;
        height: auto !important;
        flex-direction: row;
        overflow-x: auto;
    }

    .sidebar-section {
        min-width: 200px;
    }

    .detail-panel,
    #detail-panel {
        width: 100% !important;
        height: auto !important;
    }

    #center-right-wrapper {
        flex-direction: column;
        height: auto !important;
    }

    #center-content {
        height: auto !important;
    }

    /* Hide gutters on mobile */
    .gutter {
        display: none;
    }
}

/* LIVE Badge Animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(39, 174, 96, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
    }
}

.live-badge {
    animation: pulse 2s infinite;
}

/* EIA Data Cards */
.eia-data-card {
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    margin-top: 10px;
}

.eia-data-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.eia-data-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 4px;
}

.eia-data-source {
    font-size: 0.7rem;
    color: var(--success-color);
    margin-left: 8px;
}

/* Storage Status Indicators */
.storage-injection {
    color: var(--success-color);
}

.storage-withdrawal {
    color: var(--danger-color);
}

/* =====================================================
   Map Hover/Click UX - Cursor and Visual Feedback
   ===================================================== */

/* Pointer cursor on all interactive map elements */
.map-container .js-plotly-plot .plotly svg .point,
.map-container .js-plotly-plot .plotly svg .scattergeo path,
.map-container .js-plotly-plot .plotly svg .trace.scattergeo {
    cursor: pointer;
}

/* Glow effect on hover for markers */
.map-container .js-plotly-plot .plotly svg .point:hover {
    filter: drop-shadow(0 0 6px rgba(52, 152, 219, 0.8));
}

/* Pipeline line hover effect */
.map-container .js-plotly-plot .plotly svg .scattergeo path:hover {
    stroke-width: 4px !important;
    filter: drop-shadow(0 0 4px rgba(26, 188, 156, 0.6));
}

/* Class added via JavaScript when hovering over map elements */
.map-container.element-hovered {
    cursor: pointer;
}

/* =====================================================
   Resizable Panel Dividers (Split.js Gutters)
   ===================================================== */

/* Base gutter styles */
.gutter {
    background-color: #e0e0e0;
    background-repeat: no-repeat;
    background-position: 50%;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
}

.gutter:hover {
    background-color: #3498db;
}

.gutter:active {
    background-color: #2980b9;
}

/* Horizontal gutter (vertical divider line) */
.gutter.gutter-horizontal {
    cursor: col-resize;
    width: 6px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='30'%3E%3Ccircle cx='3' cy='8' r='1.5' fill='%2395a5a6'/%3E%3Ccircle cx='3' cy='15' r='1.5' fill='%2395a5a6'/%3E%3Ccircle cx='3' cy='22' r='1.5' fill='%2395a5a6'/%3E%3C/svg%3E");
}

.gutter.gutter-horizontal:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='30'%3E%3Ccircle cx='3' cy='8' r='1.5' fill='white'/%3E%3Ccircle cx='3' cy='15' r='1.5' fill='white'/%3E%3Ccircle cx='3' cy='22' r='1.5' fill='white'/%3E%3C/svg%3E");
}

/* Vertical gutter (horizontal divider line) */
.gutter.gutter-vertical {
    cursor: row-resize;
    height: 6px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='6'%3E%3Ccircle cx='8' cy='3' r='1.5' fill='%2395a5a6'/%3E%3Ccircle cx='15' cy='3' r='1.5' fill='%2395a5a6'/%3E%3Ccircle cx='22' cy='3' r='1.5' fill='%2395a5a6'/%3E%3C/svg%3E");
}

.gutter.gutter-vertical:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='6'%3E%3Ccircle cx='8' cy='3' r='1.5' fill='white'/%3E%3Ccircle cx='15' cy='3' r='1.5' fill='white'/%3E%3Ccircle cx='22' cy='3' r='1.5' fill='white'/%3E%3C/svg%3E");
}

/* Split.js panel container adjustments */

/* Left sidebar - must have explicit height for horizontal split */
#left-sidebar {
    min-width: 180px;
    max-width: 400px;
    height: 100%;
    overflow-y: auto;
}

/* Center + Right wrapper - flex container for nested split */
#center-right-wrapper {
    display: flex;
    flex-direction: row;
    flex: 1;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

/* Center content - contains map and data panels */
#center-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

/* Right detail panel */
#detail-panel {
    min-width: 280px;
    max-width: 600px;
    height: 100%;
    overflow-y: auto;
}

/* Map container */
#map-container {
    min-height: 200px;
    overflow: hidden;
}

/* Data panels row */
#data-panels-row {
    min-height: 80px;
    max-height: 400px;
    overflow: visible;
}

/* Ensure data columns fill the available height and scroll internally */
#data-panels-row .data-column {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#data-panels-row .data-column-content {
    flex: 1;
    overflow-y: auto;
}

/* Let Split.js control sizing - don't override inline styles */
.left-sidebar {
    height: 100%;
}

.detail-panel {
    height: 100%;
}

.center-content {
    height: 100%;
}

.data-column-content {
    max-height: none;
}
