/* ========================================
   MFA-Dialog beim Login
======================================== */

.customer-mfa-dialog {
  width: min(calc(100% - 2rem), 520px);
  max-height: calc(100dvh - 2rem);
  padding: 0;

  overflow: hidden;

  border: none;
  border-radius: 12px;

  background: var(--card);
  color: var(--card-foreground);

  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.16);
}

.customer-mfa-dialog[open] {
  animation: customer-mfa-dialog-in 0.2s ease-out;
}

.customer-mfa-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);

  animation: customer-mfa-backdrop-in 0.2s ease-out;
}


/* ========================================
   Dialoginhalt
======================================== */

.customer-mfa-dialog__content {
  position: relative;

  max-height: calc(100dvh - 2rem);
  margin: 0;
  padding: 2rem;

  display: flex;
  flex-direction: column;
  gap: 1.5rem;

  overflow-y: auto;
}

.customer-mfa-dialog__content h2 {
  margin: 0;
  padding-right: 2.5rem;

  color: var(--foreground);
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
}

.customer-mfa-dialog__content > p:not(.customer-mfa-dialog__error) {
  margin: 0;

  color: var(--color-text-light);
  font-size: 0.95rem;
  font-weight: var(--font-weight-light);
  line-height: 1.55;
}


/* ========================================
   Dialog schließen
======================================== */

.customer-mfa-dialog__close {
  position: absolute;
  top: 1rem;
  right: 1rem;

  width: 36px;
  height: 36px;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 6px;

  background: transparent;
  color: var(--color-text-light);

  font: inherit;
  font-size: 1.5rem;
  font-weight: var(--font-weight-normal);
  line-height: 1;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.customer-mfa-dialog__close:hover {
  background: var(--secondary);
  color: var(--color-accent);
}

.customer-mfa-dialog__close:focus-visible {
  outline: 3px solid rgb(var(--color-accent-rgb) / 0.2);
  outline-offset: 2px;
}


/* ========================================
   Bestätigungsmethode
======================================== */

.customer-mfa-dialog__methods {
  min-width: 0;
  margin: 0;
  padding: 1rem;

  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: var(--color-bg);
}

.customer-mfa-dialog__methods legend {
  padding: 0 0.4rem;

  color: var(--foreground);
  font-size: 0.9rem;
  font-weight: var(--font-weight-bold);
}

.customer-mfa-dialog__methods label {
  min-width: 0;
  min-height: 48px;
  padding: 0.75rem;

  display: flex;
  align-items: center;
  gap: 0.6rem;

  border: 1px solid var(--border);
  border-radius: 8px;

  background: var(--color-white);
  color: var(--foreground);

  cursor: pointer;

  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.customer-mfa-dialog__methods label:hover {
  border-color: rgb(var(--color-accent-rgb) / 0.45);
  background: #fff7fc;
}

.customer-mfa-dialog__methods label:has(input:checked) {
  border-color: var(--color-accent);
  background: #fff7fc;
  box-shadow: 0 0 0 1px rgb(var(--color-accent-rgb) / 0.12);
}

.customer-mfa-dialog__methods label:has(input:focus-visible) {
  outline: 3px solid rgb(var(--color-accent-rgb) / 0.2);
  outline-offset: 2px;
}

.customer-mfa-dialog__methods input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;

  flex-shrink: 0;

  accent-color: var(--color-accent);
  cursor: pointer;
}

.customer-mfa-dialog__methods span {
  min-width: 0;

  font-size: 0.9rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
}


/* ========================================
   Code-Eingabe
======================================== */

.customer-mfa-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  min-width: 0;
}

.customer-mfa-dialog__field label {
  color: #334155;
  font-size: 0.875rem;
  font-weight: var(--font-weight-bold);
}

.customer-mfa-dialog__field input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0.9rem 1rem;

  border: 1px solid #cbd5e1;
  border-radius: 8px;

  background: var(--color-white);
  color: var(--foreground);

  font: inherit;
  font-size: 1rem;
  font-weight: var(--font-weight-normal);

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.customer-mfa-dialog__field input:hover {
  border-color: rgb(var(--color-accent-rgb) / 0.55);
}

.customer-mfa-dialog__field input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgb(var(--color-accent-rgb) / 0.12);
}

/*
 * Beim Authenticator-Code erhöht JavaScript maxlength auf 6.
 * Dadurch erhält nur der sechsstellige Code die größere
 * Zeichenaufteilung, nicht aber ein Recovery-Code.
 */
.customer-mfa-dialog__field input[maxlength="6"] {
  font-size: 1.2rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.25em;
  font-variant-numeric: tabular-nums;
}

.customer-mfa-dialog__field input[aria-invalid="true"] {
  border-color: #ec0909;
  background: #fff7f7;
}

.customer-mfa-dialog__field input[aria-invalid="true"]:focus {
  border-color: #ec0909;
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(236, 9, 9, 0.12);
}


/* ========================================
   Fehlermeldung
======================================== */

.customer-mfa-dialog__error {
  margin: -0.5rem 0 0;
  padding: 0.75rem;

  border-left: 4px solid #ec0909;
  border-radius: 6px;

  background: #fff7f7;
  color: #b91c1c;

  font-size: 0.875rem;
  font-weight: var(--font-weight-normal);
  line-height: 1.45;
}

.customer-mfa-dialog__error[hidden] {
  display: none;
}


/* ========================================
   Aktionen
======================================== */

.customer-mfa-dialog__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;

  padding-top: 0.25rem;
}

.customer-mfa-dialog__actions .btn {
  width: 100%;
  min-width: 0;
  min-height: 52px;
}

/*
 * In der bereitgestellten base-style.css existiert bisher
 * keine allgemeine Definition für .btn--secondary.
 */
.customer-mfa-dialog__actions .btn--secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);

  box-shadow: none;
}

.customer-mfa-dialog__actions .btn--secondary:hover {
  background: #dfe1e7;
  color: var(--foreground);

  transform: translateY(-1px);
}

.customer-mfa-dialog__actions .btn--secondary:active {
  transform: translateY(1px);
}

.customer-mfa-dialog__actions .btn:focus-visible {
  outline: 3px solid rgb(var(--color-accent-rgb) / 0.2);
  outline-offset: 2px;
}

.customer-mfa-dialog__actions .btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.customer-mfa-dialog__actions
  [data-customer-mfa-submit][aria-busy="true"] {
  cursor: wait;
}


/* ========================================
   Animationen
======================================== */

@keyframes customer-mfa-dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes customer-mfa-backdrop-in {
  from {
    background: rgba(15, 23, 42, 0);
  }

  to {
    background: rgba(15, 23, 42, 0.65);
  }
}


/* ========================================
   Responsive
======================================== */

@media (max-width: 600px) {
  .customer-mfa-dialog {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .customer-mfa-dialog__content {
    max-height: calc(100dvh - 1rem);
    padding: 1.5rem;
    gap: 1.25rem;
  }

  .customer-mfa-dialog__content h2 {
    font-size: 1.3rem;
  }

  .customer-mfa-dialog__methods {
    grid-template-columns: 1fr;
  }

  .customer-mfa-dialog__actions {
    grid-template-columns: 1fr;
  }

  .customer-mfa-dialog__actions
    [data-customer-mfa-submit] {
    order: 1;
  }

  .customer-mfa-dialog__actions
    [data-customer-mfa-cancel] {
    order: 2;
  }
}


/* ========================================
   Reduzierte Bewegung
======================================== */

@media (prefers-reduced-motion: reduce) {
  .customer-mfa-dialog[open],
  .customer-mfa-dialog::backdrop {
    animation: none;
  }
}