* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f2f6f9;
}

.container {
  background: white;
  padding: 0 40px 40px 40px; /* padding-top 0, padding-left y right 40px, padding-bottom 40px */
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  width: 99%;
  max-width: 3800px;
  margin: 0 auto;
}

h1 {
  margin-top: 0;
  margin-bottom: 10px;
}

p {
  color: #666;
  margin-bottom: 30px;
}

.buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

button {
  padding: 15px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

#crearSala {
  background: #2ecc71;
  color: white;
}

#crearSala:hover {
  background: #27ae60;
}

#unirseSala {
  background: #3498db;
  color: white;
}

#unirseSala:hover {
  background: #2980b9;
}

input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  font-size: 15px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.buttons button,
form button,
#guardarSanitarios,
#crearSala,
#unirseSala {
  width: 100%;
}

.volver {
  display: inline-block;
  width: fit-content;
  margin-top: 20px;
  text-decoration: none;
  color: #3498db;
  font-size: 14px;
}

/* Formularios de configuración */
#formSanitario {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#formSanitario input,
#formSanitario select {
  flex: 1;
}

.numero-sanitarios {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
}

.numero-sanitarios label {
  display: flex;
  flex-direction: column;
  font-weight: bold;
}

#formulariosNombres {
  margin-top: 15px;
  margin-bottom: 15px;
}

#formulariosNombres input {
  display: block;
  margin-bottom: 10px;
  padding: 8px;
  width: 100%;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* Panel de contadores */
#listaSanitarios {
  display: flex;
  flex-direction: column;
  gap: 10px;
}


.sanitario {
  display: flex;
  align-items: center;
  justify-content: space-between;

  width: 100%;
  padding: 12px 15px;

  background: #f7f9fc;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  font-weight: bold;
}

.sanitario span {
  flex: 1;
  text-align: left;
  
}

.sanitario:not(:last-child) {
  border-bottom: 1px solid #e5e8ec;
}



.sanitario.medico {
  border-left: 5px solid #2ecc71;
}

.sanitario.enfermera {
  border-left: 5px solid #3498db;
}

.sanitario.pediatra {
  border-left: 5px solid #f39c12; /* naranja suave */
}


.controles {
  display: flex;
  align-items: center;
  gap: 10px;
}

.controles button {
  width: 40px;
  height: 40px;
  font-size: 20px;
  border-radius: 50%;
  background: #ddd;
  display: flex;             
  align-items: center;        
  justify-content: center;    
  padding: 0; 
}

.controles button:hover {
  background: #ccc;
}

@media (max-width: 800px) {
  .sanitario {
    flex: 0 0 calc(50% - 10px);
  }
}

@media (max-width: 500px) {
  .sanitario {
    flex: 0 0 100%;
  }
}

/* ---------- PANEL DE EDICIÓN ---------- */
#panelEdicion {
  width: 100%;
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  background: #f7f9fc;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  /*text-align: left;*/
}

#listaEdicion,
.acciones-edicion {
  text-align: left;
}

#panelEdicion h2 {
  text-align: center;
  margin-bottom: 20px;
}

#listaEdicion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fila-edicion {
  display: grid;
  grid-template-columns: 1fr 120px 40px 40px;
  gap: 10px;
  align-items: center;
  background: white;
  padding: 10px;
  border-radius: 8px;
}

.fila-edicion input,
.fila-edicion select {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.fila-edicion button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.acciones-edicion {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

#btnAgregarSanitario {
  background: #2ecc71;
  color: white;
}

#btnCerrarEdicion {
  background: #e74c3c;
  color: white;
}

/* 🔧 Alineación perfecta panel edición */

.fila-edicion {
  display: grid;
  grid-template-columns: 1fr 120px 40px 40px;
  gap: 10px;
  align-items: center;
}

.fila-edicion input,
.fila-edicion select,
.fila-edicion button {
  height: 38px;
  line-height: 38px;
  padding: 0 8px;
  box-sizing: border-box;
}

.fila-edicion button {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 🔧 FIX alineación panel edición */
.fila-edicion input,
.fila-edicion select {
  margin-bottom: 0;
  height: 38px;
}

.fila-edicion button {
  height: 38px;
}

.btn-casa {
  margin-top: 0;
  margin-left: 10px;
}



.btn-casa:hover {
  background: #f0f0f0;
}

.btn-casa.activo {
  background: #e74c3c;
  border-color: #c0392b;
  color: white;
}

/* Estado visual cuando está en casa */
.sanitario.en-casa {
  opacity: 0.6;
}

.sanitario.en-casa .controles button {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ---------- OBSERVACIONES ---------- */

.panelObservaciones {
  width: 100%;
  margin-bottom: 20px;
  text-align: left;
}

.panelObservaciones h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.panelObservaciones textarea {
  width: 100%;
  min-height: 2.2em;     
  padding: 6px 10px; 
  box-sizing: border-box;    
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #ccc;
  line-height: 1.4;
  background-color: #fff1f3;
  resize: none;        
  overflow: hidden; 
     
}

.panelObservaciones textarea:focus {
  outline: none;
  border-color: #e07a8c;
  background-color: #ffe6ea;
}





#panelListas {
  display: flex;
  gap: 20px;
  width: 100%;
}

.columna {
  flex: 1;
}

.columna h3 {
  margin: 5px 0 10px;
  font-size: 15px;
  text-align: left;
  color: #555;
}

/* Las listas siguen siendo en columna */
#listaMedicos,
#listaEnfermeras {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 800px) {
  #panelListas {
    flex-direction: column;
  }
}

