/*
 * Capa visual compartida para los modales Bootstrap del sistema.
 * No altera el marcado ni el comportamiento JavaScript existente.
 */
:root {
  --modal-accent: #4169d8;
  --modal-accent-dark: #3154b5;
  --modal-surface: #ffffff;
  --modal-surface-soft: #f7f9fc;
  --modal-text: #202938;
  --modal-muted: #727d8c;
  --modal-border: #e4e9f1;
  --modal-input-border: #d7dfea;
  --modal-focus: rgba(65, 105, 216, .15);
  --modal-shadow: 0 28px 70px rgba(24, 35, 52, .22), 0 7px 20px rgba(24, 35, 52, .10);
}

/* Fondo y entrada */
.modal-backdrop.show { opacity: .56; }
.modal-backdrop { background-color: #111827; }
.modal.fade .modal-dialog {
  transform: translateY(18px) scale(.975);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
}
.modal.show .modal-dialog { transform: translateY(0) scale(1); }
.modal-dialog {
  width: auto;
  margin: 1.75rem auto;
  border-radius: 18px;
  box-shadow: none;
}
.modal-dialog-centered { min-height: calc(100% - 3.5rem); }

/* Contenedor */
.modal-content {
  overflow: hidden;
  border: 1px solid rgba(213, 221, 232, .9);
  border-radius: 17px;
  color: var(--modal-text);
  background: var(--modal-surface);
  box-shadow: var(--modal-shadow);
}
.modal-header {
  min-height: 76px;
  padding: 20px 24px;
  align-items: center;
  border-bottom: 1px solid var(--modal-border);
  border-radius: 0;
  background: linear-gradient(135deg, #fff 0%, #f6f8fc 100%);
}
.modal-header::before {
  width: 4px;
  height: 31px;
  margin-right: 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6385e4, var(--modal-accent));
  box-shadow: 0 4px 10px rgba(65, 105, 216, .22);
  content: "";
}
.modal-title,
.modal-header h1,
.modal-header h2,
.modal-header h3,
.modal-header h4,
.modal-header h5,
.modal-header h6 {
  margin: 0;
  color: var(--modal-text);
  font-size: 1.13rem;
  font-weight: 700;
  letter-spacing: -.015em;
}
.modal-header .close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: -4px -6px -4px auto;
  padding: 0;
  border-radius: 10px;
  color: #677384;
  background: #edf1f6;
  text-shadow: none;
  opacity: 1;
  transition: color .18s ease, background-color .18s ease, transform .18s ease;
}
.modal-header .close:hover {
  color: #c92f50;
  background: #feecef;
  opacity: 1;
  transform: rotate(4deg);
}
.modal-header .close:focus {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(217, 37, 80, .12);
}
.modal-header .close span { display: block; margin-top: -3px; font-size: 25px; font-weight: 400; }

