.agenda-leyenda {
    max-width: 950px;
    margin: 20px auto 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    font-size: 14px;
}
.leyenda-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    border-radius: 3px;
}

#agendaCalendario {
    max-width: 950px;
    margin: 20px auto 50px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 20px;
}

/* ==== MODAL GENERAL ==== */
.agenda-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.55);
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

/* ==== CONTENIDO DEL MODAL ==== */
.agenda-modal-content {
    background: #fff;
    padding: 25px 35px;
    border-radius: 12px;
    width: 460px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    animation: aparecer .3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes aparecer {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.agenda-modal h3 {
    margin-bottom: 15px;
    color: #58116e;
    font-weight: 600;
    text-align: center;
}

.form-group { margin-bottom: 12px; }
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.form-row .form-group {
    flex: 1;
    min-width: 130px;
}
#agendaForm input, #agendaForm textarea, #agendaForm select {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
}
.form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.btn-guardar, .btn-editar, .btn-eliminar, .btn-cerrar {
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.btn-guardar, .btn-editar { background: #7B2CBF; color: white; }
.btn-eliminar { background: #E63946; color: white; }
.btn-cerrar { background: #ccc; }

/* ==== RESPONSIVE ==== */
@media (max-width: 600px) {
    .agenda-modal {
        padding: 10px;
        align-items: flex-start;
    }
    .agenda-modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 10px;
        padding: 20px;
        margin-top: 30px;
    }
    .form-row {
        flex-direction: column;
    }
    .form-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-guardar, .btn-editar, .btn-eliminar, .btn-cerrar {
        width: 100%;
    }
}
/* ==== RESPONSIVE ENCABEZADO CALENDARIO ==== */
@media (max-width: 768px) {
  .fc .fc-toolbar.fc-header-toolbar {
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
  }

  /* Centrar el título y botones */
  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Ajustar tamaño de botones */
  .fc .fc-button {
    font-size: 12px !important;
    padding: 4px 8px !important;
  }

  /* Título más legible */
  .fc .fc-toolbar-title {
    font-size: 14px !important;
    margin: 5px 0 !important;
    text-align: center;
  }
}

/* ==== VISTA EXTRA PEQUEÑA (celulares muy pequeños) ==== */
@media (max-width: 480px) {
  .fc .fc-toolbar.fc-header-toolbar {
    gap: 4px !important;
  }

  .fc .fc-button {
    font-size: 11px !important;
    padding: 3px 6px !important;
  }

  .fc .fc-toolbar-title {
    font-size: 13px !important;
  }
}
/* ==== AJUSTES RESPONSIVE PARA EL CALENDARIO ==== */
@media (max-width: 768px) {
  /* 🔹 Contenedor del calendario */
  #agendaCalendario {
    padding: 10px;
    max-width: 100%;
    overflow-x: auto; /* permite desplazamiento horizontal si se necesita */
  }

  /* 🔹 Ajustar el tamaño de los encabezados de días */
  .fc .fc-col-header-cell-cushion {
    font-size: 12px !important;
    padding: 4px 2px !important;
  }

  /* 🔹 Reducir altura del encabezado de horas y espacio de eventos */
  .fc-timegrid-slot-label {
    font-size: 10px !important;
    padding: 0 2px !important;
  }

  /* 🔹 Hacer scroll horizontal cuando hay muchos días visibles */
  .fc-view-harness {
    overflow-x: auto !important;
  }

  /* 🔹 Forzar el ancho mínimo de las columnas de días */
  .fc-timegrid-col, .fc-daygrid-day {
    min-width: 120px !important;
  }

  /* 🔹 Ajustar botones de vista (Mes, Semana, Día) */
  .fc .fc-button-group button {
    font-size: 12px !important;
    padding: 4px 8px !important;
  }

  /* 🔹 Los eventos también más compactos */
  .fc-event-title {
    font-size: 12px !important;
  }
}

/* ==== VISTA MÓVIL PEQUEÑA (TELÉFONOS PEQUEÑOS) ==== */
@media (max-width: 480px) {
  #agendaCalendario {
    padding: 6px;
  }

  .fc .fc-toolbar-title {
    font-size: 13px !important;
  }

  .fc .fc-button {
    font-size: 11px !important;
  }

  .fc-timegrid-slot-label {
    font-size: 9px !important;
  }

  .fc .fc-col-header-cell-cushion {
    font-size: 11px !important;
  }

  /* 🔹 Permitir hacer scroll lateral sin romper diseño */
  .fc-scrollgrid {
    min-width: 500px !important;
  }
}

/* === Loader simple centrado === */
#agendaLoader {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 10000;
    font-size: 1.2rem;
    color: #58116e;
    font-weight: 600;
}
#agendaLoader span {
    animation: parpadeo 1.2s infinite;
}
@keyframes parpadeo {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
