* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* line-height: 1.6; */
    color: #333;
    background-color: #f5f7fa;
    overflow-y: auto;
}


.container {
    max-width: 1400px;
    margin: 0 auto;
    margin-top: 20px;
    /* No fixed height, allow to grow */
    translate: 0px -860px;
}

h1, h2, h3 {
    color: #2c3e50;
}

/* Navbar Styles */
.navbar {
    background-color: #d3dbe6;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Navbar header with toggle button */
.navbar-header {
    height: 30px;
    display: flex;
    /* justify-content: space-between; */
    align-items: center;
    padding: 0 10px;
    background-color: #d3dbe6;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar-title {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    padding-right: 15px;
}

.navbar-toggle {
    width: 30px;
    height: 22px;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    transition: background-color 0.2s;
}

.navbar-toggle:hover {
    background-color: #d0d0d0;
}

.navbar-toggle .arrow-icon {
    font-size: 10px;
    transition: transform 0.3s;
}

.generic-button {
    background-color: #ffffff;
    font-size: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    height: 22px;
    padding: 0 5px;
    margin-left: auto;
}

/* When navbar is collapsed, rotate arrow */
.navbar.collapsed .navbar-toggle .arrow-icon {
    transform: rotate(-90deg);
}

/* Collapsible content container */
.navbar-collapsible-content {
    padding: 10px;
    transition: all 0.3s ease;
}

/* When navbar is collapsed */
.navbar.collapsed .navbar-collapsible-content {
    max-height: 0;
    padding: 0 10px;
    opacity: 0;
    pointer-events: none;
}

/* When navbar is expanded */
.navbar:not(.collapsed) .navbar-collapsible-content {
    max-height: 500px;
    opacity: 1;
    pointer-events: auto;
}

.filter-rows-container {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.filter-row {
    margin-bottom: 10px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: space-between;
}

.filter-group {
    flex: 1;
    min-width: 0;
}

.reset-button-container {
    flex: 0 0 auto;
    width: 140px;
    display: flex;
    align-items: flex-end;
    margin-right: 10px;
    padding-top: 16px; /* Align with other filter inputs */
}

.reset-button-placeholder {
    flex: 0 0 auto;
    width: 140px; /* Same as reset-button-container */
    margin-right: 10px; /* Same as reset-button-container */
    /* This div is just for spacing, so no visible content */
}

.reset-button-container .btn {
    width: 100%;
    padding-top: 5px;
    padding-bottom: 0px;
    white-space: nowrap;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reset-button-container .btn i {
    margin-right: 8px;
}

.reset-button-container .btn:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.reset-button-container .btn:active {
    background-color: #dee2e6;
    transform: translateY(1px);
}

/* Date Range Panel Styles */
.date-range-panel {
    background-color: #f9f7f2;
    border-radius: 8px;
    padding: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    max-width: 1400px;
    margin: 0px 5px;
    width: 35%;
}

.date-range-container {
    width: 100%;
    padding: 0px 15px;
}

.date-range-content {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.range-slider-container {
    margin-top: 0px;
    /* padding: 0 10px; */
}

.range-slider {
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

#date-range-display {
    font-weight: normal;
    font-size: 0.9em;
    color: #666;
    margin-left: 10px;
}

.filter-group {
    min-width: 0;
    position: relative;
}

/* Dropdown Filter Styles */
.dropdown-filter .filter-trigger {
    padding: 2px 15px;
    background-color: #cad5e1;
    border: 2px solid #fff;
    border-radius: 2.8px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-filter .filter-trigger:hover {
    background-color: #e9ecef;
}

.dropdown-filter .arrow-down {
    font-size: 10px;
    margin-left: 5px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 200px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Styling for dropdown when positioned as overlay */
.dropdown-overlay {
    position: fixed !important; /* Override any other positioning */
    z-index: 1000 !important; /* Ensure it's above other elements */
    max-height: 300px !important; /* Allow more space for content */
    box-shadow: 0 6px 12px rgba(0,0,0,0.15) !important; /* Enhanced shadow for overlay */
    z-index: 100;
    margin-top: 5px;
    left: 0;
    right: 0;
}

.dropdown-content.show {
    display: block;
}

.visualization-options {
    display: none; /* Hide the old visualization options container */
}

.option-group {
    flex: 0 0 auto;
    margin-right: 10px;
}

.option-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
}

.option-group select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background-color: #f8f9fa;
    min-width: 120px;
}

/* Styles for table row selection and interaction */
#data-table tbody tr:hover {
    cursor: pointer;
    background-color: #f0f0f0; /* Light grey hover */
}

#data-table tbody tr.table-row-selected {
    background-color: #cfe2ff; /* A light blue for selection */
    font-weight: bold;
}

#data-table tbody tr.table-row-greyed {
    opacity: 0.6;
    color: #6c757d; /* Grey text */
}

/* Styles for matrix row selection and interaction */
.matrix-row[data-level="4"]:hover {
    cursor: pointer;
    background-color: #f0f0f0; /* Light grey hover */
}

.matrix-row.matrix-row-selected {
    background-color: #cfe2ff; /* A light blue for selection */
    font-weight: bold;
}

.matrix-row.matrix-row-greyed {
    opacity: 0.6;
    color: #6c757d; /* Grey text */
}

/* Dashboard Styles */
.dashboard {
    /* min-height: 700px;  Removed to allow page to grow with content */
    /* padding-top: 20px; */
    transition: padding-top 0.3s ease;
    position: relative;
    max-width: 1920px;
    margin: 0 auto;
}

/* Visualization Row Layout */
.visualization-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 20px;
}

