/* Registration & Login Styles */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    background: url('auth-bg.png') no-repeat center center fixed;
    background-size: cover;
    font-family: 'Inter', sans-serif;
}

.auth-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.auth-card {
    position: relative;
    width: 400px;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.2);
    color: #fff;
    text-align: center;
}

.auth-card h1 {
    font-size: 2rem;
    letter-spacing: 2px;
    margin-bottom: 5px;
    color: #00f2fe;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

.auth-card p#auth-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
}

.auth-card .form-group {
    text-align: left;
    margin-bottom: 20px;
}

/* Password Input Enhancements */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 15px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
    user-select: none;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: #00f2fe;
}

.password-strength-container {
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 8px;
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-weak { width: 33%; background-color: #ff4d4d; }
.strength-medium { width: 66%; background-color: #ffd93d; }
.strength-strong { width: 100%; background-color: #4facfe; }

.form-feedback {
    display: block;
    margin-top: 5px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.auth-card label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.auth-card input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.auth-card input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: #00f2fe;
}

.auth-btn {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 242, 254, 0.4);
}

.auth-switch {
    margin-top: 20px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.auth-switch a {
    color: #00f2fe;
    text-decoration: none;
    font-weight: bold;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-card .error-message {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.1);
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
    font-size: 0.85rem;
}

/* User Info Bar */
.top-bar {
    display: flex;
    justify-content: flex-end;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

.user-display-info {
    font-size: 0.9rem;
    color: #333;
}

.user-display-info a {
    color: #ff4d4d;
    text-decoration: none;
    margin-left: 10px;
}

/* General Body Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* Fixed height */
    overflow: hidden;
    /* Prevent window scrollbar */
}

/* Main Layout Containers */
.main-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    /* Ensure it fills body */
    overflow: hidden;
    /* Contain children */
}

.header {
    background-color: #0056b3;
    color: white;
    padding: 1rem;
    text-align: center;
}

.header h1 {
    margin: 0;
    color: white;
}

.footer {
    background-color: #333;
    color: white;
    padding: 0.5rem;
    text-align: center;
}

/* --- Main Tab Layout --- */
.main-tabs {
    display: flex;
    background-color: #e0e0e0;
    border-bottom: 2px solid #0056b3;
}

.main-tab-button {
    flex: 1;
    padding: 1rem;
    cursor: pointer;
    border: none;
    background-color: #e0e0e0;
    font-size: 1.1rem;
    transition: background-color 0.3s;
}

.main-tab-button:hover {
    background-color: #d0d0d0;
}

.main-tab-button.active {
    background-color: #fff;
    border-top: 2px solid #0056b3;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    color: #0056b3;
}

.main-tab-content {
    flex: 1;
    padding: 1rem;
    background-color: #fff;
    display: flex;
    /* Make it a flex container */
    flex-direction: column;
    /* Stack children vertically */
    min-height: 0;
    /* Important for nested flex containers */
}


/* --- Content within tabs --- */
.sidebar {
    padding: 1rem;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.main-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

/* Simulation Controls */
.archive-controls {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.archive-controls button {
    font-size: 0.8em;
    padding: 5px 10px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#saved-simulations-list {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
}

#saved-simulations-list li {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#saved-simulations-list li:hover {
    background-color: #f5f5f5;
}

#saved-simulations-list li button {
    font-size: 0.85em;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
}

.modal-buttons button {
    background-color: #666;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#simulation-controls,
#operational-simulation-controls {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    background-color: #f9f9f9;
    margin-bottom: 20px;
}

#simulation-controls button {
    background-color: #007bff;
}

#simulation-controls button:hover {
    background-color: #0056b3;
}

/* Simulation Timeline */
#simulation-timeline {
    margin-top: 1rem;
}

#timeline {
    width: 100%;
}

/* General Component Styles */
h2,
h3,
h4 {
    color: #0056b3;
}

button {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 10px;
}

button:hover {
    background-color: #0056b3;
}

/* Standard Add and Delete Buttons */
.btn-add {
    background-color: #28a745 !important;
    color: white !important;
}

