body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Modern font stack */
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f8f9fa; /* Lighter background */
    color: #212529; /* Darker text for better contrast */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align items to the top */
    min-height: 100vh;
}

.container {
    max-width: 700px; /* Slightly wider */
    width: 100%; /* Responsive width */
    margin: 20px; /* Margin around the container */
    padding: 30px; /* More padding */
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Softer shadow */
    border: 1px solid #dee2e6; /* Subtle border */
}

/* --- Navbar Styles --- */
.navbar {
    background-color: #343a40; /* Dark background */
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%; /* Make navbar full width */
    margin-bottom: 30px; /* Space below navbar */
    position: sticky; /* Keep navbar at the top */
    top: 0;
    z-index: 100; /* Ensure it's above other content */
}

.nav-container {
    max-width: 900px; /* Match container width or adjust */
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    color: #fff;
    font-size: 1.4em;
    font-weight: bold;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 20px;
}

.nav-links li a {
    color: #adb5bd; /* Lighter link color */
    text-decoration: none;
    font-size: 1em;
    transition: color 0.2s ease;
}

.nav-links li a:hover,
.nav-links li a.active { /* Style for active link */
    color: #fff;
    font-weight: 500;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-user #user-greeting {
    color: #fff;
    font-weight: normal; /* Adjust as needed */
}

.nav-user #logout-button {
    width: auto; /* Override default */
    padding: 6px 12px;
    font-size: 0.9em;
    background-color: #dc3545;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
}
.nav-user #logout-button:hover {
    background-color: #c82333;
}

/* --- Button Link Style (for index.html) --- */
.button-link {
    display: inline-block;
    padding: 10px 20px;
    margin: 5px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 1em;
}

.button-link:hover {
    background-color: #0056b3;
}

/* --- Auth Page Specific Container --- */
.auth-page .container { /* Style container specifically on auth pages */
     max-width: 450px; /* Narrower container for login/register */
     margin-top: 50px; /* More space from top */
}


h1, h2 {
    color: #343a40; /* Darker heading color */
    text-align: center;
    margin-bottom: 25px;
}

h1 {
    font-size: 1.8em; /* Slightly larger H1 */
}

h2 {
    font-size: 1.4em;
    border-bottom: 1px solid #eee; /* Separator line */
    padding-bottom: 10px;
    margin-top: 30px; /* More space above H2 */
}

.input-section, .controls, .output-section, .progress-section {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px; /* More space below label */
    font-weight: 600; /* Slightly bolder */
    color: #495057; /* Label color */
}

/* Style the file input */
input[type="file"] {
    display: block; /* Ensure it takes full width */
    width: 100%;
    padding: 10px;
    margin-bottom: 5px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    font-size: 0.95em;
    box-sizing: border-box;
}

/* Style the file input button provided by the browser */
input[type="file"]::file-selector-button {
    padding: 8px 15px;
    margin-right: 10px;
    background-color: #6c757d; /* Secondary button color */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    background-color: #5a6268;
}

small {
    display: block;
    font-size: 0.85em;
    color: #6c757d; /* Muted text color */
    margin-top: 5px;
}


textarea, select, button { /* Keep general button styles */
    width: 100%;
    padding: 12px 15px; /* Larger padding */
    margin-bottom: 10px;
    border: 1px solid #ced4da; /* Consistent border */
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em; /* Consistent font size */
}

textarea {
    resize: vertical;
    min-height: 80px; /* Minimum height */
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    font-weight: 500;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #adb5bd; /* Disabled color */
    cursor: not-allowed;
    opacity: 0.7;
}

/* Specific style for download button */
#download-button {
    background-color: #28a745; /* Green color */
    margin-top: 15px; /* Space above download button */
}

#download-button:hover {
    background-color: #218838;
}

/* Progress Section Styles */
.progress-section {
    text-align: center;
    padding: 15px;
    background-color: #f1f3f5; /* Light background for section */
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

#translation-progress {
    width: 100%; /* Full width progress bar */
    height: 12px; /* Slimmer progress bar */
    margin-bottom: 8px;
    appearance: none; /* Remove default styling */
    border: none;
    border-radius: 6px; /* Rounded corners */
    overflow: hidden; /* Ensure value stays within bounds */
}

/* Styling the progress bar background */
#translation-progress::-webkit-progress-bar {
    background-color: #e9ecef; /* Background of the bar */
    border-radius: 6px;
}
#translation-progress::-moz-progress-bar { /* Firefox */
    background-color: #e9ecef;
    border-radius: 6px;
}

/* Styling the progress bar value */
#translation-progress::-webkit-progress-value {
    background-color: #007bff; /* Blue progress */
    border-radius: 6px;
    transition: width 0.3s ease; /* Smooth transition */
}
#translation-progress::-moz-progress-bar { /* Firefox */
    background-color: #007bff;
    border-radius: 6px;
    transition: width 0.3s ease;
}


#progress-text {
    font-weight: bold;
    font-size: 0.9em;
    color: #495057;
    display: inline-block; /* Keep on same line as bar if desired */
    margin-left: 10px; /* Space from bar if needed */
}

