/* General Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scrolling on body */
}

h1, h3 {
    margin: 0;
    padding: 10px;
    text-align: center;
}

/* Control Panel */
#controls-container {
    display: flex;
    flex-direction: column; /* Layout items vertically */
    padding: 10px;
    background-color: #f5f5f5;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    position: fixed; /* Ensure the control panel is always fixed */
    z-index: 1001; /* Keep control panel above all other content */
}

#controls-container.left {
    width: 20%; /* Fixed width of 1/5 of the screen */
    top: 0;
    left: 0;
    height: 100vh; /* Full height of viewport */
    overflow-y: auto; /* Allow scrolling if content exceeds height */
}

.controls-container.top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* Ensure it stays above other content */
}

/* Adjust margin for main content when the panel is on the left */
.mainframe.with-left-panel {
    margin-left: 20%; /* Leave space for the left panel */
}

.mainframe {
    margin-top: 0;
    transition: margin-left 0.3s;
}

/* Control elements styling */
#controls-container > * {
    margin-bottom: 15px; /* Add spacing between controls */
    width: 90%; /* Make controls fit nicely within the panel */
    margin: 0 auto; /* Center align within the panel */
}

/* Checkbox or input group styles */
input[type="checkbox"], select, input[type="range"] {
    display: block;
    width: 100%;
}

/* Table Styling */
table {
    margin: 0 auto;
    width: 80%;
    border-collapse: collapse;
    table-layout: fixed; /* Fix table layout to respect width */
    max-width: 100%; /* Ensure table doesn’t exceed container */
}

th, td {
    padding: 8px;
    text-align: left;
    border: 1px solid #ddd;
    word-wrap: break-word; /* Allow long words to break and wrap */
    overflow-wrap: break-word; /* Modern equivalent of word-wrap */
    overflow: hidden; /* Hide overflow if needed */
}

/* Force specific column widths */
th:nth-child(1), td:nth-child(1) {
    width: 20px; /* Minimal width for checkbox */
    min-width: 20px; /* Enforce minimum */
    max-width: 20px; /* Enforce maximum */
    padding: 8px 4px; /* Reduce horizontal padding */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Clip overflow */
    text-overflow: ellipsis; /* Ellipsis for overflow */
}

th:nth-child(2), td:nth-child(2) {
    width: 40px; /* Minimal width for serial number */
    min-width: 40px; /* Enforce minimum */
    max-width: 40px; /* Enforce maximum */
    padding: 8px 4px; /* Reduce horizontal padding */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Clip overflow */
    text-overflow: ellipsis; /* Ellipsis for overflow */
}

th:nth-child(3), td:nth-child(3),
th:nth-child(4), td:nth-child(4) {
    width: auto; /* Allow these to take remaining space */
    max-width: none; /* No upper limit */
    white-space: normal; /* Allow wrapping */
}

/* Ensure table respects total width */
table {
    width: 80%;
    max-width: 100%;
}

thead th {
    background-color: #f4f4f4;
}

/* Word Table */
#wordTable tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

#wordTable tbody tr:nth-child(odd) {
    background-color: white;
}

#wordTable tbody tr:hover {
    background-color: lightpink;
    cursor: pointer;
}

/* Important Sentences */
.important-sentences {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(249, 249, 249, 0.9); /* Slightly transparent background */
    z-index: 1000; /* Ensure this is below the control panel */
    overflow-y: auto; /* Allow scrolling if the content exceeds screen size */
}

.important-sentences table {
    width: 60%;
    max-width: 800px;
    background-color: white;
    border: 1px solid #ddd;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    table-layout: fixed; /* Fix table layout to respect width */
}

/* Apply font size to content elements */
.contentxy, .important-sentences table {
    font-size: 30px; /* Default font size */
}

/* Prevent font size change for control panel */
#controls-container {
    font-size: 16px; /* Fixed font size for control panel */
}

/* Styling for the important sentences table */
#importantTable tr td {
    font-size: 24px;
}