.btn-add:hover {
    background-color: #218838 !important;
}

.btn-delete {
    background-color: #dc3545 !important;
    color: white !important;
}

.btn-delete:hover {
    background-color: #c82333 !important;
}

button.save-btn:disabled,
button.cancel-btn:disabled {
    background-color: #c0c0c0;
    cursor: not-allowed;
}

/* Sidebar and Tab Styles */
.sidebar {
    display: flex;
    flex-direction: column;
    width: 250px;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    height: 100%;
}

.sidebar .tab {
    display: flex;
    flex-direction: column;
    /* Vertical sidebar buttons */
    overflow: visible;
    border: none;
    background-color: transparent;
}

.sidebar .tab button,
.sidebar .tablinks {
    width: 100%;
    text-align: left;
}

/* Default horizontal tabs for main content areas */
.tab {
    display: flex;
    flex-direction: row;
    /* Horizontal sub-tabs */
    overflow: hidden;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
}

.tab button,
.tablinks {
    width: auto;
    text-align: left;
    background-color: #f1f1f1;
    color: #333;
    padding: 0 16px;
    border: 1px solid #ccc;
    border-bottom: none;
    margin-bottom: 0;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    box-sizing: border-box;
    height: 45px;
    display: flex;
    align-items: center;
}

.tab button:last-child {
    border-bottom: 1px solid #ccc;
}

.tab button:hover,
.tablinks:hover {
    background-color: #e2e6ea;
}

.tab button.active,
.tablinks.active {
    background-color: #ccc;
    font-weight: bold;
    border-bottom: 3px solid #007bff;
}

/* Specific separator for tactical results */
#btn-tactical-results-start {
    border-left: 2px solid #999 !important;
    margin-left: 10px !important;
}

/* Nested Tab Styles (3rd level horizontal) */
.nested-tabs {
    display: flex;
    flex-direction: row;
    background-color: #e9ecef;
    border-bottom: 1px solid #ccc;
    margin-bottom: 15px;
    overflow: hidden;
}

