/* =========================================================================
 * Gestión de Jaulas — estilos alineados a hospitalizado (configTratamiento.css)
 * Paleta neutra --gj-* espejo de --ct-* (visor / workspace / nuevo ingreso).
 * ========================================================================= */
#pantallaGestionJaulas {
  --gj-primary: #1a6fc4;
  --gj-success: #198754;
  --gj-danger: #dc3545;
  --gj-warning: #f0ad4e;
  --gj-muted: #6c757d;
  --gj-bg: #f4f6f9;
  --gj-card-bg: #ffffff;
  --gj-header: #1c2a3a;
  --gj-border: #dee2e6;
  --gj-radio: 10px;
  --gj-sombra: 0 2px 6px rgba(28, 42, 58, 0.08);

  background: var(--gj-bg);
  min-height: 100%;
  padding-bottom: 24px;
  color: var(--gj-header);
}

/* Botón actualizar en el header */
#pantallaGestionJaulas .gj-btn-refrescar {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

#pantallaGestionJaulas .gj-btn-refrescar:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Contenido */
#pantallaGestionJaulas .gj-contenido {
  padding: 14px;
}

#pantallaGestionJaulas .gj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 16px;
}

/* Tarjeta de hospital */
#pantallaGestionJaulas .gj-card {
  background: var(--gj-card-bg);
  border: 1px solid var(--gj-border);
  border-radius: var(--gj-radio);
  box-shadow: var(--gj-sombra);
  padding: 16px 18px;
}

#pantallaGestionJaulas .gj-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

#pantallaGestionJaulas .gj-card-titulo {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--gj-primary);
}

#pantallaGestionJaulas .gj-card-notas {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--gj-muted);
}

#pantallaGestionJaulas .gj-badge-total {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--gj-muted);
  border: 1px solid var(--gj-border);
  border-radius: 20px;
  padding: 4px 12px;
  background: #f8f9fa;
}

/* Stats libres / ocupadas */
#pantallaGestionJaulas .gj-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

#pantallaGestionJaulas .gj-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#pantallaGestionJaulas .gj-badge--libre {
  background: #d1e7dd;
  color: #0f5132;
}

#pantallaGestionJaulas .gj-badge--libre.gj-badge--warning {
  background: #fff3cd;
  color: #664d03;
}

#pantallaGestionJaulas .gj-badge--libre.gj-badge--danger {
  background: #f8d7da;
  color: #842029;
}

#pantallaGestionJaulas .gj-badge--ocupada {
  background: #f8d7da;
  color: #842029;
}

/* Grilla de jaulas */
#pantallaGestionJaulas .gj-jaulas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

#pantallaGestionJaulas .gj-jaula {
  position: relative;
  border: 1px solid var(--gj-border);
  border-radius: 8px;
  padding: 10px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  /* borde-izquierdo de estado vía pseudo-elemento (no plano) */
  border-left-width: 1px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease;
}

/* Barra de estado lateral intencional (reemplaza el border-left plano) */
#pantallaGestionJaulas .gj-jaula::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
}

/* Jaula libre — limpia, ligera, "disponible" */
#pantallaGestionJaulas .gj-jaula--libre {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fbfdfc;
  border-color: #cfe6da;
}

#pantallaGestionJaulas .gj-jaula--libre::before {
  background: var(--gj-success);
  opacity: 0.55;
}

#pantallaGestionJaulas .gj-jaula--libre:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.14);
  border-color: #a9d4bf;
}

#pantallaGestionJaulas .gj-jaula--libre:hover::before {
  opacity: 1;
}

#pantallaGestionJaulas .gj-jaula-libre-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--gj-success);
}

#pantallaGestionJaulas .gj-jaula-libre-txt {
  margin-top: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gj-muted);
  letter-spacing: 0.5px;
}

/* Jaula ocupada — pesa más: fondo blanco + sombra + acento rojo */
#pantallaGestionJaulas .gj-jaula--ocupada {
  background: #fff;
  border-color: var(--gj-border);
  box-shadow: var(--gj-sombra);
}

#pantallaGestionJaulas .gj-jaula--ocupada::before {
  background: var(--gj-danger);
}

#pantallaGestionJaulas .gj-jaula--ocupada:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(220, 53, 69, 0.16);
  border-color: #f1c2c7;
}

/* El contenido de la ocupada respira a la derecha de la barra de estado */
#pantallaGestionJaulas .gj-jaula--ocupada {
  padding-left: 12px;
}

#pantallaGestionJaulas .gj-jaula-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#pantallaGestionJaulas .gj-jaula-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
  background: var(--gj-danger);
  border-radius: 5px;
  padding: 2px 8px;
  box-shadow: 0 1px 2px rgba(220, 53, 69, 0.3);
}

