.shelf-assigner {
  width: 550px;
  max-width: 550px;
  display: flex;
  flex-direction: column;

  @media (max-width: 640px) {
    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);
    }
  }

  @media (max-width: 480px) {
    padding: 1rem 3rem 1rem 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;
      }
    }

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

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

.shelves-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 2rem;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  min-height: 350px;
  max-height: 450px;
  overflow: hidden;

  @media (max-width: 480px) {
    padding: 1rem;
    min-height: 300px;
    max-height: 400px;
  }
}

.shelves-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  overflow: hidden;
}

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

  .shelf-count {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);

    i {
      color: var(--primary-color);
    }
  }

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

    .shelf-count {
      font-size: 0.85rem;
    }
  }
}

.shelves-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  flex: 1;
  padding-right: 0.25rem;
  min-height: 0;

  &::-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);
}

.shelf-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--ground-background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;

  &:hover {
    border-color: var(--primary-color);
    transform: translateX(3px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);

    .shelf-icon {
      color: var(--primary-color);
      transform: scale(1.08);
    }
  }

  &.selected {
    border-color: var(--primary-color);

    .shelf-icon-wrapper {
      background: var(--primary-color);

      .shelf-icon {
        color: var(--primary-contrast-color);
      }
    }
  }

  .shelf-checkbox {
    display: flex;
    align-items: center;
  }

  .shelf-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    min-width: 0;

    .shelf-icon-wrapper {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 34px;
      height: 34px;
      background: var(--overlay-background);
      border-radius: 8px;
      flex-shrink: 0;

      .shelf-icon {
        font-size: 1.125rem;
        color: var(--text-secondary-color);
        transition: all 0.3s ease;
      }
    }

    .shelf-name {
      font-size: 0.9375rem;
      color: var(--text-color);
      font-weight: 500;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

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

    .shelf-label {
      gap: 0.5rem;

      .shelf-icon-wrapper {
        width: 32px;
        height: 32px;

        .shelf-icon {
          font-size: 1rem;
        }
      }

      .shelf-name {
        font-size: 0.875rem;
      }
    }
  }
}

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

  .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;

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

  .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: 350px;
    line-height: 1.5;
  }

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

    .empty-icon-wrapper {
      width: 60px;
      height: 60px;

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

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

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

.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);

  .footer-actions {
    display: flex;
    gap: 0.75rem;
  }

  @media (max-width: 480px) {
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;

    .footer-actions {
      width: 100%;
      justify-content: flex-end;
      gap: 0.5rem;
    }
  }
}
