/* =============================================================================
   FREIGHT RATE FORECASTER - OPTIMIZED CSS
   ============================================================================= */

/* =============================================================================
   1. RESET & BASE STYLES
   ============================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.4;
}

/* =============================================================================
   2. MAIN CONTAINER
   ============================================================================= */
.fr-container {
    max-width: none;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* =============================================================================
   3. HEADER STYLES
   ============================================================================= */
.header {
    background-color: #2c5f41;
    color: white;
    padding: 15px 20px;
    margin: -20px -20px 20px -20px;
    border-radius: 8px 8px 0 0;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

/* =============================================================================
   4. VESSEL SELECTOR & FILTERS
   ============================================================================= */
.vessel-selector {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #ddd;
    display: flex;
    gap: 50px; 
}

.vessel-selector label {
    font-weight: 600;
    margin-right: 10px;
    color: #2c5f41;
}

/* =============================================================================
   5. SECTION STYLES
   ============================================================================= */
.section {
    margin-bottom: 30px;
}

.section-title {
    background-color: #2c5f41;
    color: white;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 16px;
    border-radius: 4px 4px 0 0;
    margin-bottom: 0;
}

/* =============================================================================
   6. TABLE STYLES
   ============================================================================= */

/* Main Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table th {
    background-color: #e8f3ed;
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #ddd;
    color: #2c5f41;
    white-space: nowrap;
    font-size: 11px;
  
}

.data-table td {
    padding: 6px;
    text-align: center;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.data-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.data-table tbody tr:hover {
    background-color: #e8f3ed;
}

/* Half-width Tables */
.data-table-half {
    width: 50%;
    border-collapse: collapse;
    font-size: 12px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table-half th {
    background-color: #e8f3ed;
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #ddd;
    color: #2c5f41;
    white-space: nowrap;
    font-size: 11px;
}

.data-table-half td {
    padding: 6px;
    text-align: center;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.data-table-half tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.data-table-half tbody tr:hover {
    background-color: #e8f3ed;
}

/* Table Row Types */
.row-header {
    background-color: #f1f1f1 !important;
    font-weight: 600;
    text-align: left !important;
    padding-left: 12px !important;
    color: #2c5f41;
}

.user-input-row {
    background-color: #fff9e6 !important;
    color: #8b4513 !important;
    font-style: italic;
}

.cargo-row {
    background-color: #f8f9fa;
}

.cargo-row td:first-child {
    padding-left: 20px;
    font-style: italic;
    color: #666;
}

.percentage {
    color: #28a745;
    font-weight: 600;
}

/* extras after optimisation*/

#Table2 {
  table-layout: fixed;
}

#Table2 .input-cell input {
  width: 60px;
  max-width: 60px;
  box-sizing: border-box;
}


.data-table td,
.data-table-half td {
    height: 28px; /* Keep narrow row height */
}

.data-table th,
.data-table-half th {
    height: 32px; /* Slightly taller for headers */
}


/* =============================================================================
   7. INPUT CELL STYLES
   ============================================================================= */
.input-cell {
    /* cream-white background */
    background-color: #FDFAE6 !important;
    /* light grey border */
    border: 1px solid #CCC !important;
    box-shadow: none !important;
    border-radius: 0;       /* square corners—adjust if you like */
    padding: 0;
    width: 80px !important;
    min-width: 80px !important;
    height: auto !important;/* will shrink to fit the input */
}

.input-cell input {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    width: 100%;
    height: 16px !important;
    line-height: 16px;
    padding: 0 2px;
    margin: 0;
    box-sizing: border-box;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #1f2d52;         /* deep navy for high contrast */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* focus state */
.input-cell input:focus {
    box-shadow: inset 0 0 0 2px rgba(27,94,32,0.3);
}

/* remove number-spinner arrows */
/* Chrome, Safari, Edge, Opera */
.input-cell input[type=number]::-webkit-outer-spin-button,
.input-cell input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* Firefox */
.input-cell input[type=number] {
    -moz-appearance: textfield;
}

/* =============================================================================
   8. SCROLL CONTAINERS
   ============================================================================= */
.scroll-container {
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
}

/* =============================================================================
   9. SECTION LAYOUT CONTAINERS
   ============================================================================= */

/* Vessel Supply Section Layout */
.supply-tables-container {
    display: flex !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
}

.supply-table2-container {
    flex: 0 0 35% !important;
    min-width: 0 !important;
}

.supply-table1-container {
    flex: 0 0 65% !important;
    min-width: 0 !important;
}

/* Vessel Demand Section Layout */
.demand-tables-container {
    display: flex !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
}

.demand-table4-container {
    flex: 0 0 35% !important;
    min-width: 0 !important;
}

.demand-table3-container {
    flex: 0 0 65% !important;
    min-width: 0 !important;
}

/* Override existing table widths within flex containers */
.supply-tables-container .data-table,
.demand-tables-container .data-table,
.supply-tables-container .data-table-half,
.demand-tables-container .data-table-half {
    width: 100% !important;
}

.supply-tables-container .scroll-container,
.demand-tables-container .scroll-container {
    width: 100% !important;
    overflow-x: auto !important;
}

/* =============================================================================
   10. FILTERS SYSTEM
   ============================================================================= */
.filters-container {
    max-width: none;
    margin: 0 auto;
}

.filters-header {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

.filters-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.2em;
    font-weight: 600;
}

.filters-header p {
    margin: 0;
    color: #7f8c8d;
    font-size: 1.1em;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.filter-group {
    background: #fafbfc;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.filter-group:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.filter-group.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.filter-group.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group.primary label {
    color: rgba(255, 255, 255, 0.9);
}

.filter-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.filter-group.primary select {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
}

/* =============================================================================
   11. BUTTONS
   ============================================================================= */
.filter-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #ecf0f1;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

/* =============================================================================
   12. FILTER SUMMARY
   ============================================================================= */
.filter-summary {
    background: #e8f5e8;
    border: 1px solid #c3e6c3;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
    display: none;
}

.filter-summary.active {
    display: block;
}

.filter-summary h3 {
    margin: 0 0 10px 0;
    color: #27ae60;
    font-size: 1.1em;
}

.filter-summary ul {
    margin: 0;
    padding-left: 20px;
    color: #2c3e50;
}

/* =============================================================================
   13. CHARTS AREA
   ============================================================================= */
.my-custom-area {
    width: 100%;
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.charts-wrapper {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    align-items: stretch;
}

.chart-container {
    position: relative;
    height: 450px;
    background: white;
    /*border: 1px solid #ddd;*/
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-container:first-child {
    flex: 0 0 40%;
}

.chart-container:last-child {
    flex: 0 0 60%;
}

.chart-container h3 {
    text-align: center;
    margin: 0 0 15px 0;
    color: #2c5f41;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #e8f3ed;
    padding-bottom: 10px;
}

.chart-container canvas {
    max-width: 100%;
    max-height: calc(100% - 60px);
}

.selection-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid #e0e0e0;
    backdrop-filter: blur(5px);
}

.selection-info h4 {
    margin: 0 0 5px 0;
    font-size: 13px;
    color: #2c5f41;
    font-weight: 600;
}

.selection-info p {
    margin: 0;
    color: #666;
    line-height: 1.3;
}

.no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-style: italic;
    font-size: 16px;
    text-align: center;
    background: #fafafa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    margin: 10px 0;
}

/* =============================================================================
   14. HIDDEN ELEMENTS
   ============================================================================= */
/*#selectionInfo,
#seriesSelectionInfo {
    visibility: hidden !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}*/

#vesselSupplyTableContainer,
#vesselDemandTableContainer,
#vesselSupplyAnnualContainer,
#vesselDemandAnnualContainer {
    min-height: 100px;
}

/* =============================================================================
   15. RESPONSIVE DESIGN
   ============================================================================= */
@media (max-width: 1024px) {
    .supply-tables-container,
    .demand-tables-container {
        flex-direction: column !important;
    }
    
    .supply-table2-container,
    .supply-table1-container,
    .demand-table4-container,
    .demand-table3-container {
        flex: 1 1 auto !important;
    }
}

@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
    }
    
    .charts-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .chart-container:first-child,
    .chart-container:last-child {
        flex: 1 1 auto;
    }
    
    .chart-container {
        height: 300px;
        padding: 10px;
    }
    
    .chart-container h3 {
        font-size: 16px;
    }
}


/* =============================================================================
   VESSEL OPERATIONS SECTION
   ============================================================================= */

.operations-container {
    display: flex !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    align-items: flex-start !important;
}

.operations-filters {
    flex: 0 0 30% !important;
    min-width: 0 !important;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 15px;
}

.operations-table {
    flex: 0 0 70% !important;
    min-width: 0 !important;
}

/* Year Headers */
.year-headers {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #e8f3ed;
    padding-bottom: 8px;
}

.year-header-spacer {
    min-width: 80px; /* Same as filter label width */
}

.year-header {
    flex: 1;
    text-align: center;
    color: #2c5f41;
    font-weight: 600;
    font-size: 14px;
}

/* Filter Rows - Horizontal Layout */
.filter-row-horizontal {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.filter-row-horizontal:last-child {
    margin-bottom: 0;
}

.filter-row-horizontal .filter-label {
    font-weight: 600;
    color: #2c5f41;
    font-size: 12px;
    min-width: 80px;
    text-align: right;
}

.filter-row-horizontal .filter-placeholder {
    flex: 1;
}

.operations-filters select {
    width: 100% !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    background: white !important;
    color: #333 !important;
    min-height: 24px !important;
}

.operations-filters select:focus {
    outline: none !important;
    border-color: #2c5f41 !important;
    box-shadow: 0 0 0 2px rgba(44, 95, 65, 0.1) !important;
}

.operations-table .scroll-container {
    width: 100% !important;
    overflow-x: auto !important;
}

.operations-table .data-table {
    width: 100% !important;
}

@media (max-width: 1024px) {
    .operations-container {
        flex-direction: column !important;
    }
    
    .operations-filters,
    .operations-table {
        flex: 1 1 auto !important;
    }
    
    .operations-filters {
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .filter-row-horizontal {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 5px !important;
    }
    
    .filter-row-horizontal .filter-label {
        min-width: auto !important;
        text-align: left !important;
    }
    
    .year-headers {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .year-header-spacer {
        display: none !important;
    }
    
    .filter-group {
        margin-bottom: 20px !important;
    }
}

/* =============================================================================
   SUPPLY DEMAND BALANCE SECTION
   ============================================================================= */

.balance-container {
    display: flex !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    align-items: flex-start !important;
}

.balance-filters {
    flex: 0 0 30% !important;
    min-width: 0 !important;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 15px;
}

.balance-table {
    flex: 0 0 70% !important;
    min-width: 0 !important;
}

.balance-filters select {
    width: 100% !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    background: white !important;
    color: #333 !important;
    min-height: 24px !important;
}

.balance-filters select:focus {
    outline: none !important;
    border-color: #2c5f41 !important;
    box-shadow: 0 0 0 2px rgba(44, 95, 65, 0.1) !important;
}

.balance-table .scroll-container {
    width: 100% !important;
    overflow-x: auto !important;
}

.balance-table .data-table {
    width: 100% !important;
}

@media (max-width: 1024px) {
    .balance-container {
        flex-direction: column !important;
    }
    
    .balance-filters,
    .balance-table {
        flex: 1 1 auto !important;
    }
    
    .balance-filters {
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .balance-filters .filter-row-horizontal {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 5px !important;
    }
    
    .balance-filters .filter-row-horizontal .filter-label {
        min-width: auto !important;
        text-align: left !important;
    }
    
    .balance-filters .year-headers {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .balance-filters .year-header-spacer {
        display: none !important;
    }
    
    .balance-filters .filter-group {
        margin-bottom: 20px !important;
    }
}

/* =============================================================================
   FORWARD VIEW SECTION
   ============================================================================= */

.forward-view-container {
    display: flex !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    align-items: flex-start !important;
}

.forward-view-table {
    flex: 0 0 25% !important;
    min-width: 0 !important;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 15px;
}

.forward-view-chart-main {
    flex: 0 0 50% !important;
    min-width: 0 !important;
}

.forward-view-chart-secondary {
    flex: 0 0 25% !important;
    min-width: 0 !important;
}

.forward-view-table .scroll-container {
    width: 100% !important;
    overflow-x: auto !important;
}

.forward-view-table .data-table {
    width: 100% !important;
}

/* Forward View Chart Containers */
.forward-view-chart-main .chart-container,
.forward-view-chart-secondary .chart-container {
    position: relative;
    height: 400px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.forward-view-chart-main .chart-container canvas,
.forward-view-chart-secondary .chart-container canvas {
    max-width: 100%;
    max-height: calc(100% - 60px);
}

/* Responsive Design for Forward View */
@media (max-width: 1024px) {
    .forward-view-container {
        flex-direction: column !important;
    }
    
    .forward-view-table,
    .forward-view-chart-main,
    .forward-view-chart-secondary {
        flex: 1 1 auto !important;
    }
    
    .forward-view-table {
        width: 100% !important;
        margin-bottom: 20px !important;
    }
    
    .forward-view-chart-main .chart-container,
    .forward-view-chart-secondary .chart-container {
        height: 300px;
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .forward-view-table {
        padding: 10px !important;
    }
    
    .forward-view-chart-main .chart-container,
    .forward-view-chart-secondary .chart-container {
        height: 250px;
        padding: 10px;
    }
    
    .forward-view-chart-main h3,
    .forward-view-chart-secondary h3 {
        font-size: 14px;
        margin: 10px 0 5px 0;
    }
}

/* Table7 specific styling within Forward View */
.forward-view-table #Table7 {
    font-size: 11px;
}

.forward-view-table #Table7 th {
    background-color: #e8f3ed;
    padding: 6px 4px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #ddd;
    color: #2c5f41;
    white-space: nowrap;
    font-size: 10px;
}

.forward-view-table #Table7 td {
    padding: 4px;
    text-align: center;
    border: 1px solid #ddd;
    white-space: nowrap;
    font-size: 10px;
}

.forward-view-table #Table7 .row-header {
    background-color: #f1f1f1 !important;
    font-weight: 600;
    text-align: left !important;
    padding-left: 8px !important;
    color: #2c5f41;
    font-size: 10px;
}