:root {
  --color-fondo: #f5f5f5;
  --color-principal: #3498db;
  --color-principal-hover: #2471a3;
  --color-texto: #333;
  --color-titulo: #2c3e50;
  --color-tabla-encabezado: #3498db;
  --color-tabla-fila-par: #f0f8ff;
  --fuente-principal: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --borde-general: 1px solid #ccc;
  --sombra-suave: 0px 2px 8px rgba(0,0,0,0.1);
}

/* Estilos generales */
body {
  font-family: var(--fuente-principal);
  background-color: var(--color-fondo);
  margin: 0;
  padding: 20px;
  color: var(--color-texto);
}

/* Encabezado */
header {
  text-align: center;
  margin-bottom: 30px;
}

/* Encabezados de fecha-hora */
th.fecha-hora {
  font-size: 0.8rem; /* Más pequeño */
  line-height: 1.2;
  word-break: break-word;
  white-space: normal;
}


h1 {
  font-size: 2rem;
  color: var(--color-titulo);
}

/* Secciones */
main {
  max-width: 1100px; /* <<< Aumentamos el ancho para la nueva tabla */
  margin: 0 auto;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--sombra-suave);
}

section {
  margin-bottom: 30px;
}

/* Formulario */
form {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px 20px;
  align-items: center;
  grid-auto-rows: minmax(40px, auto);
}

label {
  font-weight: bold;
}

input[type="date"],
input[type="number"],
input[type="time"],
select {
  width: 100%;
  padding: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

button {
  grid-column: span 2;
  padding: 10px;
  margin-top: 10px;
  background-color: var(--color-principal);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: var(--color-principal-hover);
}

/* Tabla de evolución */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  table-layout: fixed;
  box-shadow: var(--sombra-suave);
  border-radius: 5px;
  overflow: hidden;
}

thead {
  background-color: var(--color-tabla-encabezado);
  color: white;
}

th, td {
  padding: 10px;
  border: var(--borde-general);
  text-align: center;
  vertical-align: middle;
  word-wrap: break-word;
}

/* Ajustes de ancho de columnas */
th:first-child, td:first-child { /* Estudio */
  width: 150px;
}
th:nth-child(2), td:nth-child(2) { /* Tipo */
  width: 200px;
}
th:nth-last-child(1), td:nth-last-child(1) { /* Referencia */
  width: 120px;
}
th:nth-child(n+3):not(:last-child),
td:nth-child(n+3):not(:last-child) { /* Fechas dinámicas */
  width: 80px;
}

/* Colores alternos y efecto hover */
tbody tr:nth-child(even) {
  background-color: var(--color-tabla-fila-par);
}

tbody tr:hover {
  background-color: #e8f4fc;
}

.valor-fuera-de-rango {
  color: red;
  font-weight: bold;
}

/* Botones de eliminar registro individual */
.boton-borrar {
  background-color: #e74c3c; /* Fondo rojo suave */
  border: none;
  color: white;
  width: 30px; /* <<< tamaño mínimo */
  height: 30px; /* <<< tamaño mínimo */
  font-size: 1.2rem;
  border-radius: 50%; /* <<< que sea redondo */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin: auto;
}

.boton-borrar:hover {
  background-color: #c0392b; /* Más oscuro al pasar el mouse */
}

#btnCerrarGrafico {
  background-color: var(--color-principal);
  color: white;
  border: none;
  padding: 8px 16px;
  font-size: 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#btnCerrarGrafico:hover {
  background-color: var(--color-principal-hover);
}

/* Contenedor para los botones de acción */
.contenedor-acciones {
  display: flex;
  gap: 8px; /* <<< separación entre botones */
  justify-content: center;
  align-items: center;
}

.boton-ver-grafico {
  background-color: #2ecc71; /* Verde claro para diferenciar */
  color: white;
  border: none;
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px; /* separación entre icono y texto */
  margin: auto;
}

.boton-ver-grafico:hover {
  background-color: #27ae60; /* Verde más oscuro en hover */
}
