@use "_theme.scss";

.recipient-list-content {
  padding-top: 5px;

  .recipient-list-file-input {
    display: none;
  }

  // Download Template Link
  .recipient-list-download-template {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #187790;
    font-size: var(--text-size-regular);
    margin-bottom: 15px;
    
    svg path {
      fill: #187790;
    }

    span {
      text-decoration: underline;
    }

    &:hover {
      opacity: 0.8;
    }
  }

  // Desktop Drag & Drop Zone
  .recipient-list-dropzone {
    border: none;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: background-color 0.2s;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='8' ry='8' stroke='%23D6D6D6' stroke-width='2' stroke-dasharray='6%2c 4' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");

    &.drag-over {
      background-color: #F1F1F3;
      .recipient-list-upload-button {
        background-color: #FFFFFF
      }
    }

    &.has-error {
      background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='8' ry='8' stroke='%23d90e04' stroke-width='2' stroke-dasharray='6%2c 4' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
    }

    .recipient-list-dropzone-content {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
    }

    .recipient-list-drag-text {
      color: var(--text-color-dark);
      font-size: var(--text-size-regular);
    }

    .recipient-list-uploading {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 60px;

      .loading-dots {
        display: flex;
        align-items: center;
        width: 44px;
        height: 9px;
        
        .loading-dot {
          background: var(--color-highlight) !important;
        }
      }
    }
  }

  // Upload Button
  .recipient-list-upload-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    background-color: transparent;
    border: 1px solid var(--color-line);
    padding: 10px 20px;
    border-radius: 5px;
    font-size: var(--text-size-regular);
    color: var(--text-color-dark);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;

    &:hover:not(:disabled) {
      background-color: var(--color-background-light);
    }

    &:disabled {
      cursor: not-allowed;
      
      &:not(:has(.loading-dots)) {
        opacity: 0.6;
      }
    }

    &.has-error {
      border-color: var(--color-error);
    }
  }

  // Mobile Layout
  .recipient-list-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;

    .recipient-list-upload-button {
      width: 100%;
      justify-content: center;
      padding: 12px 20px;

      .loading-dots {
        display: flex;
        align-items: center;
        width: 44px;
        height: 9px;
        
        .loading-dot {
          background: var(--color-highlight) !important;
        }
      }
    }
  }

  // Supported Files Message
  .recipient-list-supported-files {
    margin-top: 4px;
    font-size: var(--text-size-fineprint);
    color: var(--text-color-medium);
  }

  // Error Message
  .recipient-list-error {
    margin-top: 10px;
    color: var(--color-error);
    font-size: var(--text-size-regular);
  }

  // Uploaded File Info
  .recipient-list-file-info {
    display: flex;
    align-items: center;
    margin-top: 10px;
    background-color: var(--color-background-light);
    border-radius: 5px;
    font-size: var(--text-size-regular);
    color: #187790;

    svg path {
      fill: #187790;
    }

    > * {
      margin-right: 5px;
    }

    &.deleted {
      background-color: rgba(var(--color-error-rgb), 0.1);
    }

    .recipient-list-file-download {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      text-decoration: none;
      color: inherit;
      flex: 0 1 auto;
      min-width: 0;
      overflow: hidden;

      .recipient-list-file-name {
        text-decoration: underline;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      &:hover {
        opacity: 0.8;
      }
    }

    .recipient-list-file-name {
      flex: 0 1 auto;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .recipient-list-recipients-count {
      white-space: nowrap;
    }

    .recipient-list-deleted-message {
      color: var(--color-error);
      font-style: italic;
    }

    .recipient-list-delete-button {
      margin-left: 7px;
      margin-right: 0;
      background: none;
      border: none;
      padding: 5px;
      cursor: pointer;
      display: flex;
      align-items: center;
      transition: opacity 0.2s;

      svg path {
        fill: none;
        stroke: #187790;
      }

      &:hover {
        color: var(--color-error);
      }
    }
  }
}

// Button after RecipientListContent
.recipient-list-content + .button {
  margin-top: 30px;
}
