/*
 * NOVA dialogs (2026-11-22): one identity for every modal, confirmation and message.
 * Loaded last. It sets surface, corners, shadow, backdrop and header only; each dialog keeps its own layout.
 */
:root {
  --nova-dlg-radius: 1.1rem;
  --nova-dlg-bg: var(--bs-paper-bg, var(--bs-card-bg, #fff));
  --nova-dlg-line: rgba(var(--bs-secondary-rgb, 128, 131, 144), .18);
  --nova-dlg-shadow: 0 1.4rem 4.5rem rgba(20, 18, 35, .26);
  --nova-dlg-backdrop: rgba(21, 24, 36, .52);
}

html body .modal .modal-content,
html body .swal2-popup:not(.swal2-toast),
html body .nova-cards-create-modal .nova-cards-create-modal__dialog,
html body dialog.nova-cards-selection-dialog,
html body dialog.nova-dialog,
html body .nova-groups-modal,
html body .nova-users-columns-modal,
html body .nova-created-dialog,
html body .nc5-map-modal .nc5-map-modal-dialog,
html body .nue-info-modal .nue-info-modal__dialog,
html body .nue-confirm__dialog,
html body .nova-bulk-confirm-dialog,
html body .nova-agents-confirm-dialog,
html body .nova-companies-confirm-dialog,
html body .nova-users-confirm-dialog,
html body .nova-groups-confirm-dialog {
  border: 1px solid var(--nova-dlg-line) !important;
  border-radius: var(--nova-dlg-radius) !important;
  background: var(--nova-dlg-bg) !important;
  color: var(--bs-body-color) !important;
  box-shadow: var(--nova-dlg-shadow) !important;
}

/* ---------- Bootstrap modals */
html body .modal-backdrop { --bs-backdrop-bg: #151824; --bs-backdrop-opacity: .52; }
html body .modal .modal-content { overflow: hidden; }
html body .modal .modal-header {
  padding-block: 1.1rem;
  padding-inline-start: 1.4rem;
  border-bottom: 1px solid var(--nova-dlg-line);
}
html body .modal .modal-header .btn-close { margin: 0; }
html body .modal .modal-title { color: var(--bs-heading-color); font-size: 1.125rem; font-weight: 700; line-height: 1.5; }
html body .modal .modal-body { padding: 1.3rem 1.4rem; }
html body .modal .modal-footer { padding: 1rem 1.4rem; gap: .65rem; border-top: 1px solid var(--nova-dlg-line); }
html body .modal .modal-footer > * { margin: 0; }

/* ---------- SweetAlert, also when a page calls it directly */
html body .swal2-container.swal2-backdrop-show { background: var(--nova-dlg-backdrop) !important; }
html body .swal2-popup .swal2-title { color: var(--bs-heading-color); font-size: 1.18rem; font-weight: 700; }
html body .swal2-popup .swal2-html-container { color: var(--bs-secondary-color); font-size: .92rem; line-height: 1.75; }
html body .swal2-popup .nova-swal-description { white-space: pre-line; overflow-wrap: anywhere; }
html body .swal2-actions.nova-swal-actions.is-single { grid-template-columns: 1fr; }
html body .swal2-styled { border-radius: .7rem !important; font-weight: 700; }
html body .swal2-styled.swal2-confirm { background-color: var(--bs-primary) !important; color: #fff !important; }

/* ---------- card creation */
html body .nova-cards-create-modal .nova-cards-create-modal__backdrop { background: var(--nova-dlg-backdrop); }
html body .nova-cards-create-modal .nova-cards-create-modal__dialog {
  display: flex;
  flex-direction: column;
  width: min(60rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: 1rem auto;
  padding: 0;
  overflow: hidden;
}
html body .nova-cards-create-modal .nova-cards-create-modal__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .85rem;
  margin: 0;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--nova-dlg-line);
}
html body .nova-cards-create-modal .nova-cards-create-modal__head h4 { margin: 0; font-size: 1.125rem; font-weight: 700; line-height: 1.5; }
html body .nova-cards-create-modal .nova-cards-create-modal__head p { margin: 0; font-size: .82rem; }
html body .nova-cards-create-modal .nova-cards-create-modal__head .btn-close { flex: none; margin: 0; margin-inline-start: auto; }
.nova-dlg-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .75rem;
  background: rgba(var(--bs-primary-rgb), .12);
  color: var(--bs-primary);
}
html body .nova-cards-create-modal .nova-cards-create-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
}
html body .nova-cards-create-modal .nova-cards-create-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.3rem 1.4rem;
}
html body .nova-cards-create-modal .nova-cards-create-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
html body .nova-cards-create-modal .nova-cards-create-tabs button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: .65rem;
  row-gap: .1rem;
  padding: .75rem .85rem;
  border: 1px solid var(--nova-dlg-line);
  border-radius: .75rem;
  background: transparent;
  color: var(--bs-heading-color);
  font-weight: 600;
  line-height: 1.45;
}
html body .nova-cards-create-modal .nova-cards-create-tabs button > i { grid-row: span 2; font-size: 1.4rem; }
html body .nova-cards-create-modal .nova-cards-create-tabs button small { font-weight: 400; font-size: .75rem; }
html body .nova-cards-create-modal .nova-cards-create-tabs button:hover { border-color: rgba(var(--bs-primary-rgb), .4); }
html body .nova-cards-create-modal .nova-cards-create-tabs button.is-active {
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .1);
  color: var(--bs-primary);
}
html[data-bs-theme="dark"] body .nova-cards-create-modal .nova-cards-create-tabs button.is-active { color: var(--bs-heading-color); }
html body .nova-cards-create-modal .nova-cards-create-tabs button.is-active > i { color: var(--bs-primary); }
html body .nova-cards-create-modal .nova-cards-create-tabs button:focus-visible { outline: 3px solid rgba(var(--bs-primary-rgb), .3); outline-offset: 2px; }
html body .nova-cards-create-modal #novaCardsCreateHint {
  padding: .6rem .85rem;
  border: 0;
  border-radius: .7rem;
  background: rgba(var(--bs-primary-rgb), .08);
  color: var(--bs-body-color);
  font-size: .84rem;
}
html body .nova-cards-create-modal .nova-cards-check { border-color: var(--nova-dlg-line); border-radius: .7rem; }
html body .nova-cards-create-modal .nova-cards-create-modal__footer {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  margin: 0;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--nova-dlg-line);
}

