/* -------------------------------------------------------------------------------------------------
 * AlertDialog Component Styles
 * Block: alert-dialog
 * -----------------------------------------------------------------------------------------------*/

/**
 * Element: trigger - the element that opens the modal
 */
.alert-dialog__trigger {
  @apply cursor-(--cursor-interactive);

  /**
   * Transitions
   * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
   */
  transition:
    transform 250ms var(--ease-out-quart),
    background-color 150ms var(--ease-smooth),
    box-shadow 150ms var(--ease-out);
  @apply motion-reduce:transition-none;

  /* Focus state */
  &:focus-visible:not(:focus),
  &[data-focus-visible="true"] {
    @apply status-focused;
  }

  /* Disabled state */
  &:disabled,
  &[aria-disabled="true"] {
    @apply status-disabled;
  }

  /* Active/pressed state */
  &:active,
  &[data-pressed="true"] {
    transform: scale(0.97);
  }
}

/**
 * Element: backdrop - the overlay behind the dialog
 */
.alert-dialog__backdrop {
  @apply fixed inset-0 z-50;
  @apply flex flex-row items-center justify-center;
  @apply h-(--visual-viewport-height) w-full;

  /* Entering animation */
  &[data-entering="true"] {
    @apply animate-in duration-150 ease-out fade-in-0;
  }

  /* Exiting animation */
  &[data-exiting="true"] {
    @apply animate-out duration-100 ease-out fade-out-0;
  }

  /**
   * Reduce Animation
   * CRITICAL: motion-reduce must be AFTER animate for correct override specificity
   */
  &[data-exiting="true"],
  &[data-entering="true"] {
    @apply will-change-[opacity];
    @apply motion-reduce:animate-none;
  }
}

/**
 * Modifier: backdrop--transparent
 */
.alert-dialog__backdrop--transparent {
  @apply bg-transparent;
}

/**
 * Modifier: backdrop--opaque
 */
.alert-dialog__backdrop--opaque {
  @apply bg-black/50 dark:bg-black/60;
}

/**
 * Modifier: backdrop--blur
 */
.alert-dialog__backdrop--blur {
  @apply bg-black/50 backdrop-blur-md dark:bg-black/60;
}

/**
 * Element: container - the positioning wrapper for the modal
 */
.alert-dialog__container {
  @apply flex flex-col items-center;
  @apply h-(--visual-viewport-height) w-full min-w-0 flex-1;
  @apply p-4;
  @apply sm:w-fit sm:p-10;
  @apply pointer-events-none;

  /* Entering animation */
  &[data-entering="true"] {
    @apply animate-in duration-250 ease-out-quad fade-in-0 zoom-in-105;

    &[data-placement="auto"] {
      @apply slide-in-from-bottom-1;
      @apply sm:slide-in-from-bottom-0;
    }

    &[data-placement="top"] {
      @apply slide-in-from-top-1;
    }

    &[data-placement="center"] {
      @apply slide-in-from-top-0;
    }

    &[data-placement="bottom"] {
      @apply slide-in-from-bottom-1;
    }
  }

  /* Exiting animation */
  &[data-exiting="true"] {
    @apply animate-out duration-100 ease-out-quad fade-out-0 zoom-out-95;
  }

  /**
   * Reduce Animation
   * CRITICAL: motion-reduce must be AFTER animate for correct override specificity
   */
  &[data-exiting="true"],
  &[data-entering="true"] {
    @apply will-change-[opacity,transform];
    @apply motion-reduce:animate-none;
  }
}

/**
 * Element: dialog - the content container for the modal
 */
.alert-dialog__dialog {
  @apply relative;
  @apply flex w-full flex-col;
  @apply rounded-3xl bg-overlay shadow-overlay outline-none;
  @apply p-6;
  @apply overflow-hidden;
  @apply pointer-events-auto;

  &[data-placement="auto"] {
    @apply mt-auto;
    @apply sm:my-auto;
  }

  &[data-placement="center"] {
    @apply my-auto;
  }

  &[data-placement="bottom"] {
    @apply mt-auto;
  }

  &[data-placement="top"] {
    @apply mt-0;
  }
}

/**
 * Modifier: dialog--xs
 */
.alert-dialog__dialog--xs {
  @apply max-w-xs;
}

/**
 * Modifier: dialog--sm
 */
.alert-dialog__dialog--sm {
  @apply max-w-sm;
}

/**
 * Modifier: dialog--md
 */
.alert-dialog__dialog--md {
  @apply max-w-md;
}

/**
 * Modifier: dialog--lg
 */
.alert-dialog__dialog--lg {
  @apply max-w-lg;
}

/**
 * Modifier: dialog--cover
 */
.alert-dialog__dialog--cover {
  @apply h-full min-h-full w-full;
}

/**
 * Element: header - the top section with the title
 */
.alert-dialog__header {
  @apply flex flex-col gap-3;
  @apply mb-0;

  /* When header contains icon, use flex-col layout with gap */
  & > .modal__icon {
    @apply mb-0;
  }
}

/**
 * Element: heading - the main title text
 */
.alert-dialog__heading {
  @apply align-middle;
  @apply text-base font-medium text-foreground;
}

/**
 * Element: icon - the optional icon indicator
 */
.alert-dialog__icon {
  @apply flex items-center justify-center;
  @apply size-10 shrink-0;
  @apply rounded-full select-none;

  [data-slot="alert-dialog-default-icon"] {
    @apply box-content size-5;
  }
}

/**
 * Modifier: icon--default
 */
.alert-dialog__icon--default {
  @apply bg-default text-foreground;
}

/**
 * Modifier: icon--accent
 */
.alert-dialog__icon--accent {
  @apply bg-accent-soft text-accent-soft-foreground;
}

/**
 * Modifier: icon--success
 */
.alert-dialog__icon--success {
  @apply bg-success-soft text-success-soft-foreground;
}

/**
 * Modifier: icon--warning
 */
.alert-dialog__icon--warning {
  @apply bg-warning-soft text-warning-soft-foreground;
}

/**
 * Modifier: icon--danger
 */
.alert-dialog__icon--danger {
  @apply bg-danger-soft text-danger-soft-foreground;
}

/**
 * Element: body - the main content area
 */
.alert-dialog__body {
  @apply min-h-0 flex-1;
  @apply text-sm leading-[1.43] text-muted;
  @apply my-0;
  @apply overflow-y-auto;
  -webkit-overflow-scrolling: touch;
}

/**
 * Element: footer - the bottom action section
 */
.alert-dialog__footer {
  @apply flex flex-row items-center justify-end gap-2;
  @apply mt-0;
}

/**
 * Element: close-trigger - the optional x icon button to close the modal
 */
.alert-dialog__close-trigger {
  @apply absolute top-4 right-4;
}

/**
 * Elements Spacing
 */
.alert-dialog__header + .alert-dialog__body {
  @apply mt-2;
}

.alert-dialog__header + .alert-dialog__footer {
  @apply mt-5;
}

.alert-dialog__body + .alert-dialog__footer {
  @apply mt-5;
}