.nested-tablinks {
    background-color: #f1f1f1;
    color: #333;
    padding: 0 20px;
    border: 1px solid #ccc;
    border-bottom: none;
    margin-right: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    height: 45px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.nested-tablinks:hover {
    background-color: #ddd;
}

.nested-tablinks.active {
    background-color: #ccc;
    font-weight: bold;
    border-top: 3px solid #007bff;
}

/* Split View Tab Layout (Vertical Tabs) */
.split-view-tab {
    display: none;
    flex-direction: row;
    height: 100%;
    overflow: hidden !important;
}

/* Force flex display when visible */
.split-view-tab[style*="block"] {
    display: flex !important;
}

.split-view-tab .nested-tabs {
    flex-direction: column;
    width: 200px;
    min-width: 200px;
    border-bottom: none;
    border-right: 1px solid #ccc;
    margin-bottom: 0;
    height: 100%;
    background-color: #f8f9fa;
    padding-top: 10px;
    padding-left: 0;
    padding-right: 0;
}

.split-view-tab .nested-tablinks {
    width: 100%;
    text-align: left;
    border: none;
    border-left: 4px solid transparent;
    /* Marker for active state */
    border-bottom: 1px solid #eee;
    margin-right: 0;
    padding: 15px 20px;
    height: auto;
    /* Let text wrap if needed */
}

.split-view-tab .nested-tablinks:hover {
    background-color: #e9ecef;
}

.split-view-tab .nested-tablinks.active {
    background-color: #fff;
    border-top: none;
    border-left: 4px solid #007bff;
    color: #007bff;
}

.split-view-tab .nested-tabcontent {
    flex: 1;
    /* Take remaining space */
    min-width: 0;
    /* Allow shrinking below content size */
    padding: 20px;
    overflow: auto;
    /* Enable both vertical and horizontal scrolling */
    height: 100%;
    box-sizing: border-box;
}

/* Loader Styles */
.loader-container,
.loader-overlay {
    display: none;
    justify-content: center;
    align-items: center;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
}

.tablinks.inconsistent {
    color: red !important;
    font-weight: bold;
}

/* Style the tab content */
.tabcontent {
    display: none;
    flex: 1;
    /* Fill available space when visible */
    box-sizing: border-box;
    /* Include padding and border in the element's total width and height */
    overflow-y: auto;
    /* Allow scrolling if content overflows */
    min-height: 0;
    /* Required for flex children to scroll */
}

/* Chart Container Styles */
.chart-container {
    position: relative;
    width: 100%;
    /* Use more available height but leave room for tab buttons and headers */
    height: 82vh; 
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* iframe styles */
.chart-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Input fields within table cells */
td input[type="text"],
td input[type="number"],
td select {
    width: 100%;
    padding: 4px;
    box-sizing: border-box;
    margin: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

input[type="number"] {
    width: 80px;
}

input[type="datetime-local"] {
    width: 200px;
}

.unavailability-input,
.mtbf-input,
.mttr-input,
.repair-stdev-input,
.maintenance-interval-input,
.maintenance-duration-input,
.loading-limit-input {
    width: 70px !important;
}

table {
    width: fit-content;
    /* Let tables fit content */
    border-collapse: collapse;
    margin-bottom: 20px;
}

table,
th,
td {
    border: 1px solid #ddd;
}

th,
td {
    padding: 6px 10px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

/* Form Styles */
input[type="text"],
input[type="number"],
select {
    padding: 5px;
    box-sizing: border-box;
    margin-bottom: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="text"] {
    width: 250px;
}

.process-flow-container {
    height: 100vh;
    /* Make the parent fill 100% of the viewport height */
    box-sizing: border-box;
}

/* Info Button & Help Modal */
.info-button {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    cursor: pointer;
    margin-left: 10px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-button:hover {
    background: #0056b3;
}

.help-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.help-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 50%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.help-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.help-close:hover {
    color: black;
}

.help-body h2 {
    margin-top: 0;
    color: #333;
}

.help-body p {
    line-height: 1.6;
    color: #555;
}

.help-body ul {
    padding-left: 20px;
}

.help-body li {
    margin-bottom: 10px;
}

/* Add split.js gutter styles */
.gutter {
    background-color: #eee;
    background-repeat: no-repeat;
    background-position: 50%;
}


.gutter.gutter-horizontal {
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bM/5+BgYHv379/Mp7/M56G/w8PIwA+1g0VbM8beAAAAABJRU5ErkJggg==');
    cursor: col-resize;
}

#process-flow-sidebar {
    min-width: 200px;
    width: 30%;
    height: 100%;
    float: left;
    border: 1px solid #ccc;
    padding: 1rem;
    overflow-y: auto;
    box-sizing: border-box;
}

#process-flow-sidebar h4 {
    margin-top: 0;
}

#process-flow-sidebar .param-group {
    margin-bottom: 0.5rem;
}

#process-flow-sidebar .param-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

#process-flow-sidebar .param-group textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: monospace;
    font-size: 0.9em;
}

#process-flow-sidebar .readonly-materials {
    background-color: #f4f4f4;
    padding: 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
    border: 1px solid #ddd;
}

#process-flow-sidebar .material-edit-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

#process-flow-sidebar .material-edit-row .material-name {
    flex-grow: 1;
}

#process-flow-sidebar .material-edit-row .material-quantity {
    width: 60px;
}

#process-flow-sidebar .material-display-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

#process-flow-sidebar .material-display-row span {
    flex-grow: 1;
    padding: 5px;
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#process-flow-sidebar .material-display-row input {
    width: 60px;
}

#operationsDataContainer {
    width: 70%;
    height: 100%;
    float: left;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

.editable-list {
    list-style-type: none;
    padding: 0;
}