/* ---------- selection review and the sign-in page (native <dialog>) */
html body dialog.nova-cards-selection-dialog::backdrop,
html body dialog.nova-dialog::backdrop { background: var(--nova-dlg-backdrop, rgba(21, 24, 36, .52)); }
html body dialog.nova-dialog {
  width: min(27rem, calc(100vw - 2rem));
  margin: auto;
  padding: 1.4rem;
  font-family: var(--bs-body-font-family);
}
html body dialog.nova-dialog p { margin: 0 0 1.25rem; line-height: 1.75; text-align: center; }
html body dialog.nova-dialog .nova-dialog__actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .7rem; }

/* ---------- an open dialog covers the theme button and locks the page */
body:has(.modal.show) .template-customizer-open-btn,
body:has(.swal2-backdrop-show) .template-customizer-open-btn,
body:has(.nova-cards-create-modal.is-open) .template-customizer-open-btn { visibility: hidden !important; }
body:has(.nova-cards-create-modal.is-open) { overflow: hidden; }

@media (max-width: 575.98px) {
  html body .nova-cards-create-modal .nova-cards-create-modal__dialog {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border: 0 !important;
    border-radius: 0 !important;
  }
  html body .nova-cards-create-modal .nova-cards-create-modal__head,
  html body .nova-cards-create-modal .nova-cards-create-modal__body,
  html body .nova-cards-create-modal .nova-cards-create-modal__footer { padding-inline: 1rem; }
  html body .nova-cards-create-modal .nova-cards-create-tabs button {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    padding: .6rem .3rem;
    font-size: .76rem;
    text-align: center;
  }
  html body .nova-cards-create-modal .nova-cards-create-tabs button > i { grid-row: auto; }
  html body .nova-cards-create-modal .nova-cards-create-tabs button small { display: none; }
  html body .nova-cards-create-modal .nova-cards-create-modal__footer .btn { flex: 1 1 0; min-width: 0; }
}
