/* Tom-Select wrapper - remove extra styling */
.ts-wrapper {
  border: none;
  padding: 0;
  background: transparent;
}

/* Tom-Select control - match Bootstrap form controls */
.ts-wrapper .ts-control,
.ts-wrapper.single.input-active .ts-control {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  color: var(--bs-body-color);
  font-size: inherit;
  line-height: inherit;
  min-height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 0.75rem;
}

/* Dark mode overrides */
[data-bs-theme="dark"] .ts-wrapper .ts-control,
[data-bs-theme="dark"] .ts-wrapper.single.input-active .ts-control {
  background: #212529;
  border-color: #495057;
  color: #dee2e6;
}

[data-bs-theme="dark"] .ts-wrapper .ts-control input {
  color: #dee2e6;
}

[data-bs-theme="dark"] .ts-wrapper .ts-control input::placeholder {
  color: #6c757d;
}

.ts-wrapper .ts-control .ts-input::placeholder,
.ts-wrapper .ts-control input::placeholder {
  background: transparent;
}

[data-bs-theme="dark"] .ts-wrapper .ts-control .ts-input::placeholder,
[data-bs-theme="dark"] .ts-wrapper .ts-control input::placeholder {
  background: transparent;
}

[data-bs-theme="dark"] .ts-dropdown {
  background: #212529;
  border-color: #495057;
}

/* Ensure dropdown sits above other content */
.ts-dropdown {
  z-index: 1050;
  max-height: 300px;
  overflow-y: auto;
}

[data-bs-theme="dark"] .ts-dropdown .option {
  color: #dee2e6;
}

[data-bs-theme="dark"] .ts-dropdown .active {
  background-color: #0d6efd;
  color: #fff;
}

[data-bs-theme="dark"] .ts-dropdown .active.create {
  color: #dee2e6;
}

[data-bs-theme="dark"] .ts-wrapper .ts-control > div.item {
  border-color: #6c757d;
}

[data-bs-theme="dark"] .ts-wrapper.plugin-remove_button .ts-control > div.item .remove {
  border-color: #6c757d;
}

[data-bs-theme="dark"] .ts-wrapper.plugin-remove_button .ts-control > div.item .remove:hover {
  background: rgba(220, 53, 69, 0.2);
}

/* Header */
:root {
  --navbar-height: 49px;
}

.sticky-table-header th {
  position: sticky;
  top: var(--navbar-height);
  z-index: 1;
  background-color: var(--bs-body-bg);
}

/* Collapse toggle chevron (shared by all collapsible card headers) */
.collapse-toggle .fa-chevron-down {
}
.collapse-toggle[aria-expanded="false"] .fa-chevron-down {
  transform: rotate(180deg);
}

.ralph-plan-body {
  max-height: 300px;
  overflow-y: auto;
}

.pre-wrap {
  white-space: pre-wrap;
}

.profile-form {
  max-width: 600px;
}

/* Avatar toggle button in the nav — no visible button chrome */
.nav-avatar-btn {
  background: none;
  border: none;
  padding: 0;
}

/* Favorite-star toggle form wrapper — keeps the button inline with surrounding text */
.favorite-star-form {
  display: inline-block;
}

/* Favorite-star toggle button — borderless ghost icon with a faint hover/focus fill */
.favorite-star-btn {
  display: inline-block;
  border: none;
  background: transparent;
  padding: 0.35rem;
  border-radius: 50%;
  cursor: pointer;
}

.favorite-star-btn:hover,
.favorite-star-btn:focus-visible {
  background-color: rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .favorite-star-btn:hover,
[data-bs-theme="dark"] .favorite-star-btn:focus-visible {
  background-color: rgba(255, 255, 255, 0.12);
}

/* Avatar image / initials badge in the nav dropdown toggle */
.header-user-image {
  width: 32px;
  height: 32px;
}

.header-user-initials {
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--bs-primary);
  color: #fff;
}

/* Sortable table column headers */
.cursor-pointer {
  cursor: pointer;
}

.sort-indicator {
  margin-left: 0.25rem;
  font-size: 0.75rem;
  color: #6c757d;
}

.libyear-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.card-link-block {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

/* Responsive horizontal padding: 1.5rem at md+, zero below md */
.px-md-responsive {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 767.98px) {
  .px-md-responsive {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

@media (max-width: 767.98px) {
  .modal-body-compact-x {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* Mobile nav back link — constrain width to leave room for avatar and hamburger */
.mobile-nav-back-link {
  max-width: 160px;
}

/* Flash message panel: fixed top-right, below sticky header, stacked, non-flow */
.flash-panel {
  position: fixed;
  top: var(--navbar-height);
  right: 1rem;
  z-index: 1035;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 350px;
}

/* Flash alert countdown progress bar: track + fill, both derived from currentColor.
   The track is a ::before pseudo-element (not a parent of the fill) so its low
   opacity doesn't get composited into the fill, which must stay at full opacity. */
.flash-panel .alert {
  position: relative;
}

.flash-panel .alert .flash-alert-progress {
  position: absolute;
  bottom: 1px;
  left: 1px;
  right: 1px;
  height: 4px;
  overflow: hidden;
  border-radius: 0 0 var(--bs-alert-border-radius) var(--bs-alert-border-radius);
}

.flash-panel .alert .flash-alert-progress::before {
  content: "";
  display: block;
  height: 100%;
  width: 100%;
  background-color: currentColor;
  opacity: 0.25;
}

.flash-panel .alert .flash-alert-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: currentColor;
  transition-property: width;
  transition-timing-function: linear;
}