.matrix-side {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    background-color: #f9f7f2;
    border-radius: 8px;
    padding: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-side {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.dashboard.viewers-expanded {
    /* No longer need margin-top since dashboard is now a sibling element */
    padding-top: 0px;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    /* Remove any height/flex-grow that blocks vertical scroll */
}

.chart-container {
    background-color: #f9f7f2;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 300px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.chart-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.chart-controls .option-group {
    margin: 5px 0;
}

.chart-canvas-container {
    flex: 1;
    /* padding: 0 20px; */
    min-height: 0; /* Allows the canvas to shrink below its content size */
    position: relative;
}

.chart-canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.data-table-container {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-grow: 1;
}

/* Main panels row container */
.panels-row-container {
    display: flex;
    width: 100%;
    max-width: 1940px;
  margin: 0px auto;
}

/* Date range panel */
.date-range-panel {
    width: 50%;
}

.date-range-container {
    background-color: #f9f7f2;
    border-radius: 8px;
}

/* Cards panel */
.cards-panel {
    margin: 0px 5px;
    width: 65%;
}

.cards-container {
    background-color: #f9f7f2;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 8px;
    /* padding: 0x 32px 0px 12px; */
    /* height: 100%; */
}

.cards-grid {
    display: flex;
    grid-template-columns: repeat(5, 1fr);
    gap: 40px;
    height: 100%;
}

.card-container {
    /* min-height: 49px; */
    padding: 0px 0px;
}

#card-led-indicator {
    min-width: 12%;
}

/* Multi-select Checkbox Styles */
.multi-select {
    background-color: #f8f9fa;
    padding: 5px;
}

.filter-selection-summary {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

.checkbox-item {
    padding: 3px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item:hover {
    background-color: #f5f5f5;
}

.checkbox-item.select-all {
    font-weight: bold;
    background-color: #f0f0f0;
}

.dropdown-separator {
    height: 1px;
    background-color: #ddd;
    margin: 4px 0;
}

.checkbox-item input {
    margin-right: 8px;
    width: auto;
}

.checkbox-item label {
    margin-bottom: 0;
    display: inline;
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-options {
    padding: 8px;
    color: #666;
    font-style: italic;
    font-size: 13px;
    text-align: center;
}

/* Form Elements Styles */
label {
    display: block;
    margin-bottom: 0px;
    font-weight: 500;
    font-size: 12px;
}

select, input {
    width: 100%;
    /* padding: 8px 12px; */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background-color: #faf8f8;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.primary {
    background-color: #3498db;
    color: white;
}

.primary:hover {
    background-color: #2980b9;
}

.secondary {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.secondary:hover {
    background-color: #dde4e6;
}

/* Matrix Visualization Styles */
.matrix-container {
    background-color: #f9f7f2;
    border-radius: 8px;
    padding: 10px 10px 0px 10px;
}

.matrix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hierarchy-controls {
    display: flex;
    gap: 5px;
}

.hierarchy-btn {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hierarchy-btn:hover {
    background-color: #e9ecef;
}

.hierarchy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hierarchy-btn.at-limit {
    opacity: 0.5;
}

.arrow-up, .arrow-down {
    font-size: 12px;
    line-height: 1;
    color: #495057;
}

.hierarchy-btn:hover .arrow-up,
.hierarchy-btn:hover .arrow-down {
    color: #212529;
}

.hierarchy-btn:disabled .arrow-up,
.hierarchy-btn:disabled .arrow-down {
    color: #adb5bd;
}

.matrix-wrapper {
    overflow-x: auto;
    height: 240px;
    overflow-y: auto;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
}

.matrix-table th {
    background-color: #f9f7f2;
    font-weight: 600;
    padding: 5px 5px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #ddd;
    font-size: 0.69em;
}

/* Style for numeric columns in matrix */
.matrix-table td:not(.hierarchy-cell) {
    font-family: 'Courier New', Courier, monospace;
    color: #555;
    text-align: right;
    padding-right: 15px;
    font-size: 0.75em; /* Slightly smaller font size */
}

/* Style for difference column */
.matrix-table td:nth-child(4) {
    font-weight: 500;
}

/* Positive difference in green */
.positive-diff {
    color: #008800;
}
.negative-diff {
    color: #cc0000;
}
.zero-diff {
    color: #222;
}

table, th, td {
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', 'Liberation Mono', monospace !important;
}

.matrix-table .positive-diff {
    color: #28a745 !important;
}

/* Negative difference in red */
.matrix-table .negative-diff {
    color: #dc3545 !important;
}

/* Hide -0 values */
.matrix-table .zero-diff {
    color: #6c757d !important;
}

/* Hierarchy cells styling */
.matrix-table .hierarchy-cell {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    text-align: left;
    font-size: 0.7em;
}

/* WBS row specific styling (level 4) */
.matrix-row[data-level="4"] .hierarchy-cell {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.7em;
    color: #444;
}

/* Higher level rows */
.matrix-row[data-level="0"] .hierarchy-cell,
.matrix-row[data-level="1"] .hierarchy-cell,
.matrix-row[data-level="2"] .hierarchy-cell,
.matrix-row[data-level="3"] .hierarchy-cell {
    font-weight: 500;
}

/* Matrix Footer Styles */
.matrix-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background-color: #f8f9fa;
    border-top: 2px solid #ddd;
}

.matrix-footer th {
    font-weight: 700;
    color: #333;
    text-align: left;
    /* padding: 12px 15px; */
    border-bottom: none;
    font-family: inherit;
}

/* Style for footer numeric cells */
.matrix-footer td {
    font-family: 'Courier New', Courier, monospace;
    color: #333;
    text-align: right;
    padding-right: 15px;
    font-weight: bold;
    font-size: 1em; /* Slightly larger than row values */
}

.matrix-footer th:first-child {
    text-transform: uppercase;
    font-size: 0.9em;
}

#total-planned, #total-actual, #total-difference, #total-sal {
    text-align: right;
    font-family: monospace;
    font-size: 12.5px;
}

.positive-difference {
    color: #28a745;
}

.negative-difference {
    color: #dc3545;
}

.matrix-row {
    cursor: pointer;
}

.matrix-row:hover {
    background-color: #f5f7fa;
}

.matrix-row td {
    padding: 1px 10px;
    border-bottom: 1px solid #eee;
}

.hierarchy-cell {
    text-align: left;
    min-width: 200px;
}

.amount-cell {
    text-align: right;
    font-family: monospace;
    font-size: 13px;
}

.amount-cell.positive {
    color: #28a745;
}

.amount-cell.negative {
    color: #dc3545;
}

.expand-collapse {
    display: inline-block;
    width: 16px;
    text-align: center;
    cursor: pointer;
    color: #3498db;
    font-size: 7px;
    margin-right: 5px;
}

/* Level styling */
.level-0 {
    font-weight: 600;
    background-color: #f8f9fa;
}

.level-1 {
    font-weight: 500;
    background-color: #fcfcfc;
}

.level-2 {
    font-weight: normal;
}

.level-3 {
    font-weight: normal;
    color: #444;
}

.level-4 {
    font-weight: normal;
    font-size: 0.95em;
    color: #666;
}

/* Table Styles */
.table-wrapper {
    overflow-x: auto;
    height: 300px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
    /* Add a border to visually separate the header */
    border-top: 1px solid #ddd;
}

tfoot th, tfoot td {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 2;
    border-bottom: 2px solid #bbb;
}


tr:hover {
    background-color: #f5f7fa;
}

/* Styles for horizontally scrollable chart */
.chart-scroll-container {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.chart-canvas-container {
    position: relative;
    height: 100%;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .visualization-options {
        margin-top: 10px;
    }
}







/* --- Overlay and Tooltip Z-Index Management --- */
.cutoff-overlay {
    position: absolute;
    z-index: 998;
    pointer-events: none;
    height: 100%;
    width: auto;
}

/* Generic tooltip selector, adjust as needed */
.chartjs-tooltip, .tooltip, .chart-tooltip {
    z-index: 1000 !important;
}

.model-selection-div {
    display: flex;
    flex-direction: row;
    align-items: start;
    margin-bottom: 0.5rem;
}

/* Modale selezione modelli */
.model-selection-modal-container {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 100; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

.modal-content {
    background-color: #fefefe;
    margin: auto; /* 15% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* Could be more or less, depending on screen size */
    border-radius: 8px;
    max-height: 75%;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 2px 16px;
    color: white;
}

.modal-body {
    padding: 2px 16px;
    overflow: auto; /* Enable scroll if needed */
}

.modal-footer {
    padding: 2px 16px;
    color: white;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.model-selection-checkbox {
    width: initial;
}

.model-selection-div {
    display: flex;
    flex-direction: row;
    align-items: start;
    margin-bottom: 0.5rem;
}

