/* Global modal base styles (light mode by default) */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}
/* Support multiple activation patterns (prefer Bootstrap semantics) */
.modal.show,
.modal[aria-modal="true"],
.modal.is-open { display: flex; }

/* Removed rule that forced display:flex when inline style contained display:block,
   to avoid timing conflicts with aria-hidden during Bootstrap's show() sequence. */

.modal-dialog { width: 100%; max-width: 900px; }
.modal-content {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.25);
  overflow: hidden;
}
.modal-header, .modal-footer { background: #f8fafc; border-color: #e5e7eb; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}
.modal-title { font-size: 1rem; font-weight: 600; color: #0f172a; }
.modal-body { padding: 16px; max-height: 70vh; overflow-y: auto; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid #e5e7eb; }
.modal .close {
  color: #334155;
  font-size: 1.25rem;
  line-height: 1;
  background: transparent;
  border: 0;
  opacity: 1;
}
.modal .close:hover { color: #0f172a; }

/* Lock page scroll when modal is open */
body.modal-open { overflow: hidden; }

/* Responsiveness */
@media (max-width: 640px) {
  .modal-dialog { max-width: 92vw; }
  .modal-body { max-height: 65vh; }
}

/* Native <dialog> modal for Cursos */
#modal-curso {
  padding: 0;
  border: none;
  border-radius: 12px;
  width: 90vw;
  max-width: 800px;
  color: #111827;
  background: #ffffff;
  box-shadow: 0 24px 48px rgba(0,0,0,0.25);
}
#modal-curso::backdrop { background: rgba(0,0,0,0.55); }
#modal-curso form { padding: 0; }
#modal-curso h3 {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
}
#modal-curso .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin: 12px 16px; }
#modal-curso .form-field { margin: 0; }
#modal-curso .form-field label { display: block; margin-bottom: 6px; font-weight: 600; }
#modal-curso .form-field input, #modal-curso .form-field select { width: 100%; padding: 8px; border: 1px solid #d1d3e2; border-radius: 6px; }
#modal-curso .form-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid #e5e7eb; background: #f8fafc; }
@media (max-width: 640px){ #modal-curso { width: 96vw; } #modal-curso .form-grid { grid-template-columns: 1fr; } }