/* <!-- style.css --> */

/* Global Styles */
body {
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top for better vertical flow */
    min-height: 100vh;
    background: linear-gradient(135deg, #e0f2f7 0%, #c4e9f7 100%);
    margin: 0;
    color: #2c3e50;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    padding: 35px 45px;
    text-align: center;
    width: 100%;
    max-width: 1600px; /* Wider for architecture layout, adjusted for battleground */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

h1 {
    color: #1a5276;
    margin-bottom: 15px;
    font-size: 2.5em;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.08);
    font-weight: 700;
}

h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.6em;
    font-weight: 600;
}
h2 {
    color: #34495e;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.6em; /* Larger heading */
    font-weight: 600;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 25px;
    border-bottom: 2px solid #e1f5fe;
    padding-bottom: 5px;
    gap: 10px;
    flex-wrap: wrap; /* Allow tabs to wrap on smaller screens */
}

.tab-button {
    background-color: #e0f2f7;
    color: #1a5276;
    border: none;
    padding: 12px 25px;
    border-radius: 10px 10px 0 0;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05); /* Shadow for active tab */
    position: relative;
    top: 2px; /* Slightly lift active tab */
}

.tab-button:hover:not(.active) {
    background-color: #c4e9f7;
    transform: translateY(-2px);
}

.tab-button.active {
    background-color: #007bff;
    color: white;
    box-shadow: 0 -6px 15px rgba(0, 123, 255, 0.2);
    border-bottom: 2px solid #007bff; /* Underline effect for active tab */
}

/* Page Content Management */
.page-content {
    width: 100%;
    display: none; /* Hidden by default */
    text-align: left; /* Adjust text alignment for content */
    animation: fadeInPage 0.5s ease-out;
}

.page-content.active {
    display: flex; /* Show active page */
    flex-direction: column;
    align-items: center;
}

@keyframes fadeInPage {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Controls Panel & Toggle */
.controls-panel {
    background-color: #f8fcff;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); /* Soft shadow for panel itself */
    width: 100%;
    padding: 0; /* Reset padding here, apply to inner wrapper */
    margin-bottom: 25px; /* Space before metrics */
    position: relative; /* For toggle button positioning */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.controls-content-wrapper { /* This wrapper holds the controls-group */
    transition: max-height 0.5s ease-out, padding 0.5s ease-out;
    overflow: hidden;
    max-height: 800px; /* Sufficiently large for expanded state, increased for new controls */
    padding: 20px; /* Apply padding here */
    width: 100%; /* Ensure it takes full width */
    display: flex; /* To stack accordion items */
    flex-direction: column;
    gap: 15px; /* Gap between accordion items */
}

.controls-panel.collapsed .controls-content-wrapper {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.controls-toggle-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 0 0 10px 10px; /* Rounded at bottom only */
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    margin-top: 15px; /* Space from controls group or collapsed boundary */
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.2);
    z-index: 10; /* Ensure it's clickable and visible */
    width: auto;
    white-space: nowrap;
    align-self: center; /* Center horizontally in flex column */
    margin-bottom: 15px; /* Space below the button */
}
.controls-toggle-button:hover {
    background-color: #0056b3;
    transform: translateY(2px); /* Slight lift on hover */
}

/* Accordion Styles */
.accordion-item {
    background-color: #ffffff;
    border: 1px solid #e1f5fe;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden; /* Important for content collapse */
}

.accordion-header {
    width: 100%;
    background-color: #e0f2f7;
    color: #1a5276;
    border: none;
    padding: 15px 20px;
    text-align: left;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}
.accordion-header:hover {
    background-color: #c4e9f7;
}
.accordion-header h3 {
    margin: 0;
    color: inherit; /* Inherit color from button */
    font-size: 1.2em; /* Ensure heading size is good */
}

.accordion-icon {
    transition: transform 0.3s ease;
}
.accordion-header[aria-expanded="true"] .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, padding 0.5s ease-out;
    padding: 0 20px; /* Initial padding when collapsed */
}

.accordion-content.active {
    max-height: 600px; /* Adjust as needed to fit content */
    padding: 20px; /* Padding when expanded */
}


