/* ===================================
   AGENDA SEMANAL DE LABORATORIO
   Estilo Google Calendar
   =================================== */

:root {
  --primary-color: #667eea;
  --primary-dark: #764ba2;
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --danger-color: #f44336;
  --bg-light: #f8f9fa;
  --border-color: #e0e0e0;
  --text-dark: #2c3e50;
  --text-muted: #7f8c8d;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Container Principal */
.agenda-wrapper {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 20px;
  margin: 20px 0;
}

/* Header con Navegación */
.agenda-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
}

.agenda-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.agenda-nav-btn {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.agenda-nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.agenda-nav-btn.btn-today {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.agenda-rango-fechas {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

/* Tarjetas de Métricas */
.agenda-metricas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.metrica-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary-color);
  transition: all 0.3s ease;
}

.metrica-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.metrica-card.success {
  border-left-color: var(--success-color);
}

.metrica-card.warning {
  border-left-color: var(--warning-color);
}

.metrica-card.info {
  border-left-color: #2196f3;
}

.metrica-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.metrica-titulo {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.metrica-icono {
  font-size: 24px;
  opacity: 0.3;
}

.metrica-valor {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-dark);
}

/* Resumen de Hoy */
.resumen-hoy {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 25px;
  border-left: 4px solid var(--success-color);
  box-shadow: var(--shadow-sm);
}

.resumen-hoy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.resumen-contenido {
  transition: all 0.3s ease;
  overflow: hidden;
}

.resumen-dia-section {
  margin-bottom: 20px;
  background: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: var(--shadow-sm);
}

.resumen-dia-section.dia-actual {
  border: 2px solid var(--success-color);
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.2);
}

.resumen-dia-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.resumen-dia-titulo {
  font-size: 15px;
  color: var(--text-dark);
}

.resumen-dia-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-light);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
}

.resumen-hoy-titulo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.resumen-hoy-titulo i {
  color: var(--success-color);
}

.resumen-hoy-fecha {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.resumen-hoy-lista {
  display: grid;
  gap: 10px;
}

.resumen-cita-item {
  background: white;
  border-radius: 8px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
}

.resumen-cita-item:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.resumen-cita-hora {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  min-width: 70px;
  text-align: center;
}

.resumen-cita-hora.urgente {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.resumen-cita-hora.stat {
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.resumen-cita-info {
  flex: 1;
}

.resumen-cita-paciente {
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
}

.resumen-cita-detalles {
  font-size: 13px;
  color: var(--text-muted);
}

.resumen-cita-badge {
  background: var(--bg-light);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.resumen-vacio {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
}

.resumen-vacio i {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 10px;
}

/* Grid de Agenda */
.agenda-grid-container {
  overflow-x: auto;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.agenda-grid {
  display: grid;
  grid-template-columns: 80px repeat(7, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border-color);
  min-width: 1000px;
}

/* Headers de Días */
.agenda-header-dia {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  text-align: center;
  padding: 15px 10px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 10;
}

.agenda-header-dia.hoy {
  background: linear-gradient(135deg, var(--success-color) 0%, #45a049 100%);
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.dia-nombre {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.dia-numero {
  font-size: 20px;
  margin-top: 5px;
}

/* Columna de Horas */
.agenda-hora-label {
  background: var(--bg-light);
  padding: 10px;
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 2px solid var(--border-color);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.agenda-hora-label.hora-actual-active {
  color: var(--primary-color);
  font-weight: 700;
  border-right: 2px solid var(--primary-color);
  background: rgba(102, 126, 234, 0.2) !important; /* Color del agua */
}

/* Efecto de Agua en Movimiento */
.agenda-hora-label.hora-actual-active::before,
.agenda-hora-label.hora-actual-active::after {
  content: "";
  position: absolute;
  left: 50%;
  min-width: 200%;
  min-height: 200%;
  background: var(--bg-light); /* Color de fondo para "tapar" el agua */
  animation: wave-rotate 10s linear infinite;
  border-radius: 45%;
  bottom: var(--fill-percentage); /* Nivel del agua */
  transform: translateX(-50%);
  z-index: -1;
}

.agenda-hora-label.hora-actual-active::after {
  min-width: 210%;
  min-height: 210%;
  border-radius: 40%;
  animation: wave-rotate 15s linear infinite;
  opacity: 0.5;
}

@keyframes wave-rotate {
  0% {
    transform: translateX(-50%) rotate(0deg);
  }
  100% {
    transform: translateX(-50%) rotate(360deg);
  }
}

/* Slots de Tiempo */
.agenda-slot {
  background: white;
  min-height: 60px;
  position: relative;
  padding: 4px;
  transition: background 0.2s ease;
}

.agenda-slot:hover {
  background: #f0f7ff;
}

.agenda-slot.disponible {
  cursor: pointer;
}

/* Línea de Hora Actual */
.hora-actual-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ea4335;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(234, 67, 53, 0.6);
}

.hora-actual-line::before {
  content: "";
  position: absolute;
  left: -6px;
  top: -5px;
  width: 12px;
  height: 12px;
  background: #ea4335;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(234, 67, 53, 0.8);
}

.hora-actual-badge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: #ea4335;
  color: white;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: bold;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  z-index: 101;
}

/* Citas */
.agenda-cita {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 6px;
  padding: 8px;
  margin: 2px 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  font-size: 12px;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

.agenda-cita:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
  z-index: 5;
}

.agenda-cita.prioridad-urgente {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.agenda-cita.prioridad-stat {
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.cita-hora {
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 3px;
}

.cita-paciente {
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cita-tipo {
  font-size: 10px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cita-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

/* Tooltip */
.agenda-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 1000;
  max-width: 300px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.tooltip-header {
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.tooltip-row {
  margin: 4px 0;
  display: flex;
  gap: 8px;
}

.tooltip-label {
  font-weight: 600;
  min-width: 80px;
}

/* Loading State */
.agenda-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.agenda-loading i {
  font-size: 48px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Empty State */
.agenda-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.agenda-empty i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

/* Responsive */
@media (max-width: 768px) {
  .agenda-header {
    flex-direction: column;
    gap: 15px;
  }

  .agenda-metricas {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrica-valor {
    font-size: 24px;
  }

  .agenda-grid {
    grid-template-columns: 60px repeat(7, minmax(120px, 1fr));
  }
}

/* Buscador Hero */
.agenda-search-wrapper {
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

.agenda-search-container-hero {
  position: relative;
  width: 100%;
  max-width: 600px; /* Ancho máximo para que no sea excesivo */
  z-index: 2000;
}

.agenda-search-container-hero .input-group {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border-radius: 50px;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.agenda-search-container-hero .input-group:focus-within {
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.agenda-search-container-hero input {
  height: 50px;
  font-size: 16px;
  border: none !important;
  box-shadow: none !important;
}

.agenda-search-container-hero .input-group-text {
  border: none !important;
  background: white !important;
  font-size: 18px;
}

.agenda-resultados-dropdown {
  position: absolute;
  top: 110%; /* Un poco más separado */
  left: 0;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  margin-top: 5px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 2001;
  border: 1px solid var(--border-color);
}

.resultado-item {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.resultado-item:last-child {
  border-bottom: none;
}

.resultado-item:hover {
  background: var(--bg-light);
}

.resultado-paciente {
  font-weight: 700;
  color: var(--text-dark);
  font-size: 14px;
}

.resultado-tutor {
  font-size: 12px;
  color: var(--text-muted);
}

.resultado-fecha {
  font-size: 11px;
  color: var(--primary-color);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}