#status-text {
    font-style: italic;
    color: #6c757d;
    margin-top: 8px;
    font-size: 0.9em;
    min-height: 1.2em; /* Prevent layout shifts */
}

/* Result Box Styles */
.result-box {
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 4px;
    min-height: 150px; /* Increased min-height */
    border: 1px solid #ced4da;
    max-height: 400px; /* Limit height and make scrollable */
    overflow-y: auto; /* Add scrollbar if content exceeds max-height */
}

/* Style for pre/code inside result box */
.result-box pre {
    margin: 0; /* Remove default pre margin */
    white-space: pre-wrap;       /* CSS3 */
    white-space: -moz-pre-wrap;  /* Mozilla */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* IE */
}

.result-box code {
    display: block; /* Make code block-level */
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace; /* Monospace font */
    font-size: 0.9em;
    line-height: 1.5; /* Improve readability */
    color: #333; /* Ensure text color contrasts with background */
}

/* Error styling (from original script.js, integrated here) */
.result-box.error code { /* Apply error style to code inside error box */
    color: #721c24; /* Dark red */
}
.result-box.error { /* Style the box itself */
     background-color: #f8d7da; /* Light red */
     border-color: #f5c6cb; /* Reddish border */
}

/* --- Authentication Styles --- */

.auth-buttons {
    text-align: right; /* Align buttons to the right */
    margin-bottom: 20px;
}

.auth-buttons button {
    width: auto; /* Override default full width */
    padding: 8px 15px;
    margin-left: 10px;
    font-size: 0.9em;
}

#logout-button {
    background-color: #dc3545; /* Red for logout */
}
#logout-button:hover {
    background-color: #c82333;
}

#user-greeting {
    font-weight: bold;
    color: #495057;
}

/* Old modal styles removed */

.auth-message { /* Keep general auth message styling */
    margin-top: 15px;
    text-align: center;
    font-size: 0.9em;
    min-height: 1.2em; /* Prevent layout shifts */
}

.error-message {
    color: #dc3545; /* Red for errors */
}

.success-message {
    color: #28a745; /* Green for success */
}


/* --- Vocabulary Styles --- */

.vocabulary-controls {
    display: flex; /* Align items horizontally */
    align-items: center; /* Center items vertically */
    gap: 10px; /* Space between elements */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.vocabulary-controls label {
    margin-bottom: 0; /* Remove bottom margin for inline alignment */
    flex-shrink: 0; /* Prevent label from shrinking */
}

.vocabulary-controls select {
    flex-grow: 1; /* Allow select to take available space */
    width: auto; /* Override default full width */
    margin-bottom: 0; /* Remove bottom margin */
    min-width: 150px; /* Minimum width */
}

.inline-button { /* Style for buttons next to other elements */
    width: auto;
    padding: 8px 15px;
    font-size: 0.9em;
    margin-bottom: 0; /* Remove bottom margin */
    flex-shrink: 0; /* Prevent button from shrinking */
}

/* Styles for vocabulary page elements (formerly in modal) */
.vocab-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.vocab-actions input[type="text"] {
    flex-grow: 1;
    margin-bottom: 0;
}

.vocab-actions button {
    width: auto;
    flex-shrink: 0;
    margin-bottom: 0;
}

.vocab-list-section, #vocab-entries-section {
    margin-top: 20px;
}

#vocab-list, #vocab-entries-list {
    list-style: none;
    padding: 0;
    max-height: 250px; /* Limit height and add scroll */
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-top: 10px;
}

#vocab-list li, #vocab-entries-list li {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#vocab-list li:last-child, #vocab-entries-list li:last-child {
    border-bottom: none;
}

#vocab-list li button, #vocab-entries-list li button {
    width: auto;
    padding: 5px 10px;
    font-size: 0.8em;
    margin-left: 10px;
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}
#vocab-list li button:hover, #vocab-entries-list li button:hover {
    background-color: #dee2e6;
}

#vocab-list li .vocab-name {
    cursor: pointer;
    font-weight: 500;
}
#vocab-list li .vocab-name:hover {
    color: #0056b3;
}

#vocab-entries-section h3 {
    margin-bottom: 10px;
}
#vocab-entries-section h4 {
    margin-top: 20px;
    margin-bottom: 10px;
}

#back-to-vocab-list {
    margin-bottom: 15px;
    background-color: #6c757d;
}
#back-to-vocab-list:hover {
    background-color: #5a6268;
}

.vocab-entry-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}
.vocab-entry-form input[type="text"] {
    flex-grow: 1;
    margin-bottom: 0;
}
.vocab-entry-form button {
    width: auto;
    flex-shrink: 0;
    margin-bottom: 0;
}

#vocab-entries-list .entry-source {
    flex-basis: 45%; /* Adjust as needed */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#vocab-entries-list .entry-target {
    flex-basis: 45%; /* Adjust as needed */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #555;
}
#vocab-entries-list .entry-actions {
     flex-basis: 10%;
     text-align: right;
}