/* Controls Group */
.controls-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 25px;
    width: 100%;
}

.control-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e1f5fe;
    border-radius: 10px;
    background-color: #ffffff;
}

.control-label {
    font-weight: 600;
    color: #34495e;
    font-size: 1.05em;
    text-align: center;
    margin-bottom: 5px;
}

.control-input {
    padding: 10px 15px;
    border: 2px solid #a3d9ff;
    border-radius: 12px;
    font-size: 1em;
    width: 100px;
    text-align: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.control-input.small-input {
    width: 85px;
}
.control-input.smaller-input {
    width: 70px; /* Even smaller for resource inputs */
    padding: 8px 10px;
}
.control-input-range {
    width: 150px;
    margin-top: 5px;
    accent-color: #007bff;
    background: linear-gradient(to right, #007bff 0%, #e0e0e0 0%);
    -webkit-appearance: none;
    height: 5px;
    border-radius: 5px;
}

.control-input-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}
.control-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2);
}

.request-exec-time-controls .exec-time-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}
.request-exec-time-controls .exec-time-inputs span {
    font-weight: bold;
    color: #777;
    font-size: 1.1em;
}

.auto-request-controls {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
}
.auto-request-controls span {
    font-weight: bold;
    color: #007bff;
    min-width: 30px;
    text-align: center;
}
/* New: For Battleground auto controls */
.auto-request-controls-battleground {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e1f5fe;
    border-radius: 10px;
    background-color: #ffffff;
    margin-bottom: 20px;
}
.auto-request-controls-battleground .control-input-range {
    width: 200px;
}
.auto-request-controls-battleground .control-button {
    padding: 8px 15px;
    font-size: 0.85em;
}


.resource-controls .resource-inputs {
    display: flex;
    flex-wrap: wrap; /* Allow inputs to wrap */
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #555;
}

