.book-uploader {
  width: 700px;
  max-width: 700px;
  display: flex;
  flex-direction: column;

  @media (max-width: 768px) {
    width: 100%;
    max-width: 100%;
  }
}

.panel-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1.25rem 1.5rem;
  border-radius: 10px 10px 0 0;
  border: 1px solid var(--border-color);
  border-bottom: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);

  .header-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 10px;


    .header-icon {
      font-size: 1.5rem;
      color: var(--primary-contrast-color);
    }
  }

  .header-text {
    flex: 1;

    .panel-title {
      margin: 0 0 0.25rem 0;
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--text-color);
    }

    .panel-description {
      margin: 0;
      font-size: 0.875rem;
      color: var(--text-secondary-color);
    }
  }

  .close-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
  }

  @media (max-width: 480px) {
    padding: 1rem;

    .header-icon-wrapper {
      width: 40px;
      height: 40px;

      .header-icon {
        font-size: 1.25rem;
      }
    }

    .header-text {
      .panel-title {
        font-size: 1.125rem;
      }

      .panel-description {
        font-size: 0.8rem;
      }
    }

    .close-button {
      top: 0.5rem;
      right: 0.5rem;

      ::ng-deep .p-button {
        width: 2rem;
        height: 2rem;
      }
    }
  }
}

.upload-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.75rem;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);

  @media (max-width: 480px) {
    padding: 1rem;
    gap: 1rem;
  }
}

.destination-section,
.library-selection,
.file-upload-section {
  display: flex;
  flex-direction: column;

  .section-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 0.875rem;
    background: var(--overlay-background);
    border-radius: 6px;

    .section-title {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--text-color);

      i {
        color: var(--primary-color);
        font-size: 1rem;
      }
    }

    @media (max-width: 480px) {
      padding: 0.5rem 0.625rem;

      .section-title {
        font-size: 0.85rem;
      }
    }
  }
}

.destination-selector {
  display: flex;
  justify-content: center;
}

.selection-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 0.75rem 1rem 0.75rem;

  .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    .field-label {
      font-size: 0.875rem;
      font-weight: 600;
      color: var(--text-color);
      padding-left: 0.25rem;
    }
  }
}

.file-upload-section {
  ::ng-deep .p-fileupload {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--ground-background);

    .p-fileupload-buttonbar {
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 0;
      background: transparent;
      border: none;
    }

    .p-fileupload-content {
      padding: 1rem;
      background: transparent;
      border: none;
    }
  }

  .upload-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    width: 100%;

    .action-buttons {
      display: flex;
      gap: 0.75rem;
      flex-wrap: wrap;
      justify-content: center;
    }

    .upload-hint {
      color: var(--text-secondary-color);
      font-size: 0.875rem;
      text-align: center;
    }

    @media (max-width: 480px) {
      padding: 0.75rem;
      gap: 0.5rem;

      .action-buttons {
        width: 100%;
        flex-direction: column;

        ::ng-deep .p-button {
          width: 100%;
        }
      }

      .upload-hint {
        font-size: 0.8rem;
      }
    }
  }

  .files-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.25rem;

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-track {
      background: var(--overlay-background);
      border-radius: 3px;
    }

    &::-webkit-scrollbar-thumb {
      background: var(--border-color);
      border-radius: 3px;
      transition: background 0.2s ease;

      &:hover {
        background: var(--primary-color);
      }
    }

    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--overlay-background);

    .file-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      padding: 0.75rem;
      background: var(--card-background);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      transition: all 0.2s ease;

      &:hover {
        border-color: var(--primary-color);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
      }

      .file-info {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
        min-width: 0;

        .file-name {
          flex: 1;
          font-weight: 500;
          color: var(--text-color);
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          font-size: 0.9rem;
        }

        .file-size {
          color: var(--text-secondary-color);
          font-size: 0.875rem;
          flex-shrink: 0;
        }
      }

      .file-actions {
        display: flex;
        align-items: center;
        flex-shrink: 0;

        .status-icon {
          font-size: 1.25rem;
          padding: 0.5rem;

          &.uploading {
            color: var(--primary-color);
          }

          &.success {
            color: var(--green-500);
          }

          &.error {
            color: var(--red-500);
          }
        }
      }

      @media (max-width: 480px) {
        padding: 0.625rem;
        gap: 0.5rem;

        .file-info {
          gap: 0.5rem;

          .file-name {
            font-size: 0.85rem;
          }

          .file-size {
            font-size: 0.8rem;
          }
        }

        .file-actions {
          .status-icon {
            font-size: 1rem;
            padding: 0.375rem;
          }
        }
      }
    }
  }

  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem 1rem;

    .empty-icon-wrapper {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 80px;
      height: 80px;
      background: var(--overlay-background);
      border-radius: 50%;
      margin-bottom: 1rem;
      border: 3px dashed var(--border-color);

      .empty-icon {
        font-size: 2.5rem;
        color: var(--text-secondary-color);
        opacity: 0.6;
      }
    }

    .empty-title {
      margin: 0 0 0.5rem 0;
      font-size: 1.125rem;
      font-weight: 600;
      color: var(--text-color);
    }

    .empty-description {
      margin: 0;
      font-size: 0.875rem;
      color: var(--text-secondary-color);
      max-width: 450px;
      line-height: 1.5;

      strong {
        color: var(--text-color);
      }
    }

    @media (max-width: 480px) {
      padding: 1.5rem 0.75rem;
      min-height: 180px;

      .empty-icon-wrapper {
        width: 70px;
        height: 70px;
        margin-bottom: 0.75rem;

        .empty-icon {
          font-size: 2rem;
        }
      }

      .empty-title {
        font-size: 1rem;
      }

      .empty-description {
        font-size: 0.8rem;
        max-width: 100%;
      }
    }
  }
}

:host ::ng-deep .p-fileupload-content p-progressbar {
  display: none !important;
}
