body {
    background-color: #1b1b1b; /* Slightly lighter background */
    color: #e0e0e0;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 2px;
    box-sizing: border-box;
    padding-bottom: 80px; /* Add padding to the bottom */
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

h1, h2 {
    text-align: center;
    margin: 2px 0;
}

canvas {
    border: 1px solid #e0e0e0;
    background-color: #2b2b2b; /* Lighter background color for the canvas */
    margin-bottom: 5px;
    width: 100%;
    height: auto;
    display: block;
}

input, button {
    background-color: #2b2b2b;
    color: #e0e0e0;
    border: 1px solid #444;
    padding: 8px;
    margin: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
    width: auto; /* Ensure buttons don't stretch unnecessarily */
}

button {
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #3c3c3c;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

button:active {
    background-color: #2b2b2b;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    transform: translateY(1px);
}

#undirectedGraph, #directedGraph, #canvasContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    overflow: hidden; /* Hide any potential overflow */
}

pre {
    background-color: #1e1e1e;
    color: #e0e0e0;
    padding: 10px;
    border: 1px solid #444;
    width: 80%;
    overflow: auto;
    margin: 10px 0;
}

@media (max-width: 600px) {
    canvas {
        width: 90%;
        height: auto;
    }
    input, button {
        width: 90%;
    }
}

#nextButton {
    background-color: #2b2b2b;
    color: #e0e0e0;
    border: 1px solid #444;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

#nextButton:hover {
    background-color: #3c3c3c;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

#nextButton:active {
    background-color: #2b2b2b;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    transform: translateY(1px);
}

#indegreeList table {
    margin: 3px auto; /* Center the table within the container */
    table-layout: fixed; /* Ensure table fits within the container */
}

#indegreeList td {
    border: 1px solid #444;
    text-align: center;
    background-color: #2b2b2b;
    padding: 1px !important;
    color: #e0e0e0;
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#indegreeList th {
    border: 1px solid #888;
    background-color: #444;
    color: #e0e0e0;
    padding: 5px;
    font-size: 0.9rem; /* Default font size for headers */
    text-align: center; /* Horizontally center the text */
    vertical-align: middle; /* Vertically center the text */
}

#indegreeList {
    width: auto;
    text-align: center;
}

#directedAdjacencyList {
    background-color: #1e1e1e;
    color: #e0e0e0;
    padding: 10px;
    border: 1px solid #444;
    margin-top: 10px;
    width: 100%;
}

#buttonContainer {
    display: flex;
    justify-content: center; /* Center the buttons horizontally */
    align-items: center; /* Center the buttons vertically (if needed) */
    flex-wrap: wrap; /* Wrap buttons if there's not enough space */
    gap: 10px; /* Add spacing between the buttons */
}

#directionButtonContainer button {
    margin: 0 10px;
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid #444;
    background-color: #2b2b2b;
    color: #e0e0e0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#directionButtonContainer button.pressed {
    background-color: #444;
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.3);
}

#directionButtonContainer button:not(.pressed):hover {
    background-color: #3c3c3c;
}

#directedAdjacencyList {
    background-color: #1e1e1e;
    color: #e0e0e0;
    padding: 10px;
    border: 1px solid #444;
    margin-top: 10px;
    width: 100%;
    overflow: auto;
    direction: rtl; /* Default direction is RTL */
}

/* Footer Styles */
/* Footer Styles */
#footer {
    background-color: rgba(43, 43, 43, 0.8); /* Dark background with transparency */
    color: #e0e0e0;
    position: fixed;
    bottom: 0;
    width: 100%;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
    justify-content: space-between; /* Adjust this for alignment */
    padding: 1px;
    box-sizing: border-box;
}
#footer button {
    background-color: #444;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex: 1; /* Ensure buttons take up equal space */
    max-width: 150px; /* Optional: limit the maximum width of each button */
}

#footer button:hover {
    background-color: #555;
}

#footer button:active {
    background-color: #333;
}

#buttonContainer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#hamburgerMenu {
    display: none; /* Hidden by default */
    position: relative;
    
}

#hamburgerIcon {
    font-size: 24px;
    cursor: pointer;
    background-color: #444;
    padding: 8px;
    border-radius: 5px;
    display: none; /* Initially hidden */
}

#popupMenu {
    display: none;
    position: absolute;
    bottom: 100%; /* Position above the icon */
    right: 0;
    background-color: #2b2b2b;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    padding: 10px;
    flex-direction: column;
    z-index: 1000;
}

#popupMenu button {
    margin: 5px 0;
}

#popupMenu.show {
    display: flex;
}

@media (max-width: 600px) {
    #buttonContainer {
        flex-wrap: nowrap; /* Don't allow buttons to wrap */
        overflow: hidden;
    }

    #hamburgerIcon {
        display: block; /* Show the hamburger icon on small screens */
    }

    #buttonContainer button {
        display: none; /* Hide buttons that overflow */
    }

    #hamburgerMenu {
        display: block; /* Show the hamburger menu */
    }
}


@media (max-width: 768px) {
    #indegreeList td {
        font-size: 0.9rem; /* Slightly smaller font size */
    }
}

@media (max-width: 480px) {
    #indegreeList td {
        font-size: 0.7rem; /* Even smaller font size for very small screens */
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.5rem; /* Smaller header size */
    }

    canvas {
        width: 100%;
        height: auto;
    }

    #buttonContainer {
        flex-direction: column;
        align-items: center;
    }

    input, button {
        width: 100%; /* Full width for buttons and inputs */
        margin: 10px 0; /* Space them out */
    }

    pre {
        width: 100%; /* Full width */
    }

    #indegreeList td {
        font-size: 0.8rem; /* Smaller font size for mobile screens */
    }

    #indegreeList table {
        width: 100%; /* Ensure the table fits the screen */
    }
}

#directionButtonsContainer {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

#directionButtonsContainer button {
    margin: 0 10px;
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid #444;
    background-color: #2b2b2b;
    color: #e0e0e0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#directionButtonsContainer button.pressed {
    background-color: #444;
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.3);
}

#directionButtonsContainer button:not(.pressed):hover {
    background-color: #3c3c3c;
}

#controlsContainer {
    display: flex;
    flex-direction: column; /* Stack controls vertically on small screens */
    width: 100%;
    margin-bottom: 20px;
}

#stepControls, #resizeControls {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping of controls */
    gap: 10px;
    justify-content: center; /* Center controls horizontally */
    width: 100%; /* Ensure the container takes up the full width */
}

#visualizerInfo {
    margin-top: 2px;
    text-align: center; /* Center text alignment */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center all elements horizontally */
    justify-content: center; /* Center all elements vertically */
}