.function-type-controls {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    grid-column: span 2; /* Span two columns for better layout */
    max-width: 450px; /* Constrain width */
    margin: 0 auto; /* Center it */
}
.function-type-controls select {
    width: 80%; /* Wider select box */
    max-width: 200px;
    margin-bottom: 5px;
}
.function-type-controls .add-function-type-inputs {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping */
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.function-type-controls .add-function-type-inputs input {
    flex-grow: 1; /* Allow inputs to grow */
    min-width: 60px; /* Minimum width */
}
.function-type-controls .add-function-type-inputs button {
    padding: 8px 15px;
    font-size: 0.8em;
}

.placement-algorithm-controls {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    grid-column: span 2; /* Span two columns for better layout */
    max-width: 450px; /* Constrain width */
    margin: 0 auto; /* Center it */
}
.placement-algorithm-controls select {
    width: 80%; /* Wider select box */
    max-width: 250px;
    margin-bottom: 10px;
}
.placement-algorithm-description {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    margin-top: 10px;
    font-size: 0.9em;
    color: #6c757d;
    text-align: center;
    width: 100%;
    max-width: 300px;
}
.placement-algorithm-description p {
    margin: 0;
    line-height: 1.4;
}
body.dark-mode .placement-algorithm-description {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
}

/* Placement Analysis Page Styles */
.current-placement-info {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.placement-algorithm-badge {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
    text-align: center;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.placement-algorithm-badge .algorithm-name {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 5px;
}

.placement-algorithm-badge .algorithm-description {
    font-size: 0.95em;
    opacity: 0.9;
    line-height: 1.4;
}

.placement-comparison-table {
    width: 100%;
    margin: 20px 0;
    overflow-x: auto;
}

.placement-comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.placement-comparison-table th,
.placement-comparison-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e1f5fe;
}

.placement-comparison-table th {
    background-color: #f8fcff;
    color: #1a5276;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.placement-comparison-table tr:hover {
    background-color: #f5fafd;
}

.placement-comparison-table .algorithm-name {
    font-weight: 600;
    color: #007bff;
}

.placement-comparison-table .efficiency-score {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    color: white;
}

.placement-comparison-table .efficiency-high {
    background-color: #28a745;
}

.placement-comparison-table .efficiency-medium {
    background-color: #ffc107;
    color: #212529;
}

.placement-comparison-table .efficiency-low {
    background-color: #dc3545;
}

.placement-comparison-table .utilization-bar {
    width: 100px;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.placement-comparison-table .utilization-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.placement-comparison-table .utilization-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7em;
    font-weight: 600;
    color: #495057;
}

/* Dark mode styles for placement analysis */
body.dark-mode .placement-algorithm-badge {
    background: linear-gradient(135deg, #4a90e2, #357abd);
}

body.dark-mode .placement-comparison-table table {
    background-color: #2d3748;
}

body.dark-mode .placement-comparison-table th {
    background-color: #1a202c;
    color: #ffd700;
}

body.dark-mode .placement-comparison-table td {
    border-bottom-color: #4a5568;
}

body.dark-mode .placement-comparison-table tr:hover {
    background-color: #4a5568;
}

body.dark-mode .placement-comparison-table .algorithm-name {
    color: #4a90e2;
}

body.dark-mode .placement-comparison-table .utilization-bar {
    background-color: #4a5568;
}

body.dark-mode .placement-comparison-table .utilization-text {
    color: #a0aec0;
}

/* Placement Testing Guide Styles */
.placement-testing-guide {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.guide-step:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}

.step-number {
    min-width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    margin: 0 0 8px 0;
    color: #1a5276;
    font-size: 1.1em;
}

.step-content p {
    margin: 0;
    color: #6c757d;
    line-height: 1.4;
}

body.dark-mode .guide-step {
    background-color: #2d3748;
    border-left-color: #4299e1;
}

body.dark-mode .guide-step:hover {
    background-color: #4a5568;
}

body.dark-mode .step-content h4 {
    color: #90cdf4;
}

body.dark-mode .step-content p {
    color: #a0aec0;
}

/* Battleground Placement Algorithm Selection */
.placement-algorithm-selection-small {
    margin: 10px 0;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.placement-algorithm-selection-small .control-label-small {
    font-size: 0.8em;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    display: block;
}

.placement-algorithm-selection-small .control-input-small {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.8em;
    background-color: white;
}

body.dark-mode .placement-algorithm-selection-small {
    background-color: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .placement-algorithm-selection-small .control-label-small {
    color: #a0aec0;
}

body.dark-mode .placement-algorithm-selection-small .control-input-small {
    background-color: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}


/* Buttons */
.control-button {
    background: linear-gradient(145deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}
.control-button:hover:not(:disabled) {
    background: linear-gradient(145deg, #0056b3, #007bff);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.35);
}
.control-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}
.control-button:disabled {
    background-color: #e0e0e0;
    color: #a0a0a0;
    cursor: not-allowed;
    box-shadow: none;
}
.full-width-button {
    /* grid-column: 1 / -1; This was for the controls-group grid */
    width: auto;
    margin-top: 10px;
    align-self: center; /* For centering within flex controls-content-wrapper */
}
.auto-control-button {
    padding: 10px 20px;
    font-size: 0.9em;
}

.request-button {
    background: linear-gradient(145deg, #28a745, #218838);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 15px;
    font-size: 1.4em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.35);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
    margin-top: 30px; /* Space from diagram */
}
.request-button:hover {
    background: linear-gradient(145deg, #218838, #28a745);
    transform: translateY(-5px) scale(1.04);
    box-shadow: 0 12px 30px rgba(40, 167, 69, 0.45);
}
.request-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
}
#battlegroundRequestButton {
    padding: 15px 30px; /* Slightly smaller than main button */
    font-size: 1.2em;
    margin-bottom: 20px;
}

/* Metrics & Legend */
.metrics {
    background-color: #f0f8ff;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-around;
    font-size: 1.2em;
    color: #34495e;
    width: 100%;
    max-width: 800px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
    font-weight: 500;
    flex-wrap: wrap;
    gap: 15px;
}
.metrics p {
    flex: 1;
    min-width: 150px;
}
.metrics p span {
    font-weight: bold;
    color: #007bff;
    font-size: 1.1em;
}
.metrics.small-metrics {
    font-size: 0.9em;
    padding: 10px 15px;
    margin-top: 15px;
    margin-bottom: 15px;
    min-width: unset; /* Override min-width for smaller context */
}
.metrics.small-metrics p {
    min-width: unset;
    flex: 1;
    text-align: center;
}

.legend {
    flex-basis: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.95em;
    color: #555;
    border-top: 1px solid #e1f5fe;
    padding-top: 15px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}
.legend-color.cold-starting { background-color: #f39c12; }
.legend-color.busy { background-color: #3498db; }
.legend-color.active { background-color: #2ecc71; }


/* Architecture Diagram Layout */
.serverless-architecture-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px; /* Space between components */
    width: 100%;
    padding: 20px;
    background-color: #fbfdff; /* Very light blue background for diagram area */
    border-radius: 18px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.05);
    min-height: 600px; /* Ensure enough height for the flow */
    position: relative; /* For absolutely positioned elements like notification */
}
/* Smaller version for Battleground tab */
.serverless-architecture-diagram.small-diagram {
    padding: 10px;
    min-height: 400px; /* Smaller min-height for battleground */
    gap: 10px;
    flex-grow: 1;
}

/* Common Component Styling */
.component {
    background-color: #ffffff;
    border: 2px solid #a3d9ff;
    border-radius: 12px;
    padding: 15px 25px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.1);
    text-align: center;
    width: 250px; /* Fixed width for gateway/dispatcher */
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}
.component h3 {
    margin: 0;
    color: #007bff;
}
.component.small-component {
    width: 150px; /* Smaller components for battleground */
    min-height: 60px;
    padding: 10px 15px;
}
.small-component h4 {
    font-size: 1em;
    margin: 0;
    color: #007bff;
}


/* Gateway specific */
.gateway {
        border-color: #28a745;
        box-shadow: 0 4px 15px rgba(40, 167, 69, 0.1);
}

/* Dispatcher specific */
.dispatcher {
        border-color: #ffc107;
        box-shadow: 0 4px 15px rgba(255, 193, 7, 0.1);
}
.request-queue-area {
    width: 100%;
    max-height: 100px;
    overflow-y: auto;
    background-color: #fffaf0;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    border: 1px dashed #ffcc80;
}
.request-queue-area.small-queue-area {
    max-height: 60px;
    padding: 5px;
}
.request-queue-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.queued-request-flow {
    background-color: #ffebcd;
    border: 1px solid #ffcc80;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.8em;
    color: #d17b00;
    text-align: center;
    animation: fadeInQueue 0.3s ease-out;
}
.placeholder-text-small {
    color: #95a5a6;
    font-style: italic;
    font-size: 0.9em;
    margin: 5px auto;
}
@keyframes fadeInQueue {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOutQueue {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-20px); }
}

/* Arrows / Flow Paths */
.arrow-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
    height: 50px;
    width: 100%;
}
.arrow-path.small-arrow {
    height: 30px;
}
.arrow-path .arrow-line {
    width: 2px;
    height: 100%;
    background-color: #66bb6a;
    transition: background-color 0.1s ease-in-out;
}
.arrow-path .arrow-head {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #66bb6a;
    margin-top: -12px;
    transition: border-top-color 0.1s ease-in-out;
}
.arrow-path.small-arrow .arrow-head {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 9px solid #66bb6a;
    margin-top: -9px;
}
.arrow-path.highlighted .arrow-line {
    background-color: #ff5722;
}
.arrow-path.highlighted .arrow-head {
    border-top-color: #ff5722;
}
.arrow-path .label {
    font-size: 0.9em;
    color: #555;
    font-weight: 500;
    position: absolute;
    bottom: -20px;
    white-space: nowrap;
}
.arrow-path.small-arrow .label {
    display: none;
}


/* Compute Nodes Area */
.compute-nodes-area {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    border: 3px dashed #bbdefb;
    border-radius: 15px;
    background-color: #f5fafd;
    min-height: 250px;
    position: relative;
}
.compute-nodes-area.small-nodes-area {
    padding: 10px;
    min-height: 180px;
    gap: 15px;
}
.placeholder-text-large {
    color: #95a5a6;
    font-style: italic;
    font-size: 1.5em;
    margin: auto;
}

/* Individual Compute Node */
.compute-node {
    background-color: #e3f2fd;
    border: 2px solid #90caf9;
    border-radius: 10px;
    padding: 15px;
    min-width: 200px;
    max-width: 250px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    animation: fadeIn 0.5s ease-out;
}
.compute-node.small-node {
    padding: 10px;
    min-width: 120px;
    max-width: 180px;
    gap: 5px;
}
.compute-node h4 {
    margin: 0;
    color: #2196f3;
    font-size: 1.2em;
    font-weight: 600;
}
.compute-node.small-node h4 {
    font-size: 1em;
}
.compute-node .node-stats {
    font-size: 0.85em;
    color: #555;
    text-align: center;
    width: 100%;
}
.compute-node.small-node .node-stats {
    font-size: 0.75em;
}
.node-functions-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    padding: 10px;
    border: 1px dashed #c0d9ec;
    border-radius: 8px;
    width: 100%;
    min-height: 80px;
}
.node-functions-container.small-functions-container {
    min-height: 50px;
    padding: 5px;
    gap: 10px;
}
.node-functions-container .placeholder-text-small {
    margin: auto;
}
.small-nodes-area .placeholder-text-small {
    font-size: 0.8em;
}


/* New: Resource Progress Bars */
.resource-bars {
    width: 90%;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.8em;
}
.resource-bars.small-resource-bars {
    width: 100%;
    margin-top: 2px;
    gap: 5px;
    font-size: 0.7em;
}
.resource-bar-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
.resource-bar-label {
    font-weight: 500;
    color: #444;
    width: 100%;
    text-align: left;
}
.resource-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.resource-bar.small-resource-bar {
    height: 5px;
}
.resource-bar-fill {
    height: 100%;
    width: 0%;
    background-color: #2ecc71;
    border-radius: 4px;
    transition: width 0.3s ease-out, background-color 0.3s ease-out;
}
/* Resource Usage Color Tiers */
.resource-bar-fill.moderate { background-color: #f39c12; }
.resource-bar-fill.high { background-color: #e74c3c; }


/* Function Instance on a Node */
.function-instance {
    width: 80px;
    height: 80px;
    background-color: #2ecc71;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 0.8em;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
    position: relative;
    overflow: hidden;
    border: 3px solid #27ae60;
    flex-shrink: 0;
    animation: fadeInScale 0.6s ease-out;
    cursor: default;
    user-select: none;
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
.function-instance.small-function {
    width: 50px;
    height: 50px;
    font-size: 0.6em;
    border-width: 2px;
}
.function-instance.small-function .current-requests-count {
    font-size: 0.6em;
    padding: 2px 5px;
}
.function-instance.small-function .func-resources {
    display: none;
}
    .function-instance.small-function .func-type-name {
    font-size: 0.7em;
}


.function-instance.cold-starting {
    background-color: #f39c12;
    border: 3px solid #e67e22;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
    animation: fadeInColdStart 1s ease-out;
}
.function-instance.busy {
    background-color: #3498db;
    border-color: #2980b9;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    animation: pulseEffect 1.2s infinite alternate;
}

.function-instance .current-requests-count {
    font-size: 0.75em;
    background-color: rgba(0, 0, 0, 0.25);
    padding: 3px 8px;
    border-radius: 8px;
    margin-top: 5px;
    opacity: 0.95;
}
.function-instance .func-resources {
    font-size: 0.65em;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    line-height: 1.2;
}
.function-instance .func-type-name {
    font-size: 0.85em;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.1;
}

/* Keyframe Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.1); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes fadeInColdStart {
    0% { opacity: 0; transform: scale(0.4) translateY(30px); }
    50% { opacity: 0.8; transform: scale(1.05) translateY(-8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes pulseEffect {
    0% { transform: scale(1); box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3); }
    100% { transform: scale(1.03); box-shadow: 0 6px 15px rgba(52, 152, 219, 0.5); }
}
@keyframes fadeOutShrink {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0); }
}

/* Requirements/About List Styling */
.requirements-title {
    color: #1a5276;
    margin-bottom: 25px;
    font-size: 2em;
    text-align: center;
}

.requirements-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
}

.requirement-item {
    background-color: #f8fcff;
    border: 1px solid #e1f5fe;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    text-align: left;
}

.requirement-item h3 {
    color: #007bff;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.requirement-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.requirement-item ul li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
    color: #555;
    line-height: 1.5;
    font-weight: normal;
}

.requirement-item ul li:last-child {
    margin-bottom: 0;
}

.requirement-item ul li::before {
    content: '•';
    color: #28a745;
    font-size: 1.2em;
    position: absolute;
    left: 0;
    top: 0;
    line-height: 1.5;
}

/* Keep only the label part bold in binding-logic-page and about-page */
#binding-logic-page .requirement-item ul li strong,
#about-page .requirement-item ul li strong {
    font-weight: bold;
}

/* Style for the description text */
#binding-logic-page .requirement-item ul li .description,
#about-page .requirement-item ul li .description {
    font-weight: normal;
}

/* Style for code elements */
#binding-logic-page .requirement-item ul li code,
#about-page .requirement-item ul li code {
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
    color: #d63384;
}

/* Style for emphasized elements */
#binding-logic-page .requirement-item ul li em,
#about-page .requirement-item ul li em {
    font-style: italic;
    font-weight: 500;
    color: #0d6efd;
}

