@use "../../../scss/globals.scss";

.repacks-modal {
  &__filter-container {
    transition: all 0.3s ease;
  }

  &__filter-top {
    margin-bottom: calc(globals.$spacing-unit * 2);
    display: flex;
    flex-direction: row;
    gap: calc(globals.$spacing-unit * 1);
    align-items: center;
  }

  &__filter-toggle {
    display: flex;
    align-items: center;
    gap: calc(globals.$spacing-unit * 1);
    font-size: globals.$small-font-size;
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: calc(globals.$spacing-unit * 1) calc(globals.$spacing-unit * 1.5);
    border-radius: 6px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
  }

  &__repacks {
    display: flex;
    gap: calc(globals.$spacing-unit * 2);
    flex-direction: column;
  }

  &__repack-button {
    display: flex;
    text-align: left;
    flex-direction: column;
    align-items: flex-start;
    gap: calc(globals.$spacing-unit * 1);
    color: globals.$body-color;
    padding: calc(globals.$spacing-unit * 2);
    padding-right: calc(globals.$spacing-unit * 4);
    position: relative;
  }

  &__availability-orb {
    position: absolute;
    top: calc(globals.$spacing-unit * 1.5);
    right: calc(globals.$spacing-unit * 1.5);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;

    &--online {
      background-color: #22c55e;
      box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
    }

    &--partial {
      background-color: #eab308;
      box-shadow: 0 0 6px rgba(234, 179, 8, 0.5);
    }

    &--offline {
      background-color: #ef4444;
      opacity: 0.7;
      box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
    }
  }

  &__repack-title {
    color: globals.$muted-color;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: calc(globals.$spacing-unit * 1);
  }

  &__repack-info {
    font-size: globals.$small-font-size;
  }

  &__new-badge {
    background-color: rgba(34, 197, 94, 0.15);
    color: rgb(187, 247, 208);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 9px;
    text-align: center;
    flex-shrink: 0;
    border: 1px solid rgba(34, 197, 94, 0.5);
  }

  &__no-results {
    width: 100%;
    padding: calc(globals.$spacing-unit * 4) 0;
    text-align: center;
    color: globals.$muted-color;
    font-size: globals.$small-font-size;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  &__no-results-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(globals.$spacing-unit * 1.5);
    max-width: 480px;
    width: 100%;
  }

  &__no-results-text {
    color: globals.$muted-color;
    font-size: globals.$small-font-size;
    text-align: center;
  }

  &__no-results-button {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  &__download-sources {
    padding: 0;
    background-color: var(--color-background-light);
    border-radius: 8px;
    margin-bottom: calc(globals.$spacing-unit * 2);
    margin-top: calc(globals.$spacing-unit * 1);
    max-height: 0;
    overflow: hidden;
    transition:
      max-height 0.3s ease,
      padding 0.3s ease;

    &--open {
      max-height: 280px;
    }
  }

  &__filter-label {
    display: none;
    font-size: globals.$small-font-size;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text-secondary);
    width: 100%;
  }

  &__source-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(globals.$spacing-unit * 1);
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: start;
    padding: calc(globals.$spacing-unit * 0.5) calc(globals.$spacing-unit * 0.5)
      calc(globals.$spacing-unit * 0.5) 0;
  }

  &__source-item {
    padding: calc(globals.$spacing-unit * 0.75) calc(globals.$spacing-unit * 1);
    background: var(--color-surface, rgba(0, 0, 0, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    display: flex;
    align-items: center;
    min-height: calc(globals.$spacing-unit * 5);
    box-sizing: border-box;
    width: 100%;
    transition: border-color 0.2s ease;

    &:hover {
      border-color: rgba(255, 255, 255, 0.2);
    }
  }

  &__source-item :global(.checkbox-field) {
    width: 100%;
    min-width: 0;
  }

  &__source-item :global(.checkbox-field__label) {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    display: block;
    font-size: 0.85rem;
    width: 100%;
    word-break: break-word;
  }
}
