@use '@/styles/variables' as *;
@use '@/styles/mixins' as *;

.modal {
  @include fixed-fill;
  z-index: $z-index-modal;
  @include flex-center;

  &__mask {
    @include absolute-fill;
    background-color: rgba(0, 0, 0, 0.45);
    animation: fadeIn $duration-fast $ease-out;
  }

  &__wrapper {
    position: relative;
    max-height: calc(100vh - 100px);
    max-width: calc(100vw - 32px);
  }

  &__content {
    background-color: $card-background;
    border-radius: $border-radius-lg;
    box-shadow: $shadow-xl;
    animation: scaleIn $duration-base $ease-out;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
  }

  &__header {
    @include flex-between;
    padding: $padding-modal;
    padding-bottom: $spacing-base;
    border-bottom: 1px solid $border-color;
    flex-shrink: 0;
  }

  &__title {
    font-size: $font-size-lg;
    font-weight: $font-weight-semibold;
    color: $text-primary;
    margin: 0;
  }

  &__close {
    @include flex-center;
    width: 32px;
    height: 32px;
    border-radius: $border-radius-sm;
    color: $text-secondary;
    @include transition-fast;

    &:hover {
      background-color: $background-color;
      color: $text-primary;
    }

    svg {
      width: 20px;
      height: 20px;
    }
  }

  &__body {
    padding: $padding-modal;
    overflow-y: auto;
    flex: 1;
    @include custom-scrollbar;
  }

  &__footer {
    @include flex-start;
    justify-content: flex-end;
    gap: $spacing-sm;
    padding: $padding-modal;
    padding-top: $spacing-base;
    border-top: 1px solid $border-color;
    flex-shrink: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