/* Routing Options Specific Styling */
.routing-options-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 600px;
    padding: 20px;
    background-color: #f0f8ff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.routing-options-container.small {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

.routing-option {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    background-color: #ffffff;
    border: 1px solid #a3d9ff;
    border-radius: 10px;
    padding: 15px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.routing-option.small {
    padding: 8px 12px;
    border-radius: 8px;
}
.routing-option.small input[type="radio"] {
    transform: scale(1.1);
    margin-right: 8px;
}
.routing-option.small label {
    flex-direction: row;
    align-items: center;
    gap: 5px;
}
.logic-name-small {
    font-size: 0.9em;
    font-weight: 600;
    color: #007bff;
}


.routing-option:hover {
    background-color: #f5fafd;
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.1);
}

.routing-option input[type="radio"] {
    margin-right: 15px;
    margin-top: 5px;
    accent-color: #007bff;
    transform: scale(1.3);
}

.routing-option label {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.routing-option .logic-name {
    font-weight: 700;
    color: #007bff;
    font-size: 1.2em;
    margin-bottom: 5px;
}

.routing-option .logic-brief {
    font-size: 0.9em;
    color: #555;
}

/* Enhanced Notification Styling */
.notification {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4CAF50;
    color: white;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out, transform 0.3s ease-out;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
    white-space: nowrap;
    max-width: 90%;
    word-wrap: break-word;
}

.notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Type-specific notification styles */
.notification.success {
    background-color: #28a745;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.notification.error {
    background-color: #dc3545;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.notification.warning {
    background-color: #ffc107;
    color: #212529;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.notification.info {
    background-color: #17a2b8;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

/* Dark mode notification styles */
body.dark-mode .notification {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .notification.warning {
    background-color: #e0a800;
    color: #000;
}

/* Graph Container Styling */
.graph-container {
    width: 100%;
    max-width: 750px;
    margin: 20px auto 0;
    background-color: #ffffff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.cold-start-graph {
    margin-top: 20px;
    margin-bottom: 20px;
    max-width: 800px;
}
.graph-container canvas {
    width: 100% !important;
    height: 400px !important;
    max-width: 100%;
    box-sizing: border-box;
}

.graph-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}
/* Adjusted height for the new session-based graph */
#latestRequestChart {
    height: 300px !important;
}
#battlegroundComparisonChart {
    height: 350px !important;
}
#resourceUtilizationChart {
    height: 350px !important;
}

