@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.upload-manager {
  position: fixed;
  overflow: hidden;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  max-height: 500px;
  margin: 2.25rem;
  background: var(--theme-bg);
  border: 1px solid var(--theme-elevation-100);
  border-radius: var(--style-radius-m);
  box-shadow: var(--box-shadow-lg);
  z-index: 1024;
  display: flex;
  flex-direction: column;
}

.upload-manager__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--theme-elevation-100);
  background: var(--theme-elevation-50);

  & h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--theme-text);
  }
}

.upload-manager__tabs {
  display: flex;
  border-bottom: 1px solid var(--theme-elevation-100);
  background: var(--theme-elevation-25);

  & .upload-tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    color: var(--theme-text-dim);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 2px solid transparent;

    &:hover {
      background: var(--theme-elevation-50);
      color: var(--theme-text);
    }

    &[data-active='true'] {
      color: var(--theme-success-500);
      border-bottom-color: var(--theme-success-500);
      background: var(--theme-bg);
    }
  }
}

.upload-manager__content {
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
  padding: 0;

  & ul {
    list-style: none;
    margin: 0;
    padding: 0;

    & li {
      padding: 0.75rem 1rem;
      border-bottom: 1px solid var(--theme-elevation-50);

      &:last-child {
        border-bottom: none;
      }

      &[data-status='uploading'] {
        background: var(--theme-bg);
      }

      &[data-status='processing'] {
        background: var(--theme-warning-50);
      }

      &[data-status='completed'] {
        background: var(--theme-success-50);
      }
    }
  }

  & .upload-empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--theme-text-dim);
    font-size: 0.875rem;
    margin: 0;
  }
}

.upload-progress-bar {
  height: 3px;
  background: var(--theme-elevation-100);
  border-radius: 2px;
  overflow: hidden;
  position: relative;

  & .upload-progress {
    height: 100%;
    background: var(--theme-success-500);
    width: calc(var(--progress) * 100%);
    transition: width 0.3s ease;
    border-radius: inherit;

    &[data-active='true'] {
      background: var(--theme-warning-500);
      animation: pulse 1.5s ease-in-out infinite;
      width: 100%;
    }
  }
}

.upload-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;

  & .upload-filename {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--theme-text);
    flex: 1;
    margin-right: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  & .upload-meta {
    font-size: 0.75rem;
    color: var(--theme-text-dim);
    font-weight: 500;
    flex-shrink: 0;
  }
}

.upload-manager__file {
  & .upload-manager__file--polling {
    animation: pulse 2s ease-in-out infinite;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #3b82f6);
    background-size: 200% 100%;
    animation:
      pulse 2s ease-in-out infinite,
      shimmer 3s ease-in-out infinite;
  }
}

.upload-manager__footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--theme-elevation-100);
  background: var(--theme-elevation-50);
  display: flex;
  justify-content: center;
}

@media (max-width: 768px) {
  .upload-manager {
    width: calc(100vw - 2rem);
    right: 1rem;
    left: 1rem;
  }
}