#pantallaGestionJaulas .gj-jaula-mascota {
  font-size: 13px;
  font-weight: 700;
  color: var(--gj-header);
  margin: 7px 0;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pantallaGestionJaulas .gj-jaula-mascota i {
  flex-shrink: 0;
  color: var(--gj-primary);
  opacity: 0.75;
  margin-right: 0;
}

#pantallaGestionJaulas .gj-jaula-acciones {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

/* Botones de acción icon-only (texto en tooltip via title) */
#pantallaGestionJaulas .gj-accion {
  flex: 1;
  min-width: 0;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border-radius: 6px;
  padding: 6px 4px;
  cursor: pointer;
  border: 1px solid var(--gj-border);
  background: #fff;
  color: var(--gj-muted);
  transition: background 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

#pantallaGestionJaulas .gj-accion i {
  font-size: 14px;
  line-height: 1;
}

#pantallaGestionJaulas .gj-accion:active {
  transform: translateY(1px);
}

#pantallaGestionJaulas .gj-accion:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 111, 196, 0.25);
}

#pantallaGestionJaulas .gj-accion--mover {
  border-color: var(--gj-warning);
  color: #8a5a00;
}

#pantallaGestionJaulas .gj-accion--mover:hover {
  background: var(--gj-warning);
  border-color: var(--gj-warning);
  color: #fff;
  box-shadow: 0 2px 6px rgba(240, 173, 78, 0.35);
}

#pantallaGestionJaulas .gj-accion--mover:active {
  background: #e09a3a;
}

#pantallaGestionJaulas .gj-accion--trat {
  border-color: var(--gj-primary);
  color: var(--gj-primary);
}

#pantallaGestionJaulas .gj-accion--trat:hover {
  background: var(--gj-primary);
  border-color: var(--gj-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(26, 111, 196, 0.35);
}

#pantallaGestionJaulas .gj-accion--trat:active {
  background: #155a9e;
}

/* Estados vacíos / carga */
#pantallaGestionJaulas .gj-estado,
#pantallaGestionJaulas .gj-vacio {
  text-align: center;
  padding: 40px 20px;
  color: var(--gj-muted);
}

#pantallaGestionJaulas .gj-estado--sm {
  padding: 14px;
}

#pantallaGestionJaulas .gj-vacio i {
  font-size: 32px;
  color: var(--gj-border);
  margin-bottom: 8px;
  display: block;
}

#pantallaGestionJaulas .gj-sin-jaulas {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: var(--gj-muted);
  padding: 14px;
  background: #f8f9fa;
  border-radius: 6px;
}

/* =========================================================================
 * Modal mover de jaula (overlay propio, sin Bootstrap JS)
 * ========================================================================= */
.gj-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1080;
  background: rgba(28, 42, 58, 0.55);
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.gj-modal.gj-modal--abierto {
  display: flex;
}

.gj-modal .gj-modal-dialog {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.gj-modal .gj-modal-header {
  background: #1a6fc4;
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gj-modal .gj-modal-titulo {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.gj-modal .gj-modal-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.gj-modal .gj-modal-body {
  padding: 18px;
}

.gj-modal .gj-actual {
  background: #f4f6f9;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #2d3748;
  margin-bottom: 14px;
}

.gj-modal .gj-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 5px;
}

.gj-modal .gj-label--mt {
  margin-top: 14px;
}

.gj-modal .gj-hint {
  display: block;
  font-size: 11px;
  color: #6c757d;
  margin-bottom: 8px;
}

.gj-modal .gj-select {
  width: 100%;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #2d3748;
  background: #fff;
}

.gj-modal .gj-select:focus {
  outline: none;
  border-color: #1a6fc4;
  box-shadow: 0 0 0 2px rgba(26, 111, 196, 0.15);
}

.gj-modal .gj-jaulas-libres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 10px;
  min-height: 54px;
}

.gj-modal .gj-jaula-libre-btn {
  border: 1px solid #1a6fc4;
  color: #1a6fc4;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gj-modal .gj-jaula-libre-btn:hover {
  background: #1a6fc4;
  color: #fff;
}

.gj-modal .gj-sin-libres {
  margin: 0;
  font-size: 13px;
  color: #6c757d;
}

.gj-modal .gj-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid #dee2e6;
  text-align: right;
}

.gj-modal .gj-btn-cerrar {
  border: 1px solid #dee2e6;
  background: #fff;
  color: #6c757d;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 7px 16px;
  cursor: pointer;
}

.gj-modal .gj-btn-cerrar:hover {
  background: #f4f6f9;
}

/* Bloqueo del scroll de fondo (el scroll vive en .container-scroller) */
body.gj-no-scroll .container-scroller {
  overflow: hidden;
}

/* Responsive */
@media (max-width: 600px) {
  #pantallaGestionJaulas .gj-grid {
    grid-template-columns: 1fr;
  }
}
