.status-modal {
  --modal-accent: #58a6ff;
  --modal-accent-rgb: 88, 166, 255;
  --modal-accent-border: #8bc2ff;
  --modal-accent-hover: #3f8fe5;
  --modal-accent-text: #e4f1ff;
  --modal-accent-button-text: #fff;

  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: start center;
  padding: 60px 24px 24px;

  &[hidden] {
    display: none;
  }

  &:not([hidden]) .status-modal-dialog {
    animation: status-modal-slide-in 180ms ease-out both;
  }
}

.status-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 13, 0.72);
  backdrop-filter: blur(4px);
}

.status-modal-dialog {
  position: relative;
  width: min(680px, calc(100vw - 32px));
  max-height: min(78vh, 820px);
  display: grid;
  gap: 16px;
  padding: 18px;
  border: var(--border-width) solid var(--modal-accent-border);
  border-radius: 0px;
  background: linear-gradient(180deg, #161d25, #12171d);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: translateY(-100%);
}

@keyframes status-modal-slide-in {
  from {
    transform: translateY(-100%);
  }

  to {
    transform: translateY(0);
  }
}

.status-modal-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.status-modal-badge {
  min-width: 72px;
  min-height: 32px;
  padding: 6px 10px;
  border: var(--border-width) solid rgba(var(--modal-accent-rgb), 0.7);
  border-radius: 0px;
  background: rgba(var(--modal-accent-rgb), 0.16);
  color: var(--modal-accent-text);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
}

.status-modal-headcopy {
  display: grid;
  gap: 4px;
  min-width: 0;

  strong {
    color: #fff;
    font-size: 20px;
    line-height: 1.2;
  }

  span {
    color: var(--muted);
    font-size: 15px;
  }
}

.status-modal-close {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.status-modal-body {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.status-modal-message {
  margin: 0;
  color: #edf1f5;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status-modal-error {
  border: var(--border-width) solid rgba(var(--modal-accent-rgb), 0.85);
  background: rgba(var(--modal-accent-rgb), 0.12);
  color: #fff1ef;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status-step-list {
  display: grid;
  gap: 7px;
}

.status-step {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 30px;
  padding: 6px 8px;
  border: var(--border-width) solid var(--line-soft);
  background: #000;
}

.status-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);

  .button-icon,
  svg {
    width: 16px;
    height: 16px;
  }
}

.status-step-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-step-note {
  grid-column: 2;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-step-running .status-step-icon {
  color: var(--accent-3);
}

.status-step-done .status-step-icon {
  color: var(--accent);
}

.status-step-error {
  border-color: rgba(var(--accent-2-rgb), 0.8);
}

.status-step-error .status-step-icon,
.status-step-error .status-step-note {
  color: #ff6b70;
}

.status-modal-details {
  border: var(--border-width) solid var(--line-soft);
  border-radius: 0px;
  background: #0d1116;
  overflow: hidden;

  summary {
    cursor: pointer;
    padding: 10px 12px;
    color: #dce3e8;
    font-weight: 600;
    list-style: none;
  }

  summary::-webkit-details-marker {
    display: none;
  }

  pre {
    margin: 0;
    max-height: 100px;
    overflow: auto;
    padding: 0 12px 12px;
    color: #c9d4de;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
    -webkit-user-select: text;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.45;
  }
}

.status-modal[data-modal-class="saved-car-profile-conflict"] {
  .status-modal-dialog {
    height: min(78vh, 820px);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .status-modal-body {
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
  }

  .status-modal-details {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .status-modal-details pre {
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow: auto;
    scrollbar-gutter: stable;
  }
}

.status-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: flex-end;

  #statusModalOpenFolder {
    margin-right: auto;
  }

  .primary {
    background: var(--modal-accent);
    border-color: var(--modal-accent-border);
    color: var(--modal-accent-button-text);

    &:hover,
    &:focus-visible {
      background: var(--modal-accent-hover);
    }
  }
}

.confirm-modal[data-modal-class="export-package"] {
  .status-modal-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  #confirmModalAlternate,
  #confirmModalConfirm {
    width: 100%;
    justify-content: center;
  }

  #confirmModalAlternate {
    grid-column: 1;
  }

  #confirmModalConfirm {
    grid-column: 2;
  }
}

