/* style.css: Estilos tipo Google Calendar y colores por estación con separación entre citas */

/* --- RESET BÁSICO --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Arial, sans-serif;
  background: #fafafa;
  overflow: hidden;
}

/* --- NAVEGACIÓN --- */
.date-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 5;
}
.date-navigation button {
  background: none;
  border: none;
  font-size: 14px;
  padding: 6px 12px;
  margin: 0 5px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}
.date-navigation button:hover {
  background: #efefef;
}
#current-date {
  margin: 0 15px;
  font-size: 16px;
  font-weight: 500;
}

/* --- CONTENEDOR PRINCIPAL --- */
.agenda-container {
  position: absolute;
  top: 50px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: auto;
}

/* --- GRID DE LA AGENDA --- */
.agenda-grid {
  display: grid;
  grid-template-columns: 80px repeat(var(--n-estaciones), 1fr);
}

/* --- ENCABEZADOS DE COLUMNAS (Horarios y Estaciones) --- */
.agenda-grid .header {
  background: #bed7e6;
  padding: 8px;
  border-bottom: 1px solid #f7f3f3;
  font-weight: 500;
  font-size: 14px;
  text-align: center;
  position: sticky;
  top: 1px; /* Debajo de la barra de navegación */
  z-index: 4;
}

/*
/* 1) Fija la cabecera “Estación” */
.agenda-grid .header.estacion-header {
 /* position: sticky;
  left: 0;
 /* top: 40px;           /* tu altura de header de fecha */
  z-index: 5;          /* más alto que las demás headers */
  background: #f5f5f5; /* mismo fondo que las otras cabeceras */
}

/* 2) Fija todas las etiquetas de fila */
.agenda-grid .station-label {
  position: sticky;
  left: 0;
  z-index: 4;          /* por debajo de la cabecera, pero encima de los slots */
  background: #fafafa; /* el mismo fondo que las celdas de estación */
}

/* 3) Asegúrate de que el contenedor es el que hace scroll */
.agenda-container {
  height: calc(100vh - 50px);
  overflow-y: auto;
  position: relative;
  
  
 /*overflow: auto;      /* scroll en ambos ejes */
}

.agenda-grid .header {
  position: sticky;
  top: 0;
  background: #f5f5f5;
  z-index: 3;
}




/* --- RÓTULO DE DÍA (fila completa) --- */
.day-header {
  background: #f1f3f4;
  padding: 6px 0;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 10px; /* Debajo de la barra de navegación + encabezados */
  
  z-index: 3;
  grid-column: 2 / span var(--n-estaciones);
}

/* --- COLS DE HORA --- */
.agenda-grid .hora {
  background: #fff;
  text-align: right;
  padding-right: 10px;
  font-size: 12px;
  color: #666;
  border-bottom: 1px solid #eee;
  border-right: 1px solid #eee;
  position: sticky;
  left: 0;
  z-index: 3;
}

/* --- CELDAS DE SLOT --- */
.agenda-grid .slot {
  background: #fff;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
  position: relative;
  height: 100px;
  cursor: pointer;
  transition: background 0.2s;
}
.agenda-grid .slot:hover {
  background: #f5f5f5;
}

.agenda-grid .header:first-child {
  position: sticky;
  left: 0;
  background: #f5f5f5;
  z-index: 3;
  border-right: 2px solid #ddd;
}
.agenda-grid {
  display: grid;
  overflow-x: auto;    /* <— aquí movemos el overflow */
  overflow-y: visible; /* solo el padre vertical */
  position: relative;  /* para que sticky calcule relativo a este */
  /* grid-template-columns lo estableces dinámicamente en JS */
}


/* --- CITAS --- */
.cita {
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  margin-bottom: 4px;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1.2;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  cursor: move;
  z-index: 2;
}

/* Colores específicos por estación */
.slot[data-estacion="Resonancia 1"] .cita { background: #3367d6; }
.slot[data-estacion="Resonancia 2"] .cita { background: #3c8dbc; }
.slot[data-estacion="Tomografía 1"] .cita { background: #0f9d58; }
.slot[data-estacion="Neurología"]    .cita { background: #f9ab00; }

/* --- MODAL --- */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-content {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1001;
}
.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 18px;
  cursor: pointer;
}

/* --- FORMULARIO --- */
#cita-form {
  display: flex;
  flex-direction: column;
}
#cita-form label {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 500;
}
#cita-form input[type="text"],
#cita-form select,
#cita-form textarea {
  margin-top: 4px;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
#cita-form button {
  margin-top: 15px;
  padding: 8px 12px;
  font-size: 14px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
#cita-form button:hover {
  background: #1669c1;
}
.slot.disabled {
    background: #f0f0f0;
    cursor: not-allowed;
  }
  .slot.disabled:hover {
    background: #f0f0f0;
  }
  /* Estilo general para etiqueta de estación */
.station-label {
 
  font-weight: 500;
  padding: 8px 4px;
  font-size: 0.80em;
  border-spacing: 4px;
  top: 5px;
  
  left: 2px;
  right: 2px;
  margin-bottom: 4px;
  border-radius: 4px;
}

.cita {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2px 4px;
}

.cita-paciente {
  font-weight: bold;
  font-size: 0.9em;
  line-height: 1.1;
}

.cita-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75em;
  opacity: 0.85;
  margin-top: 2px;
}

.cita-tipo {
  font-style: italic;
}

.cita-horario {
  /* opcional: poner en monospace para alinear bien */
  font-family: monospace;
}

.hidden { display: none; }
/* Ajusta estilo del select múltiple si quieres */
.slot.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Colores por estación */
.station-label[data-estacion="Resonancia 1"] { color: #ffffff;background: #3367d6; }
.station-label[data-estacion="Resonancia 2"] { color: #ffffff;  background: #3c8dbc;}
.station-label[data-estacion="Tomografía 1"] { color: #ebf3ef; background: #0f9d58;}
.station-label[data-estacion="Neurología"]    { color: #ffffff; background:#f9ab00;}


/* Hacer sticky la primera columna (etiquetas de estación) */
.station-label {
  position: sticky;
  left: 0;
  background: #fafafa;  /* mismo fondo que la grid */
  z-index: 3;
  /* opcional: añadir un borde derecho para separar */
  border-right: 2px solid #ddd;
}
/* Borde especial para citas múltiples */
.cita-multiple {
  border: 2px dashed #ff9800;      /* naranja punteado */
  box-sizing: border-box;          /* para que no cambie el tamaño */
}

/* Opcional: un pequeño sombreado para resaltarlas aún más */
.cita-multiple {
  box-shadow: 0 0 4px rgba(255,152,0,0.6);
}
.agenda-container {
  position: relative; /* para que el indicador se posicione dentro */
}

/* la línea roja */
#current-time-indicator {
  position: absolute;
  left: 150px;        /* ancho de la primera columna */
  right: 0;
  height: 2px;
  background: #e53935;
  z-index: 5;
  display: none;      /* oculto si no es hoy o fuera de rango */
}