.columna {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sanitario.ausente {
  opacity: 0.5;
}

.btn-ausente.activo {
  background-color: #ffe599;
}

.btn-casa,
.btn-ausente {
  margin-left: 4px;   /* puedes poner 2px si quieres menos */
}

.btn-casa,
.btn-ausente {
  width: 40px;
  height: 40px;        /* ← aquí está el ajuste de 1px */
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.controles strong {
  font-size: 24px;
  font-weight: bold;
  min-width: 32px;
  height: 40px;
  line-height: 40px;   /* misma altura que los botones */
  text-align: center;
  display: inline-block;
}
.controles {
  gap: 5px;
}
.descripcion {
  border: 2px solid red;      /* Borde rojo */
  border-radius: 10px;        /* Bordes redondeados como los botones */
  padding: 15px;              /* Espacio interno */
  margin-top: 20px;           /* Separación de los botones */
  background-color: #ffe5e5;  /* Fondo suave para que resalte */
  text-align: center;         /* Centrar texto */
  font-family: Arial, sans-serif;
  font-size: 16px;
  color: #b30000;             /* Texto en rojo oscuro */
  box-shadow: 2px 2px 8px rgba(0,0,0,0.2); /* Sombra ligera */
}

.panel-botones {
  display: flex;
  justify-content: center;  /* 👈 los 3 centrados como grupo */
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}
/* Flechas de desplazamiento invisibles cuando están deshabilitadas */
.btn-subir:disabled,
.btn-bajar:disabled {
  visibility: hidden;
}

.panel-editar-sala {
  position: fixed;
  top: 15%;
  left: 25%;
  width: 50%;
  background: #fff;
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 1000;
}

/* Inputs y labels más agradables */
.panel-editar-sala label {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
  font-weight: 600;
}

.panel-editar-sala input {
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 16px;
}

/* Botones */
.panel-editar-sala .acciones {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}


.cabecera-sala {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

#nombreSala {
  text-align: center;
}


.btn-telefonos {
  white-space: nowrap;
  cursor: pointer;
}

/* ---------- POPUPS GENERALES ---------- */
/* Popup listado telefónico */
.popup,
#panelTelefonos {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  max-width: 600px;
  background: #fff;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 2000;

  max-height: 80vh;
  overflow-y: auto;
  font-size: 1.5em;
}

/* Listado teléfonos */
#listaTelefonos {
  width: 100%;
  margin-top: 20px;
  margin-bottom: 20px;
}


/* Botón cerrar centrado */
#cerrarPopupTelefonos {
  display: block;
  margin: 30px auto 0 auto;
  padding: 12px 25px;
  font-size: 1.2em;
  border-radius: 8px;
  background-color: #e74c3c;
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

#cerrarPopupTelefonos:hover {
  background-color: #c0392b;
}

#btnTelefonos {
  margin: 6px 0 0 0;
  padding: 10px 10px;     /* menos alto */
  font-size: 0.9em;      /* texto un poco más pequeño */
  line-height: 1.2;      /* evita que crezca en vertical */
  background-color: #d6ecff;  /* azul claro */
  color: #003a66;
  border: 1px solid #a9d3f5;
}







/* Teléfonos: nombre + número al 50% */
#listaTelefonosEdicion .fila-edicion {
  display: grid;
  grid-template-columns: 1fr 1fr 40px 40px;
  gap: 10px;
  align-items: center;
}

#listaTelefonosEdicion input {
  width: 100%;
  margin-bottom: 0;
}

/* Inputs del listado telefónico en edición */
#listaTelefonosEdicion .fila-edicion {
  display: flex;
  gap: 10px;
  align-items: center;
}

#listaTelefonosEdicion .fila-edicion input[data-campo="nombre"],
#listaTelefonosEdicion .fila-edicion input[data-campo="numero"] {
  flex: 1;           /* Cada input ocupa la mitad */
  padding: 8px;
  font-size: 15px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

#formCrearSala input {
  text-align: left;
}

/* ===== LISTADO TELEFÓNICO (VISUALIZACIÓN) ===== */

#listaTelefonos {
  display: flex;
  flex-direction: column;
  gap: 0;                 /* sin huecos extra */
  margin-top: 20px;
}

/* Cada línea: nombre | número */
.telefono {
  display: grid;
  grid-template-columns: 1fr 140px;
  align-items: center;

  padding: 10px 16px;     /* un poco más compacto */
  border-radius: 6px;
}

/* Sombreado alterno verde / azul */
.telefono:nth-child(odd) {
  background-color: #e8f5e9; /* verde suave */
}

.telefono:nth-child(even) {
  background-color: #e3f2fd; /* azul suave */
}

/* Nombre */
.telefono strong {
  font-size: 0.85em;      /* 👈 más pequeño */
  font-weight: 600;
  text-align: left;
  color: #000;            /* negro */
}

/* Número */
.telefono span {
  font-size: 1.17em;      /* 👈 un poco más grande que el nombre */
  font-family: monospace;
  font-weight: 700;
  text-align: right;
  min-width: 120px;
  color: #000;            /* negro */
}
