/*================================================================
        Modal Styling — SINGLE SOURCE OF TRUTH
  ----------------------------------------------------------------
  Loaded by every page via ScriptBuilder::createPageStyles(). Do not
  copy these rules into a page stylesheet: registrationpage.css used
  to carry a full duplicate, and because that page never loads
  regtracker.css the two silently diverged.

  Page-specific tweaks belong in the page's own stylesheet, which is
  loaded AFTER this file and overrides it (e.g. attendeeconsole's
  70dvw, contentconsole's .gjs-editor-modal).

  Sizing standard: width-constrained, content-driven height. No fixed
  aspect ratio. Messages cap at 30rem to keep a readable line length;
  content mode (forms/editors) gets 48rem, 56rem at >=1024px. Height
  caps at 85dvh with only the body scrolling, so footer buttons stay
  reachable. Breakpoints follow BRAND-STANDARDS: 768 / 1024.
  ================================================================*/

#result-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3000;
  background-color: #666666b5;
  white-space: normal;
  display: grid;
  grid-template-areas:
    "tp tp tp"
    "lp mc rp"
    "bp bp bp";
  grid-template-rows: 1fr max-content 1fr;
  grid-template-columns: 1fr max-content 1fr;
}

/* Modal sizing standard: width-constrained, content-driven height, capped at 85dvh
   with only the body scrolling. No fixed aspect ratio — a one-line message stays
   short and a long form scrolls. Message modals cap at 30rem to keep text near a
   readable line length; content mode (forms/editors) gets more room via
   .modal--content, which show_content_modal() applies. Breakpoints: 768 / 1024. */
#modal-content-div {
  grid-area: mc;
  display: grid;
  background-color: var(--dialog-body-color);
  border-width: 3px;
  border-style: solid;
  border-radius: 25px;
  grid-template-areas:
    "tc"
    "mf";
  grid-template-rows: minmax(0, 1fr) auto;
  width: min(92vw, 30rem);
  max-height: 85dvh;
}

#modal-content-div.modal--content {
  width: min(92vw, 48rem);
}

@media (min-width: 1024px) {
  #modal-content-div.modal--content {
    width: min(90vw, 56rem);
  }
}

#result-modal-content {
  display: grid;
  grid-area: tc;
  padding: 1.5rem;
  text-align: center;
  grid-template-areas:
    "mh"
    "mb";
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

@media (min-width: 768px) {
  #result-modal-content {
    padding: 2rem;
  }
}

/* Height is content-driven: an empty header must not reserve space above a
   simple message (this previously had a fixed height of 65px). */
#result-modal-header {
  grid-area: mh;
}

#result-modal-header:empty {
  display: none;
}

/* The body is the only scrolling region, so the footer buttons stay reachable. */
#result-modal-body {
  grid-area: mb;
  min-height: 0;
  overflow-y: auto;
  overflow-wrap: break-word;
}

.result-modal-no-border {
  border: 0px solid black;
}

.result-modal-normal {
  border-color: black;
}

.result-modal-bad {
  border-color: #c12830;
}

.result-modal-good {
  border-color: #73ae43;
}

.result-modal-warning {
  border-color: #ff9531;
}

#result-modal-footer {
  display: grid;
  grid-area: mf;
  grid-template-areas:
    "em"
    "br";
  grid-template-rows: auto auto;
}

/* No fixed max-height: an 81px clamp truncated longer messages (e.g. one naming the
   accepted file types). The modal's own 85dvh cap bounds it, and it still scrolls. */
#result-modal-error-div {
  grid-area: em;
  max-height: 40dvh;
  overflow-y: auto;
}

#result-modal-error-div ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#result-modal-error-div li {
  margin: 2px 0;
  padding: 0;
}

#result-modal-error-div div {
  color: #c12830;
  font-size: 0.9rem;
}

#result-modal-button-container {
  grid-area: br;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  align-content: flex-end;
  gap: 5px;
  padding: 2px;
  justify-content: space-between;
}

#result-modal-button-container:has(.result-modal-button:only-child) {
  justify-content: flex-end;
}

.result-modal-button {
  background-color: #007bff;
  border-radius: 5px;
  border-style: solid;
  border-color: black;
  border-width: thin;
  color: #ffffff;
  cursor: pointer;
  font-size: 20px;
  font-weight: 400;
  height: 40px;
  margin-left: 10px;
  margin-right: 10px;
  padding: 0px 20px;
}

/*================================================================
              Error Modal Styles
  ================================================================*/

#error-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3000;
  background-color: #666666b5;
  white-space: normal;
  display: grid;
  grid-template-areas:
    "tp tp tp"
    "lp mc rp"
    "bp bp bp";
  grid-template-rows: 1fr max-content 1fr;
  grid-template-columns: 1fr max-content 1fr;
}

/* Same sizing standard as #modal-content-div. The error modal only ever carries
   messages, so it does not need the wider content-mode variant. */
#error-modal-content-div {
  grid-area: mc;
  display: grid;
  background-color: var(--dialog-body-color);
  border-width: 3px;
  border-style: solid;
  border-radius: 25px;
  grid-template-areas:
    "tc"
    "mf";
  grid-template-rows: minmax(0, 1fr) auto;
  width: min(92vw, 30rem);
  max-height: 85dvh;
}

#error-modal-content {
  display: grid;
  grid-area: tc;
  padding: 1.5rem;
  text-align: center;
  grid-template-areas:
    "mh"
    "mb";
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

@media (min-width: 768px) {
  #error-modal-content {
    padding: 2rem;
  }
}

#error-modal-header {
  grid-area: mh;
}

#error-modal-header:empty {
  display: none;
}

#error-modal-body {
  grid-area: mb;
  min-height: 0;
  overflow-y: auto;
  overflow-wrap: break-word;
}

.error-modal-no-border {
  border: 0px solid black;
}

.error-modal-normal {
  border-color: black;
}

.error-modal-bad {
  border-color: #c12830;
}

.error-modal-good {
  border-color: #73ae43;
}

.error-modal-warning {
  border-color: #ff9531;
}

#error-modal-footer {
  display: grid;
  grid-area: mf;
  grid-template-areas:
    "em"
    "br";
  grid-template-rows: auto auto;
}

#error-modal-error-div {
  grid-area: em;
  max-height: 40dvh;
  overflow-y: auto;
  border-radius: 5px;
  padding: 5px;
  margin: 2px;
}

#error-modal-error-div ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#error-modal-error-div li {
  margin: 2px 0;
  padding: 0;
}

#error-modal-error-div div {
  font-size: 0.9rem;
  padding-left: 5px;
}

#error-modal-button-container {
  grid-area: br;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  align-content: flex-end;
  gap: 5px;
  padding: 5px 15px;
  justify-content: space-between;
}

/* .error-modal-button, not .result-modal-button: show_error_modal() builds its buttons
   with the error class (reg-tracker.js:385). The selector previously named the result
   modal's class, so it never matched and a lone OK stayed left-aligned under
   justify-content: space-between while the result modal's single button sat right. */
#error-modal-button-container:has(.error-modal-button:only-child) {
  justify-content: flex-end;
}

.error-modal-button {
  border-radius: 5px;
  border-style: solid;
  border-color: black;
  border-width: thin;
  margin-left: 10px;
  margin-right: 10px;
}
