/* Custom form field styles: checkbox buttons
   Usage:
   <label class="checkbox-btn">
     <input type="checkbox" class="form-check-input" name="foo" />
     <span>Ativar opção</span>
   </label>

   Place this file after Bootstrap in your templates (e.g. in base.html) so it
   can override Bootstrap defaults when needed.
*/

.checkbox-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  user-select: none;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
  white-space: nowrap; /* prevent label text wrapping above the checkbox */
  flex-wrap: nowrap;
}

.checkbox-btn:hover {
  background-color: #f8f9fa;
}

.checkbox-btn .form-check-input {
  /* keep native checkbox visible but tightened */
  margin: 0;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: middle;
}

.checkbox-btn span {
  display: inline-block;
  line-height: 1;
  color: #495057;
  margin-left: 1rem; /* push text further to the right of the checkbox (increased) */
}

/* Style when checkbox is checked — use sibling selector
   markup must be: <input class="form-check-input"> <span>Label</span>
*/
.checkbox-btn .form-check-input:checked + span {
  color: #1e7e34; /* green-ish */
  font-weight: 600;
}

.checkbox-btn .form-check-input:focus {
  outline: none;
  box-shadow: 0 0 0 .15rem rgba(0,123,255,.15);
}

/* Variant: smaller padding for compact forms */
.checkbox-btn-sm {
  padding: 0.2rem 0.45rem;
  gap: 0.4rem;
}

/* When using inside form groups keep block layout on small screens */
@media (max-width: 575.98px) {
  .checkbox-btn {
    display: inline-flex;
  }
}

/* Make checkboxes in the tournament form visually larger without affecting other forms */
form#tournament-form .form-check-input {
  width: 1.6rem !important;
  height: 1.6rem !important;
  margin-top: 0.15rem; /* nudge for vertical alignment with label */
  vertical-align: middle;
  appearance: checkbox;
  -webkit-appearance: checkbox;
}

/* For browsers that render custom checkboxes, scale the element smoothly */
form#tournament-form .form-check-input::before,
form#tournament-form .form-check-input::after {
  box-sizing: border-box;
}

/* Small help icon used next to labels (e.g. "Dica" replacement) */
.help-icon {
  color: #6c757d; /* muted */
  font-size: 0.95rem;
  line-height: 1;
  vertical-align: middle;
}
.help-icon i {
  pointer-events: none;
}
.help-icon:hover {
  color: #495057;
  text-decoration: none;
}

/* Toggle switch for boolean fields (compact, accessible) */
.toggle-switch {
  display: inline-block;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
}
.toggle-switch input[type="checkbox"] {
  /* keep the native input for form submission and a11y, but visually hide it */
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
}
.toggle-switch .toggle-slider {
  display: inline-block;
  width: 44px;
  height: 24px;
  background: #d6d8db;
  border-radius: 999px;
  position: relative;
  transition: background .12s ease;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03);
}
.toggle-switch .toggle-slider::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: left .12s ease, transform .12s ease;
}
.toggle-switch input[type="checkbox"]:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(0,123,255,0.12);
}
.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
  background: #28a745; /* green */
}
.toggle-switch input[type="checkbox"]:checked + .toggle-slider::after {
  left: 23px;
}
/* no textual label for toggle by default */
