body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    justify-content: center;
    padding-top: 20px;
}

.container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 1000px;
}

h1, h2 {
    color: #333;
    text-align: center;
}

.graph-input-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.graph-input-section div {
    margin-bottom: 10px;
}

.graph-input-section label {
    display: inline-block;
    width: 150px;
    margin-right: 10px;
}

.graph-input-section input[type="number"],
.graph-input-section input[type="text"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: calc(100% - 180px);
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
}

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

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #007bff;
}

.tab-link {
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    border-bottom: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    font-size: 16px;
}

.tab-link.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.tab-content {
    display: none;
    padding: 20px;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
}

.tab-content.active {
    display: block;
}

.controls {
    margin-bottom: 20px;
    text-align: center;
}

.visualizer-layout {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    min-height: 450px; /* Increased height for better layout */
    gap: 20px; /* Add some space between graph and info */
}

.graph-section {
    flex: 0 0 60%; /* Graph takes 60% width */
    display: flex;
    flex-direction: column;
}

.graph-container {
    width: 100%;
    height: 400px; /* Fixed height for graph */
    border: 1px solid #eee;
    background-color: #f9f9f9;
    border-radius: 5px;
    position: relative; /* For D3 positioning */
}

.info-section {
    flex: 0 0 38%; /* Info panel takes 38% width */
    display: flex;
    flex-direction: column;
    max-height: 450px; /* Match visualizer-layout min-height */
    /* overflow-y: auto; */ /* Removed to prevent double scroll */
    padding-right: 10px; /* Add some padding for scrollbar if needed, or remove if scrollbar is only on pre */
}

.data-structures {
    width: 100%; /* Take full width of info-section */
    flex-shrink: 0; /* Prevent shrinking */
    /* padding-left: 10px; Removed as info-section handles spacing */
}

.ds-display {
    background-color: #e9ecef;
    padding: 5px; /* Reduced padding */
    margin-bottom: 5px; /* Reduced margin */
    border-radius: 4px;
    font-size: 0.9em;
}

.ds-display strong {
    color: #007bff;
}

.status-message {
    margin-top: 10px; /* Reduced margin-top */
    padding: 5px; /* Reduced padding */
    background-color: #e2e3e5;
    border: 1px solid #d6d8db;
    border-radius: 4px;
    text-align: center;
    min-height: 20px;
    flex-shrink: 0; /* Prevent shrinking */
}

.code-snippet-area {
    margin-top: 10px; /* Reduced margin-top */
    flex-grow: 1; /* Allow to take remaining space */
    overflow-y: hidden; /* Prevent this div from scrolling, pre tag will scroll */
    display: flex; /* To make pre take full height */
    flex-direction: column; /* To make pre take full height */
}

.code-snippet-area pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.4;
    /* max-height: 200px; */ /* Removed to allow filling parent */
    overflow-y: auto; /* Allow vertical scroll within code snippet */
    height: 100%; /* Make pre take full height of .code-snippet-area */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.code-line {
    white-space: pre-wrap; /* Ensure long lines wrap */
}

.highlighted-code-line {
    background-color: #44475a !important; /* Ensure highlight is visible */
    font-weight: bold;
    display: block; /* Ensure background covers whole line */
}

/* D3 Graph Styles */
.node circle {
    stroke: #fff;
    stroke-width: 1.5px;
    cursor: pointer;
}

.node text {
    font-size: 12px;
    pointer-events: none; /* Make text non-interactive */
    text-anchor: middle;
    dominant-baseline: central;
}

.link {
    stroke: #999;
    stroke-opacity: 0.6;
    stroke-width: 2px;
}

.link.highlighted {
    stroke: #ff0000;
    stroke-width: 3px;
}

.node.current circle {
    fill: #ffA500 !important; /* Brighter orange */
    stroke: #000000;
    stroke-width: 2.5px;
    r: 17px !important; /* Slightly larger when current */
}

.node.visited circle {
    fill: lightgreen !important;
}

.node.path-visited circle {
    fill: yellowgreen !important; /* For DFS path tracking */
}

.node.processed circle {
    fill: grey !important; /* For nodes whose processing is complete */
}

.arrowhead {
    fill: #999;
}

.arrowhead.highlighted {
    fill: #ff0000;
}