.download-button {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.2);
}
.download-button:hover {
    background-color: #138496;
}

.danger-button {
    background-color: #dc3545 !important;
    color: white !important;
}
.danger-button:hover {
    background-color: #c82333 !important;
    transform: translateY(-2px);
}
.download-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 5px rgba(23, 162, 184, 0.2);
}

.data-download-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}
.data-note {
    font-size: 0.85em;
    color: #777;
    margin-top: 15px;
    text-align: center;
    font-style: italic;
}
.graph-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Battleground Specific Styles */
.battleground-intro {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 25px;
    text-align: center;
}
.battleground-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 600px;
    padding: 20px;
    background-color: #f0f8ff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.battleground-arenas {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    width: 100%;
    margin-bottom: 40px;
}
.simulation-arena {
    flex: 1 1 48%;
    min-width: 400px;
    max-width: 750px;
    border: 2px solid #007bff;
    border-radius: 15px;
    padding: 20px;
    background-color: #fcfdff;
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.simulation-arena h3 {
    color: #007bff;
    font-size: 1.5em;
    margin-bottom: 10px;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .controls-group {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 20px;
    }
    .serverless-architecture-diagram {
        padding: 15px;
    }
    .component {
        width: 90%;
        max-width: 300px;
    }
    .compute-node {
        min-width: 180px;
        max-width: 220px;
    }
    .function-instance {
        width: 70px;
        height: 70px;
        font-size: 0.7em;
    }
    .tab-button {
        padding: 10px 18px;
        font-size: 1em;
    }
    .routing-options-container {
        padding: 15px;
        gap: 15px;
    }
    .routing-option {
        padding: 12px;
    }
    /* Battleground specific */
    .simulation-arena {
        flex-basis: 100%;
    }
    .serverless-architecture-diagram.small-diagram {
            min-height: 500px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
        gap: 15px;
    }
    h1 { font-size: 2em; }
    .controls-group {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }
    .control-label { font-size: 0.95em; }
    .control-input { width: 80%; padding: 8px 12px; }
    .control-input.small-input { width: 40%; }
    .control-button { padding: 10px 18px; font-size: 0.85em; }
    .request-button { padding: 14px 28px; font-size: 1.2em; }
    .metrics {
        flex-direction: column;
        gap: 10px;
        font-size: 1em;
        padding: 12px;
    }
    .legend { flex-direction: column; gap: 10px; }
    .serverless-architecture-diagram {
        gap: 15px;
    }
    .component {
        padding: 10px 15px;
        width: 100%;
    }
    .compute-node {
        min-width: 150px;
        max-width: 100%;
    }
    .tab-navigation {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }
    .tab-button {
        width: 100%;
        border-radius: 10px;
        top: 0;
    }
    .tab-button.active {
        border-bottom: none;
    }
    .routing-options-container {
        padding: 10px;
    }
    .routing-option {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
    }
    .routing-option input[type="radio"] {
        margin-bottom: 5px;
    }
    .routing-option label {
        width: 100%;
    }
    .routing-option .logic-name {
        font-size: 1.1em;
    }
    .routing-details-list .requirement-item {
        padding: 15px;
    }
    .notification {
        font-size: 0.9em;
        padding: 10px 20px;
        width: 90%;
        left: 5%;
        transform: translateX(0);
    }
    .data-download-buttons {
        flex-direction: column;
        gap: 10px;
    }
    .download-button {
        width: 100%;
    }
    /* Battleground specific responsive adjustments */
    .simulation-arena {
        padding: 15px;
    }
    .routing-options-container.small {
        flex-direction: column;
        gap: 5px;
    }
}

/* Dark mode toggle button */
.dark-mode-toggle {
    position: absolute;
    top: 24px;
    right: 32px;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #333;
    z-index: 100;
}
body.dark-mode .dark-mode-toggle {
    color: #ffd700;
}

/* Dark mode styles */
body.dark-mode {
    background: #181a1b;
    color: #e0e0e0;
}
body.dark-mode .container {
    background: #232526;
    color: #e0e0e0;
}
body.dark-mode input,
body.dark-mode select,
body.dark-mode button,
body.dark-mode .controls-panel,
body.dark-mode .accordion-content,
body.dark-mode .component,
body.dark-mode .serverless-architecture-diagram,
body.dark-mode .metrics,
body.dark-mode .graph-container {
    background: #232526;
    color: #e0e0e0;
    border-color: #444;
}
body.dark-mode .accordion-header {
    background: #232526;
    color: #ffd700;
}
body.dark-mode .tab-navigation .tab-button.active {
    background: #333;
    color: #ffd700;
}
body.dark-mode .legend-color.cold-starting { background: #ff9800; }
body.dark-mode .legend-color.busy { background: #2196f3; }
body.dark-mode .legend-color.active { background: #4caf50; }

.metrics-scrollview {
    max-height: 70vh;
    overflow-y: auto;
    background: #fafbfc;
    padding: 1em;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
body.dark-mode .metrics-scrollview {
    background: #232526;
}
.metrics-scrollview table {
    width: 100%;
    margin-bottom: 2em;
    border-collapse: collapse;
}
.metrics-scrollview th, .metrics-scrollview td {
    border: 1px solid #ccc;
    padding: 0.5em;
    font-size: 0.95em;
}
body.dark-mode .metrics-scrollview th, 
body.dark-mode .metrics-scrollview td {
    border-color: #444;
}

.compute-node.failed {
    background-color: #ffdddd !important;
    border-color: #e74c3c !important;
    box-shadow: 0 0 10px #e74c3c55;
}
.function-instance.failed {
    background-color: #e74c3c !important;
    border-color: #c0392b !important;
    box-shadow: 0 0 10px #e74c3c55;
}
.queued-request-flow.failed {
    background-color: #e74c3c !important;
    color: #fff !important;
    border: 1px solid #c0392b !important;
}
.fail-node-btn {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 2px 8px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 0.9em;
}
.fail-node-btn:hover {
    background: #c0392b;
}

/* Simulation badge in detailed metrics */
.simulation-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: capitalize;
}

/* Badge colors will be set via JavaScript */

/* Metrics tables styling */
#metrics-functions-table,
#metrics-nodes-table,
#metrics-requests-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

#metrics-functions-table th,
#metrics-nodes-table th,
#metrics-requests-table th {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    text-align: left;
    font-size: 0.85em;
    display: table-cell !important; /* Force visibility */
    visibility: visible !important; /* Ensure visibility */
}

#metrics-functions-table td,
#metrics-nodes-table td,
#metrics-requests-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
}

#metrics-functions-table tr:nth-child(even),
#metrics-nodes-table tr:nth-child(even),
#metrics-requests-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

#metrics-functions-table tr:hover,
#metrics-nodes-table tr:hover,
#metrics-requests-table tr:hover {
    background-color: #e3f2fd;
}

.metrics-scrollview {
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 15px;
    background: white;
}

/* Dark mode support for metrics tables */
body.dark-mode #metrics-functions-table,
body.dark-mode #metrics-nodes-table,
body.dark-mode #metrics-requests-table {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode #metrics-functions-table th,
body.dark-mode #metrics-nodes-table th,
body.dark-mode #metrics-requests-table th {
    background: linear-gradient(135deg, #4a5568, #2d3748);
}

body.dark-mode #metrics-functions-table td,
body.dark-mode #metrics-nodes-table td,
body.dark-mode #metrics-requests-table td {
    border-bottom: 1px solid #4a5568;
}

body.dark-mode #metrics-functions-table tr:nth-child(even),
body.dark-mode #metrics-nodes-table tr:nth-child(even),
body.dark-mode #metrics-requests-table tr:nth-child(even) {
    background-color: #3a4454;
}

body.dark-mode #metrics-functions-table tr:hover,
body.dark-mode #metrics-nodes-table tr:hover,
body.dark-mode #metrics-requests-table tr:hover {
    background-color: #4a5568;
}

body.dark-mode .metrics-scrollview {
    background: #2d3748;
    border: 1px solid #4a5568;
}

/* Metrics Legend */
.metrics-legend {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 14px;
}

.metrics-legend h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

.metrics-legend ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.metrics-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-item {
    height: 20px;
    border-radius: 4px;
    /* border: 1px solid #ccc; */
}

.legend-item.main-sim {
    background-color: transparent;
}

.legend-item.arena-1 {
    background-color: #e3f2fd;
}

.legend-item.arena-2 {
    background-color: #f3e5f5;
}

.legend-item.failed {
    background-color: #ffebee;
}

/* Dark mode support for legend */
@media (prefers-color-scheme: dark) {
    .metrics-legend {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .metrics-legend h4 {
        color: #e2e8f0;
    }
}
