/* Modern Toggle Switch Styling */
.modern-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modern-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 3rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #e9ecef;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
  transition: all 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
  /* Visual order only — DOM order stays checkbox-then-label so the
     `input:checked + label` sibling selectors below keep matching. */
  order: 2;
}

.modern-toggle input[type="checkbox"]::before {
  content: '';
  position: absolute;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: white;
  left: 0.1rem;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.modern-toggle input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.modern-toggle input[type="checkbox"]:checked::before {
  left: calc(100% - 1.4rem);
}

.modern-toggle input[type="checkbox"]:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modern-toggle input[type="checkbox"]:checked:hover {
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.modern-toggle label {
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  color: #6c757d;
  transition: all 0.25s ease;
  margin: 0;
  /* Visual order only — renders before the checkbox (text, then switch)
     while staying its DOM sibling so `input:checked + label` still applies. */
  order: 1;
}

.modern-toggle input[type="checkbox"]:checked + label {
  color: #16a34a;
}

.modern-toggle label i {
  transition: all 0.25s ease;
  margin-right: 4px;
  font-size: 0.9rem;
}

.modern-toggle input[type="checkbox"]:checked + label i {
  transform: scale(1.1);
}

/* Header placement (scoped to .cp-header): the toggle lives in a .cp-h-item
   flex row alongside the notification bell (.cp-head-link) and profile
   avatar+name. Making the wrapping form a flex container lets the
   already-centered .modern-toggle share the same vertical center as the
   bell/avatar (.cp-h-item itself is `display:flex; align-items:center`).
   Colors/shape of the toggle itself are untouched.

   The form must NOT carry Bootstrap's `.d-inline-block`
   (`display: inline-block !important`) — it wins over this rule, and the
   previous `height: 100%` here then stretched the inline-block so its child
   sat flush at the top of the row. Both are gone; centering now comes purely
   from the flex chain. */
.cp-header .cp-h-item > form {
  display: flex;
  align-items: center;
}
