:root {
    --bg-color: #ffffff;
    --text-color: #212529;
    --nav-bg: #ffffff;
    --border-color: #ccc;
    --input-bg: #ffffff;
    --input-border: #dee2e6;
    --scrollbar-thumb: #e3e3e3;
    --scrollbar-thumb-hover: #ccc;
    --table-hover-bg: rgba(0, 0, 0, 0.075);
    --label-bg: #e8e9ea;
    --modal-bg: #ffffff;
    --card-bg: #ffffff;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --nav-bg: #2d2d2d;
    --border-color: #444;
    --input-bg: #2d2d2d;
    --input-border: #444;
    --scrollbar-thumb: #555;
    --scrollbar-thumb-hover: #666;
    --table-hover-bg: rgba(255, 255, 255, 0.075);
    --label-bg: #3a3a3a;
    --modal-bg: #2d2d2d;
    --card-bg: #2d2d2d;
}

body {
    overflow-x: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.dark-mode-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    margin: 4px 8px 4px auto;
    transition: color 0.3s;
}

.dark-mode-toggle:hover {
    opacity: 0.7;
}

.nav {
    background: var(--nav-bg);
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    font-size: 20px;
    border: 0 solid var(--border-color);
    border-bottom-width: 1px;
    user-select: none;
    z-index: 1000;
    margin: 0;
    transition: background-color 0.3s, border-color 0.3s;
}

.nav-link {
    padding: 4px 8px;
    margin: 4px 8px;
}

body h1 {
    margin: 16px;
    text-align: center;
}

.spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    color: #24d;
}

.table {
    margin: 0;
}

.table-header-fixed thead tr {
    position: sticky;
    top: 0;
}

.table-last-child-fixed tbody tr:last-child {
    position: sticky;
    bottom: -1px;
    font-weight: bold;
}

.allocation-div {
    padding: 8px 0 8px 8px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 20px;
    background-color: var(--card-bg);
    transition: background-color 0.3s, border-color 0.3s;
}

.allocation-table {
    height: 60vh;
}

.allocation-table-scroll {
    height: 100%;
    overflow-y: auto;
}

.allocation-table-scroll::-webkit-scrollbar {
    width: 16px;
}

.allocation-table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.allocation-table-scroll::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 4px solid transparent;
    border-top-width: 0;
    border-bottom-width: 0;
    border-radius: 8px;
    background-clip: padding-box;
    transition: background-color 0.3s;
}

.allocation-table-scroll::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

.table-clickable {
    cursor: pointer;
}

.optimization-div {
    margin: 36px 16px 0 16px;
}

.optimization-stats-div {
    display: flex;
    justify-content: flex-start;
    gap: 40px;
    align-items: center;
    margin: 0 36px;
}

.optimization-stats-div .form-label {
    border-radius: 6px;
    background: var(--label-bg);
    padding: 12px;
    margin: 0;
    transition: background-color 0.3s;
}

.disciplines-input-div, .disciplines-checkbox-div {
    margin-bottom: 20px;
    display: inline-flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.disciplines-checkbox .input-group-text:last-child {
    flex: 1;
}

.disciplines-text-input, .disciplines-checkbox {
    height: 40px;
    flex-wrap: nowrap;
}

.disciplines-text-input .input-group-text {
    width: 130px;
}

.top-input-div {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 20px;
    margin: 10px;
}

.download-button {
    display: flex;
    margin-right: auto;
}

.disciplines-range-label {
    display: block;
    text-align: center;
}

.dash-dropdown {
    width: 100px;
}

.form-control, .form-check-input {
    box-shadow: none !important;
    border: var(--bs-border-width) solid var(--bs-border-color) !important;
}

.form-check-input {
    border-width: 1px !important;
    border-color: #6c757d !important;
}

.modal-input-text-div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-dropdowns-div .input-group {
    width: unset;
}

.modal-dropdowns-div {
    display: flex;
    gap: 20px;
    flex-direction: column;
}

.modal-dropdowns-div .Select-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.modal-dropdowns-div .Select-input {
    height: 36px;
}

.modal-dropdown-row {
    display: flex;
    justify-content: space-between;
}

.modal-capacity {
    width: 50px;
}

.modal-class-occupation {
    justify-content: flex-end;
    margin-bottom: 20px;
}

.modal-checkbox-div {
    display: flex;
    gap: 20px;
}

.discipline-modal-checkbox {
    margin-top: 20px;
}

.discipline-modal-checkbox-hidden {
    visibility: hidden;
    height: 0;
}

.checklist-select-all, .checklist-select-all label {
    margin-bottom: 0;
}

.checklist-label {
    display: block;
    text-align: center;
}

.checklist-items {
    overflow: hidden auto;
    width: 100px;
    height: 200px;
}

.checklist-items::-webkit-scrollbar {
    width: 16px;
}

.checklist-items::-webkit-scrollbar-track {
    background: transparent;
}

.checklist-items::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 4px solid transparent;
    border-top-width: 0;
    border-bottom-width: 0;
    border-radius: 8px;
    background-clip: padding-box;
    transition: background-color 0.3s;
}

.checklist-items::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

#password-div {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#password-div div {
    width: 300px;
}

/* Dark mode overrides for Bootstrap components */
body.dark-mode .table {
    color: var(--text-color);
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.075);
    --bs-table-active-bg: rgba(255, 255, 255, 0.1);
}

body.dark-mode .table > :not(caption) > * > * {
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

body.dark-mode .table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: transparent;
    color: var(--text-color);
}

body.dark-mode .table-hover > tbody > tr:hover > * {
    background-color: var(--table-hover-bg);
    color: var(--text-color);
}

body.dark-mode .table thead th {
    background-color: var(--bg-color);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .table tbody td {
    border-color: var(--border-color);
}

body.dark-mode .table-last-child-fixed tbody tr:last-child > * {
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-color: var(--input-border);
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-color: #6ea8fe;
}

body.dark-mode .input-group-text {
    background-color: var(--label-bg);
    color: var(--text-color);
    border-color: var(--input-border);
}

body.dark-mode .btn-outline-primary {
    color: #6ea8fe;
    border-color: #6ea8fe;
}

body.dark-mode .btn-outline-primary:hover {
    background-color: #6ea8fe;
    border-color: #6ea8fe;
    color: #000;
}

body.dark-mode .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

body.dark-mode .btn-primary:hover:not(:disabled) {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

body.dark-mode .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

body.dark-mode .btn-secondary:hover {
    background-color: #7d8691;
    border-color: #7d8691;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #7d8691;
    border-color: #7d8691;
    color: #fff;
}

body.dark-mode .modal-content {
    background-color: var(--modal-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    border-color: var(--border-color);
}

body.dark-mode .nav-link {
    color: var(--text-color);
}

body.dark-mode .nav-link:hover:not(.disabled) {
    color: #6ea8fe;
}

body.dark-mode .nav-link.active {
    background-color: #0d6efd;
    color: white;
}

body.dark-mode .nav-link.disabled {
    color: #6c757d;
    opacity: 0.5;
}

body.dark-mode .Select-control {
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

body.dark-mode .Select-menu-outer {
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

body.dark-mode .Select-option {
    background-color: var(--input-bg);
    color: var(--text-color);
}

body.dark-mode .Select-option:hover {
    background-color: var(--table-hover-bg);
}

body.dark-mode .form-check-input {
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

body.dark-mode .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

body.dark-mode .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}