.editable-list li {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.editable-list li input {
    flex-grow: 1;
    margin-right: 1rem;
}

/* Operator Schedule Table */
.schedule-wrapper {
    margin-bottom: 2rem;
}

.schedule-table {
    width: fit-content;
}

.shifts-container .shift-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.shifts-container input {
    width: 80px;
}

.shifts-container button {
    margin-left: 10px;
    padding: 2px 6px;
    /* Smaller button */
    font-size: 12px;
    margin-bottom: 0;
}

/* Operator Skill Matrix Table */
.skill-matrix-table {
    margin-top: 20px;
}

.skill-matrix-table th,
.skill-matrix-table td {
    min-width: 100px;
    text-align: center;
}

.skill-matrix-table select {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Results Image Styles */
#Results img {
    max-width: 100%;
    height: auto;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* New VisualSim Layout - Vertical Stacking */
.visual-sim-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.log-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 400px;
    border-top: 1px solid #ccc;
    padding-top: 1rem;
}

/* Make log area stretch */
.log-section .log-output-area {
    flex-grow: 1;
    min-height: 300px;
}

/* Log viewer styles */
#tactical-log-messages,
#operational-log-messages,
.log-output-area {
    background-color: #2b2b2b;
    color: #f8f8f2;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    /* Slightly smaller for table */
    padding: 0;
    /* Remove padding for table */
    border: 1px solid #444;
    border-radius: 5px;
    white-space: normal;
    /* Table handles wrapping */
    word-wrap: break-word;
    overflow-y: auto;
}

#tactical-log-messages,
#operational-log-messages {
    flex-grow: 1;
    min-height: 0;
}

.log-table {
    border-collapse: collapse;
    table-layout: fixed;
}

.log-table th {
    background-color: #383838;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px;
    text-align: left;
    font-size: 0.9em;
    border-bottom: 2px solid #555;
}

.log-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #444;
    vertical-align: top;
    word-break: break-word;
}

.log-col-abs-time {
    width: 110px;
    color: #888;
}

.log-col-type {
    width: 90px;
}

.log-col-sim-time {
    width: 140px;
    color: #a9b7c6;
}

.log-col-msg {
    width: auto;
}

.log-row-info {
    color: #bbb;
}

.log-row-simulation {
    color: #a9b7c6;
}

.log-row-warning {
    color: #e6db74;
}

.log-row-error {
    color: #f92672;
    font-weight: bold;
}

.gantt-chart {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 10px;
}

/* --- Pie Chart Utilization Styles --- */
.utilization-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
}

.pie-charts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 10px;
    flex-grow: 1;
}

.individual-pie-chart {
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.overall-pie-chart {
    border: 3px solid #0056b3;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.chart-legend {
    min-width: 180px;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 10px;
}

.chart-legend h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    /* List format for right side */
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.legend-color-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

/* Chart Loader Styles */
.chart-container,
.tabcontent {
    position: relative;
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    width: 100%;
}

.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 2s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loader-text {
    font-size: 1.2em;
    color: #333;
    font-weight: bold;
}

/* Chatbot Styles */
#chatbot-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #ccc;
    border-radius: 5px;
    overflow: hidden;
}

#chatbot-messages {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

#chatbot-input-container {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ccc;
}

#chatbot-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    margin-right: 10px;
}

#chatbot-send-button {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#chatbot-send-button:hover {
    background-color: #0056b3;
}

.user-message {
    text-align: right;
    margin-bottom: 10px;
}

.bot-message {
    text-align: left;
    margin-bottom: 10px;
}

.user-message p,
.bot-message p {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    max-width: 70%;
}

.user-message p {
    background-color: #007bff;
    color: white;
}

