/* Language segment control (EN | ES) */
.language-toggle-pill {
  display: flex;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.04);
}

.language-toggle-pill__btn {
  flex: 1;
  border: none;
  padding: 0.4rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: transparent;
  color: #333;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.language-toggle-pill__btn:hover {
  filter: brightness(0.96);
}

.language-toggle-pill__btn.is-active {
  background: #007bff;
  color: #fff;
}

/* Inactive segment: explicit dark text (body.dark-mode can inherit near-white). */
.language-toggle-pill__btn:not(.is-active) {
  color: #2d3748;
}

body.dark-mode .language-toggle-pill {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.28);
}

body.dark-mode .language-toggle-pill__btn:not(.is-active) {
  color: #dce3ec;
  background: rgba(0, 0, 0, 0.15);
}

body.dark-mode .language-toggle-pill__btn.is-active {
  background: #007bff;
  color: #fff;
}

.preferences-guest-wrap {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.preferences-dropdown-wrap {
  padding: 0.35rem 0.75rem 0.6rem;
}

.preferences-dropdown-wrap .language-toggle-pill {
  margin-bottom: 0.45rem;
}

.preferences-dropdown-wrap .theme-toggle-pill {
  display: block;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
}

/* Day / night pill toggle (AdminLTE uses body.dark-mode) */
.theme-toggle-pill {
  width: 158px;
  height: 34px;
  border-radius: 999px;
  border: none;
  padding: 0 5px;
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  background: #e8e8e8;
  color: #111;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle-pill:hover {
  filter: brightness(0.97);
}

.theme-toggle-pill:focus {
  outline: 2px solid rgba(0, 123, 255, 0.45);
  outline-offset: 2px;
}

body.dark-mode .theme-toggle-pill {
  background: #000;
  color: #fff;
  box-shadow: none;
}

.theme-toggle-pill__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  flex-direction: row;
}

body.dark-mode .theme-toggle-pill__inner {
  flex-direction: row-reverse;
}

.theme-toggle-pill__label {
  padding: 0 4px;
  user-select: none;
  white-space: nowrap;
}

.theme-toggle-pill__label--night {
  display: none;
}

body.dark-mode .theme-toggle-pill__label--day {
  display: none;
}

body.dark-mode .theme-toggle-pill__label--night {
  display: block;
}

.theme-toggle-pill__knob {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.theme-toggle-pill__icon--night {
  display: none;
}

body.dark-mode .theme-toggle-pill__icon--day {
  display: none;
}

body.dark-mode .theme-toggle-pill__icon--night {
  display: inline;
}

/* Legacy class kept for any external references; guest pages use .preferences-guest-wrap */
.theme-toggle-guest-wrap {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1040;
}

/*
 * Guest login (AdminLTE): .dark-mode sets body colors but leaves .login-page at #e9ecef,
 * so dark-mode language pill text (meant for dark surfaces) sat on a light strip. Match
 * the canvas to the dark body and fix Chrome autofill (yellow) vs. white form text.
 */
body.dark-mode .login-page {
  background-color: #454d55;
}

body.dark-mode .login-page .form-control::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

body.dark-mode .login-page .form-control:-webkit-autofill,
body.dark-mode .login-page .form-control:-webkit-autofill:hover,
body.dark-mode .login-page .form-control:-webkit-autofill:focus,
body.dark-mode .login-page .form-control:-webkit-autofill:active {
  -webkit-text-fill-color: #f8f9fa;
  caret-color: #f8f9fa;
  box-shadow: 0 0 0 1000px #3f474e inset;
  border-color: #6c757d;
  transition: background-color 50000s ease-out;
}

.login-page .form-control:-webkit-autofill,
.login-page .form-control:-webkit-autofill:hover,
.login-page .form-control:-webkit-autofill:focus,
.login-page .form-control:-webkit-autofill:active {
  -webkit-text-fill-color: #212529;
  caret-color: #212529;
  box-shadow: 0 0 0 1000px #fffdf5 inset;
  transition: background-color 50000s ease-out;
}