.startup-info-modal {
  z-index: 12100;
  place-items: start center;
  padding: 60px 24px 24px;

  .status-modal-dialog {
    width: min(620px, calc(100vw - 32px));
    transform: translateY(0);
  }
}

.startup-info-actions {
  align-items: center;
  justify-content: space-between;
}

.startup-info-dismiss {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;

  input {
    width: 16px;
    height: 16px;
  }
}

#statusModalClose {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.status-modal[data-blocked="true"] {
  .status-modal-backdrop,
  #statusModalClose {
    cursor: wait;
  }
}

.button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spinner-rotate 760ms linear infinite;
  display: inline-block;
}

#confirmModalConfirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.confirm-modal[data-action-layout="danger-left"] {
  #confirmModalConfirm {
    order: -1;
    margin-right: auto;
  }
}

.confirm-modal[data-busy="true"] {
  #confirmModalConfirm,
  #confirmModalCancel,
  #confirmModalAlternate,
  #confirmModalCloseX {
    cursor: wait;
  }
}

.package-extract-modal {
  z-index: 12200;

  .status-modal-dialog {
    width: min(720px, calc(100vw - 32px));
  }

  .status-modal-head {
    border-bottom-color: var(--line-soft);
  }
}

.package-extract-progress {
  display: grid;
  gap: 12px;
}

.package-extract-stats,
.package-extract-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

#liveryPreviewInfoModal {
  .status-modal-dialog {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
}

.livery-preview-info-body {
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.livery-preview-info-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;

  li {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: var(--border-width) solid var(--line);
  }

  strong {
    color: var(--ink);
  }

  span {
    color: var(--muted);
    line-height: 1.45;
  }
}

.livery-preview-info-note {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  line-height: 1.5;
}

.package-extract-metrics span:last-child {
  flex: 1 0 100%;
}

.package-extract-stats strong {
  color: #fff;
  font-size: 18px;
}

.package-extract-path {
  min-height: 44px;
  max-height: 92px;
  overflow: auto;
  padding: 10px 12px;
  border: var(--border-width) solid var(--line-soft);
  background: #05080c;
  color: #dce3e8;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}

#packageExtractModalBusy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: wait;
}

#packageExtractModalCancel[disabled] {
  cursor: wait;
}

@keyframes button-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.confirm-modal-details {
  border: var(--border-width) solid var(--line-soft);
  background: #000;
  color: #c9d4de;
  max-height: 100px;
  overflow: auto;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.confirm-modal-input {
  display: grid;
  gap: 6px;
}

.confirm-modal-option {
  display: grid;
  gap: 4px;
  margin-right: auto;
  max-width: min(360px, 52%);
  color: #dce3e8;
  font-size: 14px;
  text-align: left;

  > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  input {
    width: 16px;
    height: 16px;
  }

  small {
    color: var(--muted);
    line-height: 1.35;
  }
}

.confirm-modal-option[hidden] {
  display: none;
}

.confirm-modal-input[hidden] {
  display: none;
}

.confirm-modal:not([data-mode="input"]) .confirm-modal-input {
  display: none !important;
}

.confirm-modal[data-type="danger"] {
  --modal-accent: #a91518;
  --modal-accent-rgb: 228, 61, 48;
  --modal-accent-border: #ff4d55;
  --modal-accent-hover: #c51f24;
  --modal-accent-text: #fff1ef;
}

.status-modal[data-type="success"] {
  --modal-accent: #37e021;
  --modal-accent-rgb: 55, 224, 33;
  --modal-accent-border: #7cff6e;
  --modal-accent-hover: #2fc51d;
  --modal-accent-text: #e8ffe4;
}

.status-modal[data-type="warning"] {
  --modal-accent: #f7c948;
  --modal-accent-rgb: 247, 201, 72;
  --modal-accent-border: #ffe082;
  --modal-accent-hover: #dcae2e;
  --modal-accent-text: #fff4c2;
  --modal-accent-button-text: #090909;
}

.status-modal[data-type="error"] {
  --modal-accent: #e43d30;
  --modal-accent-rgb: 228, 61, 48;
  --modal-accent-border: #ff5a4f;
  --modal-accent-hover: #f04d42;
  --modal-accent-text: #fff1ef;
}