.bot-message p {
    background-color: #e9e9e9;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 8px 12px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #999;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: pulse 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* Sub-tab styles for Results tab */
.sub-tabs {
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.sub-tab-button {
    background-color: #f1f1f1;
    color: #333;
    border: 1px solid #ccc;
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.sub-tab-button:hover {
    background-color: #ddd;
}

.sub-tab-button.active {
    background-color: #0056b3;
    color: white;
    border-color: #0056b3;
}

.sub-tab-content {
    display: none;
    /* Hidden by default */
}



.chart-period {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
    margin-bottom: 10px;
    margin-top: -5px;
    /* Pull it closer to the header above */
}

/* --- Agenda Calendar Styles --- */
.calendar-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
    background: #fff;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.calendar-table {
    border-collapse: collapse;
    font-size: 12px;
}

.calendar-table th,
.calendar-table td {
    border: 1px solid #ccc;
    text-align: center;
    padding: 4px;
    min-width: 25px;
}

.calendar-table.weekly-grid th.day-week-header {
    font-size: 10px;
    background-color: #e9ecef;
    color: #495057;
    width: 30px;
}

.calendar-table.weekly-grid th.day-week-header:nth-child(7n),
.calendar-table.weekly-grid th.day-week-header:nth-child(7n+1) {
    background-color: #dee2e6;
    /* Darker for weekends */
}

.month-label-cell {
    font-weight: bold;
    background-color: #f8f9fa;
    text-align: left !important;
    padding-left: 10px !important;
    min-width: 120px;
}

.calendar-day-cell {
    cursor: pointer;
    transition: transform 0.1s;
    user-select: none;
}

.calendar-day-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    z-index: 1;
    position: relative;
}

.calendar-day-cell.not-a-day {
    background-color: #f9f9f9;
    cursor: default;
}

.simulation-start-highlight {
    outline: 3px solid #007bff;
    outline-offset: -3px;
    font-weight: bold;
    z-index: 2;
    position: relative;
}

.past-day {
    background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.05) 50%, rgba(0, 0, 0, 0.05) 75%, transparent 75%, transparent);
    background-size: 8px 8px;
}

/* Agenda States */
.state-default {
    background-color: #ffffff;
}

/* Standard Shift */
.state-early,
.default-early {
    background-color: #bbdefb;
    color: #0d47a1;
}

/* Light Blue */
.state-late,
.default-late {
    background-color: #c8e6c9;
    color: #1b5e20;
}

/* Light Green */
.state-holiday {
    background-color: #ffccbc;
    color: #bf360c;
}

/* Light Orange/Red */
.state-bank_holiday {
    background-color: #d32f2f;
    color: #ffffff;
}

/* Dark Red */
.state-illness {
    background-color: #d1c4e9;
    color: #4527a0;
}

/* Light Purple */
.state-off {
    background-color: #eeeeee;
    color: #9e9e9e;
}

/* Weekend / Non-working */

.agenda-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.interactive-legend-item {
    cursor: pointer;
    transition: all 0.2s;
}

.interactive-legend-item:hover {
    background-color: #eee;
    border-color: #ccc;
}

.interactive-legend-item.active {
    background-color: #fff;
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
    font-weight: bold;
}

.legend-color-box {
    width: 18px;
    height: 18px;
    border: 1px solid #999;
    border-radius: 2px;
}

.highlight-red {
    background-color: #ffcccc;
    /* light red */
}

/* Setup Matrix Styles */
.setup-matrix-table {
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9em;
}

.setup-matrix-table th,
.setup-matrix-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.setup-matrix-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    min-width: 80px;
}

.setup-matrix-table td input {
    width: 60px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-weight: bold;
}

.setup-matrix-table td input:focus {
    border-color: #4CAF50;
    outline: none;
}


/* Routing Editor Styles */
.routing-product-selector {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

#routing-editor-container {
    display: flex;
    height: 650px;
    gap: 10px;
}

#routing-sidebar {
    width: 300px;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background: #fff;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.library-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px;
}

.library-item {
    padding: 8px 12px;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: grab;
    font-size: 0.85em;
    user-select: none;
}

.library-item:hover {
    background: #dee2e6;
}

#routing-node-config {
    margin-top: 10px;
    padding: 10px;
    background: #f1f3f5;
    border-radius: 5px;
    flex-grow: 1;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.85em;
}

#routingJsonEditor {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    resize: none;
}

/* Variant Matrix Styles */
.variant-matrix-wrapper {
    overflow-x: auto;
    margin-top: 10px;
    border: 1px solid #ddd;
}

.variant-matrix-table {
    border-collapse: collapse;
    font-size: 0.9em;
}

.variant-matrix-table th,
.variant-matrix-table td {
    padding: 8px;
    border: 1px solid #eee;
    text-align: center;
}

.variant-matrix-table th {
    background: #f4f4f4;
    font-weight: 600;
    white-space: nowrap;
}

