// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC Sucursal en España SL

@use "refactor/common-refactor.scss" as deprecated;

.modal-overlay {
  @extend %modal-overlay-base;
}

.modal-container {
  @extend %modal-container-base;

  display: flex;
  flex-direction: column;
}

.modal-header {
  margin-bottom: deprecated.$s-24;
}

.modal-title {
  @include deprecated.uppercase-title-typography;

  color: var(--modal-title-foreground-color);
}

.modal-close-btn {
  @extend %modal-close-btn-base;
}

.modal-content {
  @include deprecated.body-small-typography;

  flex: 1;
  overflow: hidden auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: deprecated.$s-16;
  margin-bottom: deprecated.$s-24;
  min-height: 40px;
}

.status-message {
  @include deprecated.body-small-typography;

  color: var(--modal-title-foreground-color);
  font-style: italic;
}

.action-buttons {
  @extend %modal-action-btns;
}

.cancel-button {
  @extend %modal-cancel-btn;
}

.accept-btn {
  @extend %modal-accept-btn;

  &.danger {
    @extend %modal-danger-btn;
  }
}

.modal-scd-msg,
.modal-subtitle,
.modal-msg {
  @include deprecated.body-small-typography;

  color: var(--modal-text-foreground-color);
  line-height: 1.5;
}

.file-entry {
  display: flex;

  .file-name {
    @include deprecated.flex-row;

    .file-icon {
      @include deprecated.flex-center;

      height: deprecated.$s-24;
      width: deprecated.$s-16;

      svg {
        @extend %button-icon;

        stroke: var(--icon-foreground);
      }

      &.icon-fill svg {
        fill: var(--icon-foreground);
      }
    }

    .file-name-edit {
      @extend %input-element;
      @include deprecated.body-small-typography;

      flex-grow: 1;
    }

    .file-name-label {
      @include deprecated.body-small-typography;

      display: flex;
      align-items: center;
      gap: deprecated.$s-12;
      flex-grow: 1;

      .icon {
        @include deprecated.flex-center;

        height: deprecated.$s-16;
        width: deprecated.$s-16;

        svg {
          @extend %button-icon-small;

          stroke: var(--icon-foreground);
        }
      }
    }

    .edit-entry-buttons {
      @include deprecated.flex-row;

      button {
        @extend %button-tertiary;

        width: deprecated.$s-28;
        height: deprecated.$s-32;

        svg {
          @extend %button-icon;

          stroke: var(--icon-foreground);
        }
      }
    }
  }

  .error-message,
  .progress-message {
    display: flex;
    align-items: center;
    min-height: deprecated.$s-32;
    color: var(--modal-text-foreground-color);
  }

  .error-message {
    align-items: flex-start;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .linked-library {
    display: flex;
    align-items: center;
    gap: deprecated.$s-12;
    color: var(--modal-text-foreground-color);

    .linked-library-tag {
      @include deprecated.flex-center;

      height: deprecated.$s-24;
      width: deprecated.$s-24;

      svg {
        @extend %button-icon;

        stroke: var(--icon-foreground);
      }

      &.error {
        svg {
          stroke: var(--element-foreground-error);
        }
      }
    }
  }

  &.loading {
    .file-name {
      color: var(--modal-text-foreground-color);
    }
  }

  &.warning {
    .file-name {
      color: var(--element-foreground-warning);

      .file-icon svg {
        stroke: var(--element-foreground-warning);
      }

      .file-icon.icon-fill svg {
        fill: var(--element-foreground-warning);
      }
    }
  }

  &.success {
    .file-name {
      color: var(--modal-text-foreground-color);

      .file-icon svg {
        stroke: var(--modal-text-foreground-color);
      }

      .file-icon.icon-fill svg {
        fill: var(--modal-text-foreground-color);
      }
    }
  }

  &.error {
    .file-name {
      color: var(--modal-text-foreground-color);

      .file-icon svg {
        stroke: var(--modal-text-foreground-color);
      }

      .file-icon.icon-fill svg {
        fill: var(--modal-text-foreground-color);
      }
    }
  }

  &.editable {
    .file-name {
      color: var(--modal-text-foreground-color);

      .file-icon svg {
        stroke: var(--modal-text-foreground-color);
      }

      .file-icon.icon-fill svg {
        fill: var(--modal-text-foreground-color);
      }
    }
  }
}

.context-notification-error {
  --context-notification-bg-color: var(--modal-background-color);
}

.import-error-disclaimer {
  color: var(--color-foreground-secondary);
}

.import-error-list {
  padding: 0 var(--sp-l);
  list-style: disc;
}

.import-error-list-enry {
  padding: var(--sp-xs) 0;
}

.import-error-detail {
  @include deprecated.body-small-typography;

  margin-top: var(--sp-xs);
  color: var(--modal-text-foreground-color);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