/* Contenido y formularios */
.modal-body {
  padding: 24px;
  color: var(--modal-text);
  background: var(--modal-surface);
}
.modal-body .form-group { margin-bottom: 18px; }
.modal-body label {
  margin-bottom: 7px;
  color: #4c5767;
  font-size: .79rem;
  font-weight: 650;
}
.modal-body .form-control,
.modal-body .custom-select,
.modal-body .bootstrap-select > .dropdown-toggle {
  min-height: 44px;
  border: 1px solid var(--modal-input-border);
  border-radius: 9px;
  color: #293344;
  background-color: #fbfcfe;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .025);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.modal-body textarea.form-control { min-height: 96px; padding-top: 11px; }
.modal-body .form-control:hover,
.modal-body .custom-select:hover { border-color: #b9c6d8; }
.modal-body .form-control:focus,
.modal-body .custom-select:focus,
.modal-body .bootstrap-select.show > .dropdown-toggle {
  border-color: #6f91e8;
  outline: 0;
  background-color: #fff;
  box-shadow: 0 0 0 .2rem var(--modal-focus);
}
.modal-body .form-control::placeholder { color: #9aa4b2; }
.modal-body .input-group-text {
  min-width: 43px;
  justify-content: center;
  border-color: var(--modal-input-border);
  color: #657289;
  background: #f0f3f8;
}
.modal-body hr { border-color: var(--modal-border); }

/* Pie y acciones */
.modal-footer {
  min-height: 72px;
  padding: 15px 24px;
  gap: 8px;
  border-top: 1px solid var(--modal-border);
  border-radius: 0;
  background: var(--modal-surface-soft);
}
.modal-footer > * { margin: 0; }
.modal-footer .btn,
.modal-body .btn {
  min-height: 40px;
  padding: 9px 17px;
  border-radius: 9px;
  font-weight: 650;
  box-shadow: none;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.modal-footer .btn:hover,
.modal-body .btn:hover { transform: translateY(-1px); }
.modal-footer .btn-primary,
.modal-body .btn-primary {
  border-color: var(--modal-accent);
  background: linear-gradient(135deg, #5277dc, var(--modal-accent));
  box-shadow: 0 7px 16px rgba(65, 105, 216, .18);
}
.modal-footer .btn-primary:hover,
.modal-body .btn-primary:hover {
  border-color: var(--modal-accent-dark);
  background: linear-gradient(135deg, #4169d8, var(--modal-accent-dark));
  box-shadow: 0 9px 20px rgba(65, 105, 216, .25);
}
.modal-footer .btn-secondary,
.modal-footer .btn-light {
  border-color: #d7dee8;
  color: #4d5969;
  background: #fff;
}
.modal-footer .btn-danger { box-shadow: 0 7px 16px rgba(217, 37, 80, .16); }

/* Temas oscuros */
body.theme-black,
body.theme-matrix {
  --modal-surface: #111923;
  --modal-surface-soft: #0d141d;
  --modal-text: #e8eef5;
  --modal-muted: #98a5b4;
  --modal-border: #293544;
  --modal-input-border: #344254;
  --modal-shadow: 0 30px 80px rgba(0, 0, 0, .58);
}
body.theme-black .modal-content,
body.theme-matrix .modal-content { border-color: var(--modal-border); background: var(--modal-surface); }
body.theme-black .modal-header,
body.theme-matrix .modal-header { border-color: var(--modal-border); background: linear-gradient(135deg, #17212d, #111923); }
body.theme-black .modal-body,
body.theme-matrix .modal-body { color: var(--modal-text); background: var(--modal-surface); }
body.theme-black .modal-footer,
body.theme-matrix .modal-footer { border-color: var(--modal-border); background: var(--modal-surface-soft); }
body.theme-black .modal-title,
body.theme-black .modal-header h1,
body.theme-black .modal-header h2,
body.theme-black .modal-header h3,
body.theme-black .modal-header h4,
body.theme-black .modal-header h5,
body.theme-black .modal-header h6,
body.theme-matrix .modal-title,
body.theme-matrix .modal-header h1,
body.theme-matrix .modal-header h2,
body.theme-matrix .modal-header h3,
body.theme-matrix .modal-header h4,
body.theme-matrix .modal-header h5,
body.theme-matrix .modal-header h6 { color: var(--modal-text) !important; }
body.theme-black .modal-body label,
body.theme-matrix .modal-body label { color: #bdc8d4; }
body.theme-black .modal-body .form-control,
body.theme-black .modal-body .custom-select,
body.theme-matrix .modal-body .form-control,
body.theme-matrix .modal-body .custom-select {
  border-color: var(--modal-input-border);
  color: #e7edf4;
  background-color: #0b121a;
}
body.theme-black .modal-header .close,
body.theme-matrix .modal-header .close { color: #b3bfcc; background: #263241; }

/* Acento Matrix */
body.theme-matrix {
  --modal-accent: #31e978;
  --modal-accent-dark: #22c963;
  --modal-focus: rgba(49, 233, 120, .14);
  --modal-border: #175f35;
  --modal-input-border: #23643d;
}
body.theme-matrix .modal-content { box-shadow: 0 28px 75px rgba(0, 0, 0, .65), 0 0 28px rgba(49, 233, 120, .07); }
body.theme-matrix .modal-header { background: linear-gradient(135deg, #071b10, #05130b); }
body.theme-matrix .modal-header::before { background: #31e978; box-shadow: 0 0 13px rgba(49, 233, 120, .45); }
body.theme-matrix .modal-title,
body.theme-matrix .modal-header h1,
body.theme-matrix .modal-header h2,
body.theme-matrix .modal-header h3,
body.theme-matrix .modal-header h4,
body.theme-matrix .modal-header h5,
body.theme-matrix .modal-header h6 { color: #53ef8d !important; }

/* Variantes suaves de los temas claros */
body.theme-windows .modal-content { border-color: #d8e6f5; box-shadow: 0 24px 65px rgba(38, 76, 121, .2); }
body.theme-windows .modal-header { background: linear-gradient(135deg, #fff, #eef6ff); }
body.theme-macos .modal-content {
  border-color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 28px 70px rgba(72, 68, 110, .2);
  backdrop-filter: blur(22px) saturate(145%);
}
body.theme-macos .modal-header,
body.theme-macos .modal-body,
body.theme-macos .modal-footer { background: rgba(255, 255, 255, .68); }
body.theme-corporate { --modal-accent: #214e8f; --modal-accent-dark: #173d74; --modal-focus: rgba(33, 78, 143, .15); }

@media (max-width: 575.98px) {
  .modal-dialog {
    width: auto;
    margin: .75rem;
  }
  .modal-dialog-centered { min-height: calc(100% - 1.5rem); }
  .modal-content { max-height: calc(100vh - 1.5rem); border-radius: 14px; }
  .modal-header { min-height: 66px; padding: 16px 18px; }
  .modal-header::before { height: 27px; margin-right: 10px; }
  .modal-body { padding: 19px 18px; overflow-y: auto; }
  .modal-footer { min-height: 66px; padding: 13px 18px; }
  .modal-footer .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .modal.fade .modal-dialog,
  .modal-header .close,
  .modal-footer .btn,
  .modal-body .btn { transition: none; }
}
