/* Diálogos (jInfo/jWarning/jError/jConfirm/jPrompt/jProcess) y busy de jqajaj.js.
   Estructura (ver _dialogs en js/jqajaj.js):
     #dialogoverlay
     #dialogbox.<tipo>Dialog > #dialogboxhead (#dialogboxicon + #dialogboxtitle)
                             > #dialogboxbody > #dialogboxtext
                             > #dialogboxfoot (#dialogOk / #dialogCancel)
     #busyoverlay + #busybox > img
   <tipo> = info | warning | error | confirm | prompt | process. Los íconos son
   APJ/images/<tipo>32.png (confirm y prompt usan question32.png).

   Este archivo e images/ son los que se adaptan al estilo de cada sitio.
   Es AUTOSUFICIENTE: no depende de ningún otro CSS ni framework, y el CSS del
   sitio no lo afecta. Para eso:
   1. El bloque "Aislamiento" anula en cada elemento del diálogo lo que suelen
      tocar las reglas generales de un sitio (span, div, img, button, input, *):
      márgenes, bordes, tipografía, mayúsculas, sombras, etc.
   2. #dialogbox fija la tipografía base con valores propios (no hereda del
      <body>), y los elementos internos la heredan solo de #dialogbox.
   Todo se selecciona por id, que gana a cualquier regla general del sitio.
   Para cambiar el aspecto, edite los bloques de "Aspecto" más abajo; el bloque
   de aislamiento no necesita cambios.
   (El contenido HTML que venga dentro del mensaje - <b>, <table>, etc. - es
   del desarrollador y sí recibe el CSS del sitio.) */

/* ─── Aislamiento ─────────────────────────────────────────────────────────── */

#dialogoverlay, #dialogbox, #dialogboxhead, #dialogboxicon, #dialogboxtitle,
#dialogboxbody, #dialogboxtext, #dialogboxfoot, #dialogOk, #dialogCancel,
#prompt_value, #busyoverlay, #busybox, #busybox img {
  box-sizing: border-box;
  float: none;
  clear: none;
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  filter: none;
  transform: none;
  transition: none;
  animation: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-style: inherit;
  font-weight: inherit;
  font-variant: normal;
  line-height: inherit;
  letter-spacing: inherit;
  word-spacing: inherit;
  text-transform: inherit;
  text-align: inherit;
  text-indent: 0;
  text-decoration: none;
  text-shadow: none;
  white-space: normal;
  vertical-align: baseline;
  visibility: visible;
  cursor: auto;
}

/* ─── Aspecto: fondo y cuadro ──────────────────────────────────────────────── */

#dialogoverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: #000;
  opacity: .5;
  z-index: 9998;
}
#dialogbox {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 94vw);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .175);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20, 33, 61, .18);
  /* Tipografía base del diálogo: valores propios, no los del <body> del sitio */
  color: #1f2937;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: normal;
  word-spacing: normal;
  text-transform: none;
  text-align: left;
  z-index: 9999;
}

/* ─── Aspecto: encabezado ──────────────────────────────────────────────────── */

#dialogboxhead {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px 8px 12px;
  border-bottom: 1px solid #dee2e6;
  background: #6c757d;
  color: #fff;
}
#dialogboxicon {
  display: inline-block;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  vertical-align: middle;
}
#dialogboxtitle {
  display: inline;
  font-size: 20px;
  font-weight: 500;
  line-height: 30px;
}

/* Color del encabezado según el tipo */
.infoDialog    #dialogboxhead { background: #0d6efd; color: #fff; }
.warningDialog #dialogboxhead { background: #ffc107; color: #000; }
.errorDialog   #dialogboxhead { background: #dc3545; color: #fff; }
.confirmDialog #dialogboxhead { background: #212529; color: #fff; }
.promptDialog  #dialogboxhead { background: #6c757d; color: #fff; }
.processDialog #dialogboxhead { background: #198754; color: #fff; }

/* ─── Aspecto: mensaje ─────────────────────────────────────────────────────── */

#dialogboxbody {
  display: block;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
  padding: 14px 18px;
  color: #1f2937;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
}
#dialogboxtext {
  display: block;
}
#prompt_value {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 4px;
  padding: 5px 10px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  cursor: text;
}
#prompt_value::placeholder {
  color: #94a3b8;
  opacity: 1;
}
#prompt_value:focus {
  outline: 0;
  border-color: #86b7fe;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, .25);
}

/* ─── Aspecto: botones ─────────────────────────────────────────────────────── */

#dialogboxfoot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid #dee2e6;
  background: #fff;
}
#dialogboxfoot:empty { display: none; }
#dialogOk, #dialogCancel {
  display: inline-block;
  -webkit-appearance: button;
  appearance: button;
  margin: 4px;
  min-width: 88px;
  min-height: 40px;
  padding: 8px 18px;
  border: 0;
  border-radius: 8px;
  background: #2f4a8f;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: normal;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
}
#dialogOk:hover, #dialogCancel:hover { filter: brightness(1.1); }
#dialogOk:focus, #dialogCancel:focus {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, .35);
}

/* ─── Aspecto: busy ────────────────────────────────────────────────────────── */

#busyoverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: #ACACAC;
  opacity: .3;
  z-index: 9998;
}
#busybox {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  z-index: 9999;
}
#busybox img {
  display: block;
  width: 32px;
  height: 32px;
}

/* ─── Lista desplegable de jShowDown() ─────────────────────────────────────── */

.showDown {
  z-index: 101;
  display: none;
  position: absolute;
  background: #fff;
  color: #333;
  overflow: auto;
  top: 200px;
  left: 200px;
  height: 250px;
  width: auto;
}