.th-sublabel {
    font-size: 0.8em;
    font-weight: normal;
    color: #666;
}

.matrix-input {
    width: 60px;
    padding: 4px;
    border: 1px solid transparent;
    text-align: center;
    border-radius: 3px;
}

.matrix-input:focus {
    border-color: #2196F3;
    outline: none;
    background: #fff;
}

/* Default / Inherited State */
.matrix-input.inherited {
    color: #888;
    font-style: italic;
    background: transparent;
}

/* Overridden State */
.matrix-input.override {
    color: #000;
    font-weight: bold;
    background: #e3f2fd;
    /* Light Blue */
    border: 1px solid #90caf9;
}

.matrix-controls {
    margin-top: 10px;
    text-align: right;
}

.delete-btn {
    color: #aaa;
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
}

.delete-btn:hover {
    color: #f44336;
}

.error-message {
    color: #d32f2f;
    margin-top: 10px;
    font-size: 0.9em;
    min-height: 1.2em;
    /* Prevent layout jump */
}

/* Tactical Controls Styling */
.tactical-controls {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    border: 1px solid #edf2f7;
}

.tactical-controls h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #2d3748;
    border-bottom: 2px solid #edf2f7;
    padding-bottom: 10px;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-item label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
}

.control-item input,
.control-item select {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #2d3748;
    background-color: #f8fafc;
    transition: all 0.2s ease;
}

.control-item input:focus,
.control-item select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
    background-color: #fff;
}

.tactical-controls .tab-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

/* Chatbot Message Styling */
.message-content {
    font-size: 0.95rem;
    line-height: 1.5;
}

.message-content p {
    margin: 0 0 10px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul,
.message-content ol {
    margin: 5px 0 10px 20px;
    padding-left: 0;
}

.message-content li {
    margin-bottom: 5px;
}

.message-content code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.message-content pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    border-radius: 0;
}

/* Specific contrast for bot vs user messages */
.bot-message .message-content code {
    background-color: rgba(0, 0, 0, 0.05);
    color: #d63384;
}

.user-message .message-content {
    /* User messages are usually simple text, but just in case */
}

/* Sidebar Layout */
#ai-sidebar {
    background-color: #f8f9fa;
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    min-height: 0;
    flex-shrink: 0;
    position: relative; /* For toggle button */
}

body.sidebar-closed #ai-sidebar {
    display: none !important;
}

#sidebar-toggle-btn {
    width: 20px;
    height: 60px;
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    border-right: none;
    border-radius: 5px 0 0 5px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 25%; /* Initial value, sync with Split.js */
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    padding: 0;
    transition: transform 0.3s ease;
}

body.sidebar-closed #sidebar-toggle-btn {
    right: 0 !important;
    transform: translateY(-50%) rotate(180deg);
    border-right: 1px solid #dee2e6;
    border-left: none;
    border-radius: 0 5px 5px 0;
}

#sidebar-toggle-btn:hover {
    background-color: #e2e6ea;
}

#ai-sidebar h3 {
    margin-top: 5px;
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: #343a40;
    text-align: center;
    flex-shrink: 0;
}

#content-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Adjust chatbot container for sidebar */
#chatbot-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: #fff;
    overflow: hidden;
    min-height: 0;
}

#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: #f9f9f9;
}

#chatbot-input-container {
    display: flex;
    padding: 10px;
    background-color: #fff;
    border-top: 1px solid #eee;
}

#chatbot-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    margin-right: 5px;
}

/* Utility Button Styles */
.btn-danger {
    background-color: #dc3545 !important;
    color: white !important;
}

.btn-danger:hover {
    background-color: #c82333 !important;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
    margin: 2px;
}

/* Disabled Button States */
.btn-primary:disabled,
button:disabled {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #ced4da !important;
    cursor: not-allowed !important;
    opacity: 0.65;
}

/* Specific override for the save snapshot button to ensure it looks disabled */
#btn-save-snapshot:disabled {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #ced4da !important;
    cursor: not-allowed !important;
    opacity: 0.65;
}