/*
 * Technicks notification + confirmation system.
 *
 * Colours are pulled from the tokens the two interfaces already define:
 *   - public site: --theme (#fbc108), --header (#072f52), --text, --white
 *   - admin:       --technicks-gold, --technicks-navy, --vz-* (Velzon/Bootstrap)
 * Nothing here invents a new palette; every fallback is a Technicks token.
 */

:root {
  --an-gold: var(--technicks-gold, var(--theme, #fbc108));
  --an-gold-hover: #e5ad07;
  --an-navy: var(--technicks-navy, var(--header, #072f52));
  --an-text: var(--text, #534f5a);
  --an-surface: var(--vz-secondary-bg, #ffffff);
  --an-border: var(--vz-border-color, #e3e5e8);
  --an-muted-surface: var(--vz-tertiary-bg, #f4f5f7);
  --an-success: var(--vz-success, #0ab39c);
  --an-danger: var(--vz-danger, #f06548);
  --an-warning: var(--vz-warning, #f7b84b);
  --an-info: var(--vz-info, #299cdb);
  --an-overlay: rgba(7, 15, 32, 0.58);
  --an-radius: 1.35rem;
  --an-z: 100100;
}

html.app-notify-lock,
html.app-notify-lock body {
  overflow: hidden !important;
}

.app-notify {
  position: fixed;
  inset: 0;
  z-index: var(--an-z);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
}

.app-notify[hidden] {
  display: none;
}

/* Backdrop ---------------------------------------------------------------- */

.app-notify__backdrop {
  position: absolute;
  inset: 0;
  background: var(--an-overlay);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.app-notify.is-open .app-notify__backdrop {
  opacity: 1;
}

/* Dialog ------------------------------------------------------------------ */

.app-notify__dialog {
  position: relative;
  box-sizing: border-box;
  width: min(100%, 34rem);
  max-height: calc(100vh - 2.5rem);
  max-height: calc(100dvh - 2.5rem);
  overflow-y: auto;
  padding: clamp(1.6rem, 4vw, 2.4rem);
  background: var(--an-surface);
  border: 1px solid rgba(7, 47, 82, 0.06);
  border-radius: var(--an-radius);
  box-shadow:
    0 30px 70px -18px rgba(7, 15, 32, 0.45),
    0 8px 22px -10px rgba(7, 15, 32, 0.22);
  text-align: center;
  opacity: 0;
  transform: translateY(14px) scale(0.955);
  transition:
    opacity 0.2s ease,
    transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  outline: none;
}

.app-notify.is-open .app-notify__dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-notify.is-closing .app-notify__dialog {
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition-duration: 0.16s;
}

.app-notify.is-closing .app-notify__backdrop {
  opacity: 0;
  transition-duration: 0.18s;
}

/* Tone -------------------------------------------------------------------- */

.app-notify {
  --an-tone: var(--an-gold);
  --an-tone-soft: rgba(251, 193, 8, 0.16);
  --an-tone-ink: var(--an-navy);
  --an-btn-bg: var(--an-gold);
  --an-btn-bg-hover: var(--an-gold-hover);
  --an-btn-fg: var(--an-navy);
}

.app-notify[data-type="success"] {
  --an-tone: var(--an-success);
  --an-tone-soft: rgba(10, 179, 156, 0.14);
  --an-tone-ink: var(--an-success);
  --an-btn-bg: var(--an-success);
  --an-btn-bg-hover: #089b87;
  --an-btn-fg: #ffffff;
}

.app-notify[data-type="danger"] {
  --an-tone: var(--an-danger);
  --an-tone-soft: rgba(240, 101, 72, 0.14);
  --an-tone-ink: var(--an-danger);
  --an-btn-bg: var(--an-danger);
  --an-btn-bg-hover: #dd5638;
  --an-btn-fg: #ffffff;
}

.app-notify[data-type="warning"] {
  --an-tone: var(--an-warning);
  --an-tone-soft: rgba(247, 184, 75, 0.18);
  --an-tone-ink: #9a6400;
  --an-btn-bg: var(--an-warning);
  --an-btn-bg-hover: #eaae3e;
  --an-btn-fg: #2b2205;
}

.app-notify[data-type="info"] {
  --an-tone: var(--an-info);
  --an-tone-soft: rgba(41, 156, 219, 0.14);
  --an-tone-ink: var(--an-info);
  --an-btn-bg: var(--an-info);
  --an-btn-bg-hover: #228bc4;
  --an-btn-fg: #ffffff;
}

/* Icon -------------------------------------------------------------------- */

.app-notify__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.4rem;
  height: 4.4rem;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  background: var(--an-tone-soft);
  color: var(--an-tone-ink);
}

.app-notify__icon svg {
  width: 2.2rem;
  height: 2.2rem;
  display: block;
}

/* Copy -------------------------------------------------------------------- */

.app-notify__title {
  margin: 0;
  color: var(--an-navy);
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.app-notify__message {
  margin: 0.65rem auto 0;
  max-width: 28rem;
  color: var(--an-text);
  font-size: 1rem;
  line-height: 1.65;
}

.app-notify__message:empty {
  display: none;
}

/* Prompt ------------------------------------------------------------------ */

.app-notify__field {
  margin: 1.25rem auto 0;
  max-width: 27rem;
  text-align: left;
}

.app-notify__label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--an-navy);
  font-size: 0.85rem;
  font-weight: 600;
}

.app-notify__input {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.9rem;
  color: var(--an-navy);
  font: inherit;
  font-size: 1rem;
  background: var(--an-surface);
  border: 1px solid var(--an-border);
  border-radius: 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-notify__input:focus {
  outline: none;
  border-color: var(--an-gold);
  box-shadow: 0 0 0 3px rgba(251, 193, 8, 0.28);
}

.app-notify__input[aria-invalid="true"] {
  border-color: var(--an-danger);
  box-shadow: 0 0 0 3px rgba(240, 101, 72, 0.18);
}

.app-notify__field-error {
  margin: 0.4rem 0 0;
  color: var(--an-danger);
  font-size: 0.85rem;
}

.app-notify__field-error:empty {
  display: none;
}

/* Actions ----------------------------------------------------------------- */

.app-notify__actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.app-notify__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1 1 0;
  min-height: 3.1rem;
  padding: 0.8rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.app-notify__btn--primary {
  flex-grow: 1.25;
  color: var(--an-btn-fg);
  background: var(--an-btn-bg);
  border-color: var(--an-btn-bg);
  box-shadow: 0 8px 18px -10px rgba(7, 15, 32, 0.55);
}

.app-notify__btn--primary:hover {
  background: var(--an-btn-bg-hover);
  border-color: var(--an-btn-bg-hover);
}

.app-notify__btn--primary:active {
  transform: translateY(1px);
  box-shadow: none;
}

.app-notify__btn--secondary {
  color: var(--an-navy);
  background: var(--an-surface);
  border-color: var(--an-border);
}

.app-notify__btn--secondary:hover {
  background: var(--an-muted-surface);
  border-color: #cdd3db;
}

.app-notify__btn--secondary:active {
  transform: translateY(1px);
}

.app-notify__btn:focus-visible,
.app-notify__close:focus-visible {
  outline: 3px solid rgba(251, 193, 8, 0.55);
  outline-offset: 2px;
}

.app-notify__btn:disabled,
.app-notify__btn[aria-disabled="true"] {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.app-notify__btn[hidden] {
  display: none;
}

/* Loading spinner --------------------------------------------------------- */

.app-notify__spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: an-spin 0.7s linear infinite;
}

.app-notify__btn.is-loading .app-notify__spinner {
  display: inline-block;
}

@keyframes an-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Close ------------------------------------------------------------------- */

.app-notify__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  color: #6b7280;
  font-size: 1.35rem;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-notify__close:hover {
  color: var(--an-navy);
  background: var(--an-muted-surface);
}

.app-notify__close[hidden] {
  display: none;
}

/* Supporting text --------------------------------------------------------- */

.app-notify__support {
  margin: 1.1rem auto 0;
  max-width: 27rem;
  color: #7c8798;
  font-size: 0.82rem;
  line-height: 1.5;
}

.app-notify__support:empty {
  display: none;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 575.98px) {
  .app-notify {
    padding: 0.9rem;
    padding-top: max(0.9rem, env(safe-area-inset-top));
    padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
    align-items: center;
  }

  .app-notify__dialog {
    width: 100%;
    max-height: calc(100vh - 1.8rem);
    max-height: calc(100dvh - 1.8rem);
    padding: 1.5rem 1.15rem 1.35rem;
    border-radius: 1.15rem;
  }

  .app-notify__icon {
    width: 3.8rem;
    height: 3.8rem;
    margin-bottom: 0.9rem;
  }

  .app-notify__icon svg {
    width: 1.9rem;
    height: 1.9rem;
  }

  .app-notify__title {
    font-size: 1.2rem;
  }

  .app-notify__message {
    font-size: 0.95rem;
  }

  .app-notify__actions {
    flex-direction: column-reverse;
    gap: 0.6rem;
    margin-top: 1.35rem;
  }

  .app-notify__btn {
    flex: 0 0 auto;
    width: 100%;
    min-height: 3rem;
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-notify__backdrop,
  .app-notify__dialog,
  .app-notify.is-closing .app-notify__dialog,
  .app-notify.is-closing .app-notify__backdrop,
  .app-notify__btn {
    transition: none !important;
  }

  .app-notify__spinner {
    animation-duration: 1.6s;
  }
}

@media (forced-colors: active) {
  .app-notify__dialog {
    border: 2px solid CanvasText;
  }

  .app-notify__btn {
    border: 1px solid ButtonText;
  }
}
