body {
  overflow-y: scroll;
}

/* The Modal (background) */
.modal {
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0,0.4);
  display: none;
  height: 100%;
  left: 0;
  overflow: auto;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 10000;
}

/* Modal Content/Box */
.modal-content {
  background-color: #fefefe;
  border: 1px solid #888;
  margin: 2% auto;
  padding: 10px;
  width: 80%;
}

/* The Close Button */
.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: black;
  cursor: pointer;
  text-decoration: none;
}

.asc:after,
.desc:after {
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  padding-left: .5rem;
  vertical-align: middle;
}

.asc:after {
  content: "\f0de";
}

.desc:after {
  content: "\f0dd";
}

th a {
  display: block;
}

th a:hover {
  text-decoration: none;
}

.checkmark-green {
  color: #28a745;
}

.red {
  color: #dc4444;
}

.dark-toggle {
  text-decoration: none;
}

/* Toast container for notifications */
#alert-container {
  position: fixed;
  top: 3rem; /* Adjust based on navbar height */
  right: 1rem;
  z-index: 1050; /* Above navbar (z-index 1030 in Bootstrap) */
  min-width: 200px;
  max-width: 400px;
}

#alert-container .toast {
  margin-bottom: 0.2rem; /* Space between stacked toasts */
  width: 100%;
}

/* Fix for dark mode toggle width consistency */
#dark-mode-toggle i {
  display: inline-block;
  text-align: center;
  width: 1.25em; /* Match widest icon */
}

/* Fix HELP button and Dark mode toggle styling */
#help-page {
  color: #fff; /* Match light theme nav-link color */
  text-align: left; /* Ensure consistent alignment */
  padding-left: 0.75rem; /* Match .nav-link padding */
  padding-right: 0.75rem;
}

/* Hover styles for HELP button to match nav-links */
#help-page:hover {
  background-color: #fff;
  color: #dc4444;
}

/* Dark theme adjustments */
body.dark-mode #help-page {
  color: #2C3E50; /* Light color for dark theme */
}

body.dark-mode #dark-mode-toggle {
  color: #dc4444;
}

body.dark-mode #help-page:hover {
  background-color: #fff;
  color: #dc4444;
}

/* Dark mode for modals */
body.dark-mode .modal-content {
  background-color: #2c3e50;
  border-color: #4a5568;
  color: #e2e8f0;
}

body.dark-mode .modal-header {
  border-bottom-color: #4a5568;
}

body.dark-mode .modal-footer {
  border-top-color: #4a5568;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
  background-color: #1a252f;
  border-color: #4a5568;
  color: #e2e8f0;
}

body.dark-mode .form-control::placeholder {
  color: #718096;
}

body.dark-mode .btn-close {
  filter: invert(1);
}

/* Collapsed navbar alignment */
@media (max-width: 991.98px) {
  .navbar-collapse.show .navbar-nav {
    margin-top: 0; /* Remove top margin for consistency */
  }
  .navbar-collapse.show .navbar-nav .nav-link,
  .navbar-collapse.show #help-page,
  .navbar-collapse.show #dark-mode-toggle {
    padding-left: 1rem; /* Consistent left padding */
    margin-left: 0; /* Remove any left margin */
    text-align: left;
  }
}

/* Make rows draggable and show grab cursor */
#models-tbody tr {
    transition: background-color 0.2s ease;
    position: relative;          /* For proper z-index stacking */
}
#models-tbody tr .fa-bars {
  cursor: grab;
}

#models-tbody tr .fa-bars:active {
    cursor: grabbing;
}

#models-tbody tr.dragging {
    opacity: 0.7;
    background: #2c3e50 !important;
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
    z-index: 1000;
    transform: none;            /* Remove scaling to prevent layout shifts */
}
#models-tbody tr.drag-over {
    background: #34495e !important;
    border-left: 3px solid #3498db;
    border-right: 3px solid #3498db;
}
#models-tbody tr:hover {
    background: #f8f9fa;
}

/* Prevent table layout issues during drag */
#models-tbody {
    position: relative;
}

/* Site column responsive behavior */
/* On wide screens: show Site column, hide favicon in model name cell */
@media (min-width: 768px) {
    .site-column {
        display: table-cell;
    }
    .site-favicon {
        display: none;
    }
}

/* On narrow screens: hide Site column, show favicon in model name cell */
@media (max-width: 767.98px) {
    .site-column {
        display: none;
    }
    .site-favicon {
        display: inline;
    }
}
