/* ===== Utilidades existentes ===== */
.w-60px {
  width: 60px;
}
.w-90px {
  width: 90px;
}
.w-120px {
  width: 120px;
}
.w-140px {
  width: 140px;
}
.w-200px {
  width: 200px;
}
.w-220px {
  width: 220px;
}
.h-6px {
  height: 6px;
}

.mw-560 {
  max-width: 560px;
}
.mw-620 {
  max-width: 620px;
}
.mw-720 {
  max-width: 720px;
}
.mw-840 {
  max-width: 840px;
}
.max-w-10rem {
  max-width: 10rem;
}

.pre-wrap {
  white-space: pre-wrap;
}

/* ===== Helpers % width (CSP-safe) ===== */
.w-pct-0 {
  width: 0%;
}
.w-pct-5 {
  width: 5%;
}
.w-pct-10 {
  width: 10%;
}
.w-pct-15 {
  width: 15%;
}
.w-pct-20 {
  width: 20%;
}
.w-pct-25 {
  width: 25%;
}
.w-pct-30 {
  width: 30%;
}
.w-pct-35 {
  width: 35%;
}
.w-pct-40 {
  width: 40%;
}
.w-pct-45 {
  width: 45%;
}
.w-pct-50 {
  width: 50%;
}
.w-pct-55 {
  width: 55%;
}
.w-pct-60 {
  width: 60%;
}
.w-pct-65 {
  width: 65%;
}
.w-pct-70 {
  width: 70%;
}
.w-pct-75 {
  width: 75%;
}
.w-pct-80 {
  width: 80%;
}
.w-pct-85 {
  width: 85%;
}
.w-pct-90 {
  width: 90%;
}
.w-pct-95 {
  width: 95%;
}
.w-pct-100 {
  width: 100%;
}

/* ===== Progreso ===== */
.progress.thin {
  height: 6px;
}
.progress .progress-bar {
  transition: width 0.2s ease;
}

/* ===== Sombra suave para tarjetas ===== */
.shadow-soft {
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.06),
    0 0.125rem 0.25rem rgba(0, 0, 0, 0.04);
}

/* ===== Ajustes auth / utilidades ===== */
.centered {
  margin-left: auto;
  margin-right: auto;
}

/* Mejor padding al usar formularios como tarjeta */
.card-form .card-body {
  padding: 1.25rem;
}
@media (min-width: 576px) {
  .card-form .card-body {
    padding: 1.5rem 1.75rem;
  }
}

/* Inputs un poco más altos */
.form-control-lg {
  min-height: 3rem;
}

/* reCAPTCHA badge por encima */
.grecaptcha-badge {
  z-index: 10;
}

/* Quitar borde cuando se usa .border-0 en cards */
.card.border-0 {
  border: 0 !important;
}

/* ===== Tabla móvil (encabezados como data-label) ===== */
@media (max-width: 767.98px) {
  .table-mobile thead {
    display: none;
  }
  .table-mobile tbody tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
  }
  .table-mobile tbody tr + tr {
    margin-top: 0.75rem;
  }
  .table-mobile td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    border-top: 0;
  }
  .table-mobile td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--bs-secondary-color);
    margin-right: 1rem;
  }
}

/* ===== Quiz options as cards ===== */
.form-check.choice {
  position: relative;
  padding: 0;
  border: 0;
}
.choice-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.choice-label {
  display: block;
  padding: 0.9rem 1rem 0.9rem 2.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.65rem;
  background: var(--bs-body-bg);
  line-height: 1.35;
  transition: transform 0.12s ease, border-color 0.12s ease,
    background-color 0.12s ease, box-shadow 0.12s ease;
  position: relative;
}
/* círculo “radio” personalizado */
.choice-label::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 1.05rem;
  height: 1.05rem;
  transform: translateY(-50%);
  border-radius: 50%;
  border: 2px solid var(--bs-secondary-color);
  background: transparent;
}
/* hover/focus */
.choice-label:hover {
  border-color: color-mix(
    in srgb,
    var(--bs-primary) 35%,
    var(--bs-border-color)
  );
  transform: translateY(-1px);
}
.choice-input:focus-visible + .choice-label {
  box-shadow: 0 0 0 0.25rem
    color-mix(in srgb, var(--bs-primary) 25%, transparent);
  border-color: var(--bs-primary);
}
/* seleccionado */
.choice-input:checked + .choice-label {
  border-color: var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 7%, transparent);
}
.choice-input:checked + .choice-label::before {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem
    color-mix(in srgb, var(--bs-primary) 25%, transparent);
}

