/* ==========================================================================
   SweetAlert in dark mode
   Loaded right after sweetalert/dist/sweetalert.css on every page that uses
   it, signed in or not. Every rule is under html.dark-theme, so light mode
   stays as it was.

   The logged-out pages have no theme-variables.css, so each colour falls back
   to the dark theme's value.
   ========================================================================== */

html.dark-theme .sweet-overlay {
  background-color: var(--color-overlay, rgba(0, 0, 0, 0.7)) !important;
}

html.dark-theme .sweet-alert {
  background-color: var(--color-bg-primary, #1a1a1a) !important;
  border: 1px solid var(--color-border-medium, #4a4a4a) !important;
  box-shadow: 0 4px 20px var(--color-shadow-dark, rgba(0, 0, 0, 0.5)) !important;
}

html.dark-theme .sweet-alert h2 {
  color: var(--color-text-primary, #e0e0e0) !important;
}

html.dark-theme .sweet-alert p {
  color: var(--color-text-secondary, #b0b0b0) !important;
}

html.dark-theme .sweet-alert input,
html.dark-theme .sweet-alert textarea {
  background-color: var(--color-bg-input, #2a2a2a) !important;
  color: var(--color-text-primary, #e0e0e0) !important;
  border-color: var(--color-border-medium, #4a4a4a) !important;
}

html.dark-theme .sweet-alert button.cancel {
  background-color: var(--color-bg-tertiary, #2a2a2a) !important;
  color: var(--color-text-primary, #e0e0e0) !important;
  border: 1px solid var(--color-border-medium, #4a4a4a) !important;
}

html.dark-theme .sweet-alert button.cancel:hover {
  background-color: var(--color-bg-hover, #333333) !important;
}

html.dark-theme .sweet-alert .sa-error-container {
  background-color: var(--color-bg-secondary, #252525) !important;
}

/* The success icon draws its check animation with two half-moons and a thin
   bar painted white to hide parts of the ring. On a dark popup they show as a
   white disc, bars poking out at the corners, and a line across the check, so
   paint them the popup's colour instead. */
html.dark-theme .sweet-alert .sa-icon.sa-success::before,
html.dark-theme .sweet-alert .sa-icon.sa-success::after,
html.dark-theme .sweet-alert .sa-icon.sa-success .sa-fix {
  background: var(--color-bg-primary, #1a1a1a) !important;
}

/* The X logo is a black square, so give it an edge on the dark popup */
html.dark-theme .sweet-alert .twitter-icon {
  box-shadow: 0 0 0 1px var(--color-border-medium, #4a4a4a);
}