/* ===== Home: tabla de temas -> Acciones (DESKTOP/TABLET por defecto) ===== */
.topics-table .td-actions {
  text-align: right;
} /* alinear a la derecha en desktop */
.topics-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap; /* evita salto entre input y botón */
}
.topics-actions .input-group {
  width: auto;
  max-width: 9rem;
} /* ~144px */
.topics-actions .form-control {
  width: 4.5rem; /* ~75px; suficiente para 3 dígitos */
  min-width: 3.5rem;
}

/* ===== Home: Acciones (MÓVIL) ===== */
@media (max-width: 575.98px) {
  .td-actions {
    display: block !important;
  } /* que la celda sea bloque */
  .topics-actions {
    display: grid !important;
    grid-template-columns: 1fr auto; /* input crece, botón contenido */
    gap: 0.5rem;
    width: 100%;
    justify-content: stretch;
  }
  .topics-actions .input-group {
    width: 100%;
    max-width: none;
  } /* anula límite */
  .input-group-compact .input-group-text {
    padding: 0.25rem 0.5rem;
  }
  .input-group-compact .form-control {
    padding: 0.25rem 0.5rem;
  }
}

/* pantallas MUY estrechas: botón debajo del input */
@media (max-width: 380px) {
  .topics-actions {
    grid-template-columns: 1fr;
  }
  .topics-actions .btn {
    width: 100%;
  }
}

/* ===== Navbar Pro (desktop estable + móvil offcanvas) ===== */
.navbar .navbar-brand {
  font-weight: 600;
}

/* No cortar items en desktop */
.navbar-nav.flex-row {
  flex-wrap: nowrap;
}
.navbar .navbar-nav .nav-link,
.navbar .btn {
  white-space: nowrap;
} /* evita saltos feos */

@media (min-width: 992px) {
  .navbar .container {
    gap: 0.5rem;
  }
  .navbar .d-lg-flex {
    flex-wrap: nowrap;
  }
  .navbar .navbar-nav {
    gap: 0.25rem;
  } /* aire entre items en desktop */
}

/* Toggler un poco más cómodo */
.navbar-toggler {
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
}

/* Truncado elegante para el email en el botón usuario (desktop) */
.truncate-email {
  max-width: 240px; /* ajusta si lo necesitas */
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
@media (min-width: 1200px) {
  .truncate-email {
    max-width: 300px;
  }
}

/* Badges con ancho mínimo (siempre legibles) */
.badge-min {
  min-width: 1.5rem;
  display: inline-flex;
  justify-content: center;
}

/* Offcanvas estilos */
.offcanvas-nav {
  width: 320px;
}
.offcanvas-nav .offcanvas-header {
  border-bottom: 1px solid var(--bs-border-color);
}
.offcanvas-nav .list-group-item {
  border-left: 0;
  border-right: 0;
}
.offcanvas-nav .list-group-item:first-child {
  border-top: 0;
}

/* Avatar con inicial + escudo admin */
.avatar-initial {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bs-primary);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  background: var(--bs-body-bg);
  border-radius: 50%;
  padding: 0;
  line-height: 1;
}

/* ===== Inputs numéricos junto a spinner ===== */
.td-actions .n-input {
  text-align: center;
  padding-right: 1rem; /* hueco para las flechas */
}
/* Firefox necesita un pelín más */
@-moz-document url-prefix() {
  .td-actions .n-input {
    padding-right: 1rem;
  }
